1#!/usr/bin/env python3 2# -*- coding: utf-8 -*- 3# 4# Copyright (c) 2024 Huawei Device Co., Ltd. 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17from devicetest.core.test_case import TestCase, Step 18from sysCapUtils import sysCapUtils 19import json 20 21# @tc.number: STD-SOFTWARE-0102 22# @tc.name: testMinimumComponentSet 23# @tc.desc: 【STD-SOFTWARE-0102】禁止删减 productdefine/common/base/standard_system.json 定义的最小系统部件集配置。 24# 【G-SOFTWARE-0700】禁止修改OpenHarmony系统定义的SystemCapability名称。 25class testMinimumComponentSet(TestCase): 26 27 def __init__(self, controllers): 28 self.TAG = self.__class__.__name__ 29 super().__init__(self.TAG, controllers) 30 31 def setup(self): 32 Step("Setup") 33 34 def process(self): 35 Step("Process") 36 deviceSysCapsStr = self.device1.execute_shell_command("cat /system/etc/param/syscap.para") 37 deviceSysCapsList = sysCapUtils.getAllSysCaps(deviceSysCapsStr) 38 with open('./resource/pcs/standard_system.json', 'r') as f: 39 minimumComponentDatas = json.load(f)['components'] 40 minimumComponentSysCaps = [] 41 for minimumComponentData in minimumComponentDatas: 42 componentSysCaps = minimumComponentData['syscap'] 43 for componentSysCap in componentSysCaps: 44 minimumComponentSysCaps.append(componentSysCap) 45 46 missingList = [] 47 for minimumComponentSysCap in minimumComponentSysCaps: 48 if minimumComponentSysCap not in deviceSysCapsList: 49 missingList.append(minimumComponentSysCap) 50 if len(missingList) != 0: 51 self.log.info('missingList: [' + ', '.join(missingList) + ']') 52 assert False 53 54 def teardown(self): 55 Step("Teardown")