diff options
| author | Tom Cherry <tomcherry@google.com> | 2017-08-01 20:25:57 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-08-01 20:25:57 +0000 |
| commit | b1c18af2475100c2926356917c5acf5ffcea0257 (patch) | |
| tree | 56a20ab8450e706e16f987adfbdb312d017f77ce /init/service_test.cpp | |
| parent | 25422816d4acad3c4e4d7cae5eb44c1525ed896d (diff) | |
| parent | 2a2a8d9ec04676974a2c1edfc0715e8b1a66f903 (diff) | |
| download | system_core-b1c18af2475100c2926356917c5acf5ffcea0257.tar.gz system_core-b1c18af2475100c2926356917c5acf5ffcea0257.tar.bz2 system_core-b1c18af2475100c2926356917c5acf5ffcea0257.zip | |
Merge changes Ibd57c103,I81f1e8ac,Ia6e546fe
am: 2a2a8d9ec0
Change-Id: Id39de0d3d62c1e0f3585ae7817940dbbebfa6ae3
Diffstat (limited to 'init/service_test.cpp')
| -rw-r--r-- | init/service_test.cpp | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/init/service_test.cpp b/init/service_test.cpp index 123c8a5d6..62e46f4cd 100644 --- a/init/service_test.cpp +++ b/init/service_test.cpp @@ -73,23 +73,21 @@ TEST(service, pod_initialized) { EXPECT_FALSE(service_in_old_memory->process_cgroup_empty()); } -TEST(service, make_exec_oneshot_service_invalid_syntax) { - ServiceManager& sm = ServiceManager::GetInstance(); +TEST(service, make_temporary_oneshot_service_invalid_syntax) { std::vector<std::string> args; // Nothing. - ASSERT_EQ(nullptr, sm.MakeExecOneshotService(args)); + ASSERT_EQ(nullptr, Service::MakeTemporaryOneshotService(args)); // No arguments to 'exec'. args.push_back("exec"); - ASSERT_EQ(nullptr, sm.MakeExecOneshotService(args)); + ASSERT_EQ(nullptr, Service::MakeTemporaryOneshotService(args)); // No command in "exec --". args.push_back("--"); - ASSERT_EQ(nullptr, sm.MakeExecOneshotService(args)); + ASSERT_EQ(nullptr, Service::MakeTemporaryOneshotService(args)); } -TEST(service, make_exec_oneshot_service_too_many_supplementary_gids) { - ServiceManager& sm = ServiceManager::GetInstance(); +TEST(service, make_temporary_oneshot_service_too_many_supplementary_gids) { std::vector<std::string> args; args.push_back("exec"); args.push_back("seclabel"); @@ -100,12 +98,11 @@ TEST(service, make_exec_oneshot_service_too_many_supplementary_gids) { } args.push_back("--"); args.push_back("/system/bin/id"); - ASSERT_EQ(nullptr, sm.MakeExecOneshotService(args)); + ASSERT_EQ(nullptr, Service::MakeTemporaryOneshotService(args)); } -static void Test_make_exec_oneshot_service(bool dash_dash, bool seclabel, bool uid, bool gid, - bool supplementary_gids) { - ServiceManager& sm = ServiceManager::GetInstance(); +static void Test_make_temporary_oneshot_service(bool dash_dash, bool seclabel, bool uid, bool gid, + bool supplementary_gids) { std::vector<std::string> args; args.push_back("exec"); if (seclabel) { @@ -126,7 +123,7 @@ static void Test_make_exec_oneshot_service(bool dash_dash, bool seclabel, bool u } args.push_back("/system/bin/toybox"); args.push_back("id"); - Service* svc = sm.MakeExecOneshotService(args); + auto svc = Service::MakeTemporaryOneshotService(args); ASSERT_NE(nullptr, svc); if (seclabel) { @@ -167,28 +164,28 @@ static void Test_make_exec_oneshot_service(bool dash_dash, bool seclabel, bool u ASSERT_EQ("id", svc->args()[1]); } -TEST(service, make_exec_oneshot_service_with_everything) { - Test_make_exec_oneshot_service(true, true, true, true, true); +TEST(service, make_temporary_oneshot_service_with_everything) { + Test_make_temporary_oneshot_service(true, true, true, true, true); } -TEST(service, make_exec_oneshot_service_with_seclabel_uid_gid) { - Test_make_exec_oneshot_service(true, true, true, true, false); +TEST(service, make_temporary_oneshot_service_with_seclabel_uid_gid) { + Test_make_temporary_oneshot_service(true, true, true, true, false); } -TEST(service, make_exec_oneshot_service_with_seclabel_uid) { - Test_make_exec_oneshot_service(true, true, true, false, false); +TEST(service, make_temporary_oneshot_service_with_seclabel_uid) { + Test_make_temporary_oneshot_service(true, true, true, false, false); } -TEST(service, make_exec_oneshot_service_with_seclabel) { - Test_make_exec_oneshot_service(true, true, false, false, false); +TEST(service, make_temporary_oneshot_service_with_seclabel) { + Test_make_temporary_oneshot_service(true, true, false, false, false); } -TEST(service, make_exec_oneshot_service_with_just_command) { - Test_make_exec_oneshot_service(true, false, false, false, false); +TEST(service, make_temporary_oneshot_service_with_just_command) { + Test_make_temporary_oneshot_service(true, false, false, false, false); } -TEST(service, make_exec_oneshot_service_with_just_command_no_dash) { - Test_make_exec_oneshot_service(false, false, false, false, false); +TEST(service, make_temporary_oneshot_service_with_just_command_no_dash) { + Test_make_temporary_oneshot_service(false, false, false, false, false); } } // namespace init |
