From 14f4afd2f2d4f24612cc789dada3e9f7b660372a Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 30 Mar 2020 09:11:23 -0700 Subject: [PATCH 1/2] init: require root for oneshot_on test Bug: 152630580 Bug: 152637928 Bug: 152662041 Bug: 152662652 Test: this test is skipped when run as non-root Change-Id: I7118025cc20081a200000bf484a08c9ed0b0d3ec --- init/oneshot_on_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/init/oneshot_on_test.cpp b/init/oneshot_on_test.cpp index 487e0ea69..a9ad8715e 100644 --- a/init/oneshot_on_test.cpp +++ b/init/oneshot_on_test.cpp @@ -27,6 +27,11 @@ using namespace std::literals; #if 0 // TODO(b/152637928): this test is flaky TEST(init, oneshot_on) { + if (getuid() != 0) { + GTEST_SKIP() << "Skipping test, must be run as root."; + return; + } + // Bootanim shouldn't be running once the device has booted. ASSERT_EQ("stopped", GetProperty("init.svc.bootanim", "")); From 91537d30de4c49bfba3a7b0fdb77d61edee02c45 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 30 Mar 2020 09:09:47 -0700 Subject: [PATCH 2/2] Revert "init: disable oneshot_on test" This reverts commit d30c51157e77cf75f09aab7a3db1c274f1823ee6. This test wasn't flaky, it was failing when not run as root, but that has been fixed. Bug: 152630580 Bug: 152637928 Test: this test is okay now Change-Id: I3b20be2839dae90ffc6a8eeea68f36e532060af1 --- init/oneshot_on_test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/init/oneshot_on_test.cpp b/init/oneshot_on_test.cpp index a9ad8715e..650f0650b 100644 --- a/init/oneshot_on_test.cpp +++ b/init/oneshot_on_test.cpp @@ -25,7 +25,6 @@ using android::base::SetProperty; using android::base::WaitForProperty; using namespace std::literals; -#if 0 // TODO(b/152637928): this test is flaky TEST(init, oneshot_on) { if (getuid() != 0) { GTEST_SKIP() << "Skipping test, must be run as root."; @@ -48,4 +47,3 @@ TEST(init, oneshot_on) { // Now that oneshot is enabled again, bootanim should transition into the 'stopped' state. EXPECT_TRUE(WaitForProperty("init.svc.bootanim", "stopped", 10s)); } -#endif