diff --git a/TEST_MAPPING b/TEST_MAPPING index a3bd44f77..cc1978df3 100644 --- a/TEST_MAPPING +++ b/TEST_MAPPING @@ -3,6 +3,9 @@ { "name": "adbd_test" }, + { + "name": "CtsInitTestCases" + }, { "name": "debuggerd_test" }, @@ -12,9 +15,6 @@ { "name": "fs_mgr_vendor_overlay_test" }, - { - "name": "init_tests" - }, { "name": "libbase_test" }, diff --git a/init/Android.bp b/init/Android.bp index 3233cc310..6dd2b9f28 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -206,9 +206,18 @@ cc_binary { // ------------------------------------------------------------------------------ cc_test { - name: "init_tests", + name: "CtsInitTestCases", defaults: ["init_defaults"], - compile_multilib: "first", + compile_multilib: "both", + multilib: { + lib32: { + suffix: "32", + }, + lib64: { + suffix: "64", + }, + }, + srcs: [ "devices_test.cpp", "init_test.cpp", @@ -225,7 +234,12 @@ cc_test { "util_test.cpp", ], static_libs: ["libinit"], - test_suites: ["device-tests"], + + test_suites: [ + "cts", + "device-tests", + "vts", + ], } cc_benchmark { diff --git a/init/AndroidTest.xml b/init/AndroidTest.xml new file mode 100644 index 000000000..94a02e6d5 --- /dev/null +++ b/init/AndroidTest.xml @@ -0,0 +1,31 @@ + + + + diff --git a/init/property_service_test.cpp b/init/property_service_test.cpp index c038aff40..0f4cd0d1f 100644 --- a/init/property_service_test.cpp +++ b/init/property_service_test.cpp @@ -56,6 +56,11 @@ TEST(property_service, very_long_name_35166374) { } TEST(property_service, non_utf8_value) { + if (getuid() != 0) { + GTEST_SKIP() << "Skipping test, must be run as root."; + return; + } + ASSERT_TRUE(SetProperty("property_service_utf8_test", "base_success")); EXPECT_FALSE(SetProperty("property_service_utf8_test", "\x80")); EXPECT_FALSE(SetProperty("property_service_utf8_test", "\xC2\x01")); diff --git a/init/subcontext_test.cpp b/init/subcontext_test.cpp index ae89c389c..dcbff8259 100644 --- a/init/subcontext_test.cpp +++ b/init/subcontext_test.cpp @@ -43,7 +43,7 @@ namespace init { template void RunTest(F&& test_function) { if (getuid() != 0) { - GTEST_LOG_(INFO) << "Skipping test, must be run as root."; + GTEST_SKIP() << "Skipping test, must be run as root."; return; } diff --git a/init/ueventd_test.cpp b/init/ueventd_test.cpp index bfdc28e6d..2d7d2f819 100644 --- a/init/ueventd_test.cpp +++ b/init/ueventd_test.cpp @@ -68,7 +68,7 @@ void WriteFromMultipleThreads(std::vector>& files_and_ TEST(ueventd, setegid_IsPerThread) { if (getuid() != 0) { - GTEST_LOG_(INFO) << "Skipping test, must be run as root."; + GTEST_SKIP() << "Skipping test, must be run as root."; return; } @@ -92,11 +92,11 @@ TEST(ueventd, setegid_IsPerThread) { TEST(ueventd, setfscreatecon_IsPerThread) { if (getuid() != 0) { - GTEST_LOG_(INFO) << "Skipping test, must be run as root."; + GTEST_SKIP() << "Skipping test, must be run as root."; return; } if (!is_selinux_enabled() || security_getenforce() == 1) { - GTEST_LOG_(INFO) << "Skipping test, SELinux must be enabled and in permissive mode."; + GTEST_SKIP() << "Skipping test, SELinux must be enabled and in permissive mode."; return; } @@ -127,7 +127,7 @@ TEST(ueventd, setfscreatecon_IsPerThread) { TEST(ueventd, selabel_lookup_MultiThreaded) { if (getuid() != 0) { - GTEST_LOG_(INFO) << "Skipping test, must be run as root."; + GTEST_SKIP() << "Skipping test, must be run as root."; return; }