From 2f0508686e1117ebb51641146cf0df2e72bae549 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Wed, 8 Feb 2023 17:25:47 -0800 Subject: [PATCH] Only run GentleKill test as root Without root, Service::Start() fails due to lack of permissions. Bug: 267559075 Test: run cts -m CtsInitTestCases -t init#GentleKill atest init#GentleKill Will skip under cts, pass under atest Change-Id: I69e8be7000718bdba1c2acd9675b5645c0891afc --- init/init_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/init_test.cpp b/init/init_test.cpp index 1e69ede0b..7bb5c909c 100644 --- a/init/init_test.cpp +++ b/init/init_test.cpp @@ -679,6 +679,10 @@ pid_t ForkExecvpAsync(const std::vector& args) { } TEST(init, GentleKill) { + if (getuid() != 0) { + GTEST_SKIP() << "Must be run as root."; + return; + } std::string init_script = R"init( service test_gentle_kill /system/bin/sleep 1000 disabled