summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Ioffe <ioffe@google.com>2021-06-30 00:20:01 +0100
committerNikita Ioffe <ioffe@google.com>2021-06-29 23:23:33 +0000
commit49b3a5c8914db6dd3d809ac110b111b07121ba1f (patch)
tree77c904e88042bf39907f2deab2ffd0feb5a4a193
parent67fa21cbdc6f5a5488d17a985aaff3d9124ef1f4 (diff)
downloadcore-49b3a5c8914db6dd3d809ac110b111b07121ba1f.tar.gz
Only run RebootTest under root
This test requires running test services, which causes test to crash (and still incorrectly be reported as passing) when running on non-rooted device. Ignore-AOSP-First: reboot_test is not in AOSP yet Bug: 190958734 Test: atest CtsInitTestCases Change-Id: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
-rw-r--r--init/reboot_test.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/init/reboot_test.cpp b/init/reboot_test.cpp
index 06702e3a6..b3d038d14 100644
--- a/init/reboot_test.cpp
+++ b/init/reboot_test.cpp
@@ -113,6 +113,11 @@ service $name /system/bin/yes
}
TEST_F(RebootTest, StopServicesSIGTERM) {
+ if (getuid() != 0) {
+ GTEST_SKIP() << "Skipping test, must be run as root.";
+ return;
+ }
+
AddTestService("A");
AddTestService("B");
@@ -148,6 +153,11 @@ TEST_F(RebootTest, StopServicesSIGTERM) {
}
TEST_F(RebootTest, StopServicesSIGKILL) {
+ if (getuid() != 0) {
+ GTEST_SKIP() << "Skipping test, must be run as root.";
+ return;
+ }
+
AddTestService("A");
AddTestService("B");