am b220c4b6
: Merge "Make bionic gtest main be compatible with gtest output format for cts test."
* commit 'b220c4b609270cc6b76c4635d91d1f851aa63e57': Make bionic gtest main be compatible with gtest output format for cts test.
This commit is contained in:
commit
09ee78ae01
@ -211,7 +211,7 @@ build_type := host
|
||||
include $(LOCAL_PATH)/Android.build.mk
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Library of bionic customized gtest main function.
|
||||
# Library of bionic customized gtest main function, with simplified output format.
|
||||
# -----------------------------------------------------------------------------
|
||||
libBionicGtestMain_src_files := gtest_main.cpp
|
||||
|
||||
@ -227,6 +227,24 @@ include $(LOCAL_PATH)/Android.build.mk
|
||||
build_type := host
|
||||
include $(LOCAL_PATH)/Android.build.mk
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Library of bionic customized gtest main function, with normal gtest output format,
|
||||
# which is needed by bionic cts test.
|
||||
# -----------------------------------------------------------------------------
|
||||
libBionicCtsGtestMain_src_files := gtest_main.cpp
|
||||
|
||||
libBionicCtsGtestMain_cflags := $(test_cflags)
|
||||
|
||||
libBionicCtsGtestMain_cppflags := $(test_cppflags) -DUSING_GTEST_OUTPUT_FORMAT
|
||||
|
||||
module := libBionicCtsGtestMain
|
||||
module_tag := optional
|
||||
build_type := target
|
||||
build_target := STATIC_TEST_LIBRARY
|
||||
include $(LOCAL_PATH)/Android.build.mk
|
||||
build_type := host
|
||||
include $(LOCAL_PATH)/Android.build.mk
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Tests for the device using bionic's .so. Run with:
|
||||
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests32
|
||||
|
@ -295,6 +295,32 @@ static void OnTestIterationStartPrint(const std::vector<TestCase>& testcase_list
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
// bionic cts test needs gtest output format.
|
||||
#if defined(USING_GTEST_OUTPUT_FORMAT)
|
||||
|
||||
static void OnTestEndPrint(const TestCase& testcase, size_t test_id) {
|
||||
ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
|
||||
printf("%s\n", testcase.GetTestName(test_id).c_str());
|
||||
|
||||
const std::string& test_output = testcase.GetTest(test_id).GetTestOutput();
|
||||
printf("%s", test_output.c_str());
|
||||
|
||||
TestResult result = testcase.GetTestResult(test_id);
|
||||
if (result == TEST_SUCCESS) {
|
||||
ColoredPrintf(COLOR_GREEN, "[ OK ] ");
|
||||
} else {
|
||||
ColoredPrintf(COLOR_RED, "[ FAILED ] ");
|
||||
}
|
||||
printf("%s", testcase.GetTestName(test_id).c_str());
|
||||
if (testing::GTEST_FLAG(print_time)) {
|
||||
printf(" (%" PRId64 " ms)", testcase.GetTestTime(test_id) / 1000000);
|
||||
}
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#else // !defined(USING_GTEST_OUTPUT_FORMAT)
|
||||
|
||||
static void OnTestEndPrint(const TestCase& testcase, size_t test_id) {
|
||||
TestResult result = testcase.GetTestResult(test_id);
|
||||
if (result == TEST_SUCCESS) {
|
||||
@ -307,16 +333,17 @@ static void OnTestEndPrint(const TestCase& testcase, size_t test_id) {
|
||||
|
||||
printf("%s", testcase.GetTestName(test_id).c_str());
|
||||
if (testing::GTEST_FLAG(print_time)) {
|
||||
printf(" (%" PRId64 " ms)\n", testcase.GetTestTime(test_id) / 1000000);
|
||||
} else {
|
||||
printf("\n");
|
||||
printf(" (%" PRId64 " ms)", testcase.GetTestTime(test_id) / 1000000);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
const std::string& test_output = testcase.GetTest(test_id).GetTestOutput();
|
||||
printf("%s", test_output.c_str());
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#endif // !defined(USING_GTEST_OUTPUT_FORMAT)
|
||||
|
||||
static void OnTestIterationEndPrint(const std::vector<TestCase>& testcase_list, size_t /*iteration*/,
|
||||
int64_t elapsed_time_ns) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user