From 5b1c316a1f0a52b66558d5e2ca6b88f2c40b9a72 Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Mon, 30 Mar 2020 09:11:23 -0700 Subject: [PATCH] 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 Merged-In: I7118025cc20081a200000bf484a08c9ed0b0d3ec Change-Id: I7118025cc20081a200000bf484a08c9ed0b0d3ec (cherry picked from commit 14f4afd2f2d4f24612cc789dada3e9f7b660372a) --- 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 7e7cc3679..650f0650b 100644 --- a/init/oneshot_on_test.cpp +++ b/init/oneshot_on_test.cpp @@ -26,6 +26,11 @@ using android::base::WaitForProperty; using namespace std::literals; 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", ""));