From 5378b12b61442d92327f85c691f02a2eab792dc3 Mon Sep 17 00:00:00 2001 From: chen Date: Sat, 28 May 2022 15:15:57 +0800 Subject: [PATCH] modify samgr uid Signed-off-by: chen Change-Id: I7a595e0dc91396ce50df5b5f5d9c4306e9d12659 --- bundle.json | 1 - etc/BUILD.gn | 18 ++++- .../samgr_standard.cfg | 0 services/samgr/native/BUILD.gn | 15 ----- services/samgr/native/samgr_standard.cfg | 11 --- test/unittest/system_ability_manager_test.cpp | 67 +++++++++++++++++++ 6 files changed, 83 insertions(+), 29 deletions(-) mode change 100755 => 100644 etc/BUILD.gn rename services/samgr/native/samgr_standard_musl.cfg => etc/samgr_standard.cfg (100%) delete mode 100644 services/samgr/native/samgr_standard.cfg create mode 100644 test/unittest/system_ability_manager_test.cpp diff --git a/bundle.json b/bundle.json index 60b194e9..c89583ac 100644 --- a/bundle.json +++ b/bundle.json @@ -34,7 +34,6 @@ "//foundation/distributedschedule/samgr/interfaces/innerkits/common:samgr_common", "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", "//foundation/distributedschedule/samgr/services/samgr/native:samgr", - "//foundation/distributedschedule/samgr/services/samgr/native:etc", "//foundation/distributedschedule/samgr/etc:samgr_etc", "//third_party/libxml2:libxml2" ], diff --git a/etc/BUILD.gn b/etc/BUILD.gn old mode 100755 new mode 100644 index 726b4118..c41dc122 --- a/etc/BUILD.gn +++ b/etc/BUILD.gn @@ -9,12 +9,15 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/ohos.gni") group("samgr_etc") { - deps = [ ":samgr.param.dac" ] + deps = [ + ":samgr.param.dac", + ":samgr_init", + ] } ohos_prebuilt_etc("samgr.param.dac") { @@ -23,3 +26,14 @@ ohos_prebuilt_etc("samgr.param.dac") { part_name = "samgr_standard" subsystem_name = "distributedschedule" } + +group("etc") { + deps = [ ":samgr_init" ] +} + +ohos_prebuilt_etc("samgr_init") { + source = "samgr_standard.cfg" + relative_install_dir = "init" + part_name = "samgr_standard" + subsystem_name = "distributedschedule" +} diff --git a/services/samgr/native/samgr_standard_musl.cfg b/etc/samgr_standard.cfg similarity index 100% rename from services/samgr/native/samgr_standard_musl.cfg rename to etc/samgr_standard.cfg diff --git a/services/samgr/native/BUILD.gn b/services/samgr/native/BUILD.gn index 8862f8a3..b09ddf6c 100644 --- a/services/samgr/native/BUILD.gn +++ b/services/samgr/native/BUILD.gn @@ -31,21 +31,6 @@ config("sam_config") { ] } -group("etc") { - deps = [ ":samgr_init" ] -} - -ohos_prebuilt_etc("samgr_init") { - if (use_musl) { - source = "samgr_standard_musl.cfg" - } else { - source = "samgr_standard.cfg" - } - relative_install_dir = "init" - part_name = "samgr_standard" - subsystem_name = "distributedschedule" -} - ohos_executable("samgr") { install_enable = true sources = [ diff --git a/services/samgr/native/samgr_standard.cfg b/services/samgr/native/samgr_standard.cfg deleted file mode 100644 index 3811f208..00000000 --- a/services/samgr/native/samgr_standard.cfg +++ /dev/null @@ -1,11 +0,0 @@ -{ - "services" : [{ - "name" : "samgr", - "path" : ["/system/bin/samgr"], - "critical" : [1, 1, 60], - "uid" : "system", - "gid" : ["system", "readproc"], - "start-mode" : "boot" - } - ] -} diff --git a/test/unittest/system_ability_manager_test.cpp b/test/unittest/system_ability_manager_test.cpp new file mode 100644 index 00000000..2ed1bfe7 --- /dev/null +++ b/test/unittest/system_ability_manager_test.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" +#include "parameter.h" +#include "test_log.h" + +namespace OHOS { +namespace SAMGR { +class SystemAbilityManagerTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp(); + void TearDown(); +}; + +void SystemAbilityManagerTest::SetUpTestCase() +{ + DTEST_LOG << "SystemAbilityManagerTest SetUpTestCase" << std::endl; +} + +void SystemAbilityManagerTest::TearDownTestCase() +{ + DTEST_LOG << "SystemAbilityManagerTest TearDownTestCase" << std::endl; +} + +void SystemAbilityManagerTest::SetUp() +{ + DTEST_LOG << "SystemAbilityManagerTest SetUp" << std::endl; +} + +void SystemAbilityManagerTest::TearDown() +{ + DTEST_LOG << "SystemAbilityManagerTest TearDown" << std::endl; +} + +/** + * @tc.name: param check samgr ready event + * @tc.desc: param check samgr ready event + * @tc.type: FUNC + * @tc.require: AR000H0IFC + */ +HWTEST_F(SystemAbilityManagerTest, SamgrReady001, TestSize.Level1) +{ + DTEST_LOG << " SamgrReady001 start " << std::endl; + /** + * @tc.steps: step1. param check samgr ready event + * @tc.expected: step1. param check samgr ready event + */ + auto ret = WaitParameter("bootevent.samgr.ready", "true", 1); + ASSERT_EQ(ret, 0); +} +} +} \ No newline at end of file -- Gitee