Only run Service::Start() under root

Tests using Service::Start() should run under root. Otherwise tests fail
to start services from the test binary due to lack of permission.

Bug: 244748231
Test: CtsInitTestCases
Change-Id: Ia4eb8457cfad7d44da6b171e44f64238e08af9f7
diff --git a/init/init_test.cpp b/init/init_test.cpp
index 05cf3fd..8362390 100644
--- a/init/init_test.cpp
+++ b/init/init_test.cpp
@@ -280,6 +280,10 @@
 }
 
 TEST(init, StopServiceByApexName) {
+    if (getuid() != 0) {
+        GTEST_SKIP() << "Must be run as root.";
+        return;
+    }
     std::string_view script_template = R"init(
 service apex_test_service /system/bin/yes
     user shell
@@ -291,6 +295,10 @@
 }
 
 TEST(init, StopMultipleServicesByApexName) {
+    if (getuid() != 0) {
+        GTEST_SKIP() << "Must be run as root.";
+        return;
+    }
     std::string_view script_template = R"init(
 service apex_test_service_multiple_a /system/bin/yes
     user shell
@@ -307,6 +315,10 @@
 }
 
 TEST(init, StopServicesFromMultipleApexes) {
+    if (getuid() != 0) {
+        GTEST_SKIP() << "Must be run as root.";
+        return;
+    }
     std::string_view apex_script_template = R"init(
 service apex_test_service_multi_apex_a /system/bin/yes
     user shell
@@ -332,6 +344,10 @@
 }
 
 TEST(init, StopServicesFromApexAndNonApex) {
+    if (getuid() != 0) {
+        GTEST_SKIP() << "Must be run as root.";
+        return;
+    }
     std::string_view apex_script_template = R"init(
 service apex_test_service_apex_a /system/bin/yes
     user shell
@@ -357,6 +373,10 @@
 }
 
 TEST(init, StopServicesFromApexMixed) {
+    if (getuid() != 0) {
+        GTEST_SKIP() << "Must be run as root.";
+        return;
+    }
     std::string_view script_template = R"init(
 service apex_test_service_mixed_a /system/bin/yes
     user shell