Merge "Only run Service::Start() under root" am: 752437b0c7
Original change: https://android-review.googlesource.com/c/platform/system/core/+/2207038 Change-Id: I9f46cc564b7af2b2d098373d0c68a119e398707b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
5caaa2590e
1 changed files with 20 additions and 0 deletions
|
|
@ -280,6 +280,10 @@ void TestApexServicesInit(const std::vector<std::string>& apex_services,
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(init, StopServiceByApexName) {
|
TEST(init, StopServiceByApexName) {
|
||||||
|
if (getuid() != 0) {
|
||||||
|
GTEST_SKIP() << "Must be run as root.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string_view script_template = R"init(
|
std::string_view script_template = R"init(
|
||||||
service apex_test_service /system/bin/yes
|
service apex_test_service /system/bin/yes
|
||||||
user shell
|
user shell
|
||||||
|
|
@ -291,6 +295,10 @@ service apex_test_service /system/bin/yes
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(init, StopMultipleServicesByApexName) {
|
TEST(init, StopMultipleServicesByApexName) {
|
||||||
|
if (getuid() != 0) {
|
||||||
|
GTEST_SKIP() << "Must be run as root.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string_view script_template = R"init(
|
std::string_view script_template = R"init(
|
||||||
service apex_test_service_multiple_a /system/bin/yes
|
service apex_test_service_multiple_a /system/bin/yes
|
||||||
user shell
|
user shell
|
||||||
|
|
@ -307,6 +315,10 @@ service apex_test_service_multiple_b /system/bin/id
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(init, StopServicesFromMultipleApexes) {
|
TEST(init, StopServicesFromMultipleApexes) {
|
||||||
|
if (getuid() != 0) {
|
||||||
|
GTEST_SKIP() << "Must be run as root.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string_view apex_script_template = R"init(
|
std::string_view apex_script_template = R"init(
|
||||||
service apex_test_service_multi_apex_a /system/bin/yes
|
service apex_test_service_multi_apex_a /system/bin/yes
|
||||||
user shell
|
user shell
|
||||||
|
|
@ -332,6 +344,10 @@ service apex_test_service_multi_apex_c /system/bin/yes
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(init, StopServicesFromApexAndNonApex) {
|
TEST(init, StopServicesFromApexAndNonApex) {
|
||||||
|
if (getuid() != 0) {
|
||||||
|
GTEST_SKIP() << "Must be run as root.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string_view apex_script_template = R"init(
|
std::string_view apex_script_template = R"init(
|
||||||
service apex_test_service_apex_a /system/bin/yes
|
service apex_test_service_apex_a /system/bin/yes
|
||||||
user shell
|
user shell
|
||||||
|
|
@ -357,6 +373,10 @@ service apex_test_service_non_apex /system/bin/yes
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(init, StopServicesFromApexMixed) {
|
TEST(init, StopServicesFromApexMixed) {
|
||||||
|
if (getuid() != 0) {
|
||||||
|
GTEST_SKIP() << "Must be run as root.";
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::string_view script_template = R"init(
|
std::string_view script_template = R"init(
|
||||||
service apex_test_service_mixed_a /system/bin/yes
|
service apex_test_service_mixed_a /system/bin/yes
|
||||||
user shell
|
user shell
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue