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
Merged-In: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
Change-Id: I3c5c9917d0a787d66272ccf4aefc57e6573841bc
This commit is contained in:
Nikita Ioffe 2021-06-30 00:20:01 +01:00 committed by Jiyong Park
parent 86b4324a0a
commit 0a0e4793e3

View file

@ -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");