diff options
author | Christopher Ferris <cferris@google.com> | 2019-09-05 17:17:49 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-09-05 17:17:49 -0700 |
commit | 38153839de9fbdea32d0bba13359010f540e9a27 (patch) | |
tree | d6ea62f06bd04374432d635eef4a058062bd77c1 | |
parent | 0d27c7aa6b9f93ed26f0572d29f71315c5b742f3 (diff) | |
parent | fd45178a3a1da371321c40d34fa1b77544804173 (diff) | |
download | gtest_extras-38153839de9fbdea32d0bba13359010f540e9a27.tar.gz |
Run unit tests on changes. am: 194dbad0c1 am: afa945b8e3 am: 2f84c2df11
am: fd45178a3a
Change-Id: I068922874614a160620f2567a976bcd209a49350
-rw-r--r-- | Android.bp | 2 | ||||
-rw-r--r-- | TEST_MAPPING | 7 | ||||
-rw-r--r-- | tests/SystemTests.cpp | 55 |
3 files changed, 51 insertions, 13 deletions
@@ -75,4 +75,6 @@ cc_test { "liblog", ], whole_static_libs: ["libgtest_isolated_main"], + + test_suites: ["device-tests"], } diff --git a/TEST_MAPPING b/TEST_MAPPING new file mode 100644 index 0000000..c4002f2 --- /dev/null +++ b/TEST_MAPPING @@ -0,0 +1,7 @@ +{ + "presubmit": [ + { + "name": "gtest_isolated_tests" + } + ] +} diff --git a/tests/SystemTests.cpp b/tests/SystemTests.cpp index bffa98b..e956640 100644 --- a/tests/SystemTests.cpp +++ b/tests/SystemTests.cpp @@ -20,6 +20,7 @@ #endif #include <signal.h> #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> @@ -54,6 +55,10 @@ class SystemTests : public ::testing::Test { raw_output_ = ""; sanitized_output_ = ""; exitcode_ = 0; + + // Clear all environment variables to make sure the test isn't affected + // by GTEST_XXX ones. + clearenv(); } void SanitizeOutput(); @@ -89,6 +94,10 @@ void SystemTests::SanitizeOutput() { // Change any error message like .../file.cc:(200) to file:(XX) sanitized_output_ = std::regex_replace( sanitized_output_, std::regex("\\b([^/\\s]+/)*[^/\\s]+:\\(\\d+\\)\\s"), "file:(XX) "); + + // Change any terminated by signal message to ignore the actual signal name. + sanitized_output_ = + std::regex_replace(sanitized_output_, std::regex("( terminated by signal:) .*"), "$1 XXX"); } void SystemTests::Exec(std::vector<const char*> args) { @@ -400,11 +409,7 @@ TEST_F(SystemTests, verify_crash) { "Note: Google Test filter = *.DISABLED_crash\n" "[==========] Running 1 test from 1 test suite (20 jobs).\n" "[ RUN ] SystemTests.DISABLED_crash\n" -#if defined(__APPLE__) - "SystemTests.DISABLED_crash terminated by signal: Segmentation fault: 11.\n" -#else - "SystemTests.DISABLED_crash terminated by signal: Segmentation fault.\n" -#endif + "SystemTests.DISABLED_crash terminated by signal: XXX\n" "[ FAILED ] SystemTests.DISABLED_crash (XX ms)\n" "[==========] 1 test from 1 test suite ran. (XX ms total)\n" "[ PASSED ] 0 tests.\n" @@ -1363,21 +1368,45 @@ TEST(SystemTestsShard1, DISABLED_case1_test3) {} TEST(SystemTestsShard1, DISABLED_case1_test4) {} -TEST(SystemTestsShard2, DISABLED_case2_test1) {} +TEST(SystemTestsShard2, DISABLED_case2_test1) { + // Make sure this test always finishes second. + sleep(1); +} -TEST(SystemTestsShard2, DISABLED_case2_test2) {} +TEST(SystemTestsShard2, DISABLED_case2_test2) { + // Make sure this test always finishes second. + sleep(1); +} -TEST(SystemTestsShard2, DISABLED_case2_test3) {} +TEST(SystemTestsShard2, DISABLED_case2_test3) { + // Make sure this test always finishes second. + sleep(1); +} -TEST(SystemTestsShard2, DISABLED_case2_test4) {} +TEST(SystemTestsShard2, DISABLED_case2_test4) { + // Make sure this test always finishes second. + sleep(1); +} -TEST(SystemTestsShard3, DISABLED_case3_test1) {} +TEST(SystemTestsShard3, DISABLED_case3_test1) { + // Make sure this test always finishes third. + sleep(2); +} -TEST(SystemTestsShard3, DISABLED_case3_test2) {} +TEST(SystemTestsShard3, DISABLED_case3_test2) { + // Make sure this test always finishes third. + sleep(2); +} -TEST(SystemTestsShard3, DISABLED_case3_test3) {} +TEST(SystemTestsShard3, DISABLED_case3_test3) { + // Make sure this test always finishes third. + sleep(2); +} -TEST(SystemTestsShard3, DISABLED_case3_test4) {} +TEST(SystemTestsShard3, DISABLED_case3_test4) { + // Make sure this test always finishes third. + sleep(2); +} } // namespace gtest_extras } // namespace android |