1# Copyright (c) 2021 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/config/python.gni") 15import("//build/ohos/build_var.gni") 16import("//build/ohos_var.gni") 17 18# Defines ohos_subsystem_test 19# 20# example: 21# ohos_subsystem_test("examples_test") { 22# testonly = true 23# test_packages = [ 24# "calculator/test:unittest", 25# "detector/test:unittest", 26# "summator/test:unittest", 27# ] 28# } 29template("_ohos_part_test") { 30 assert(defined(invoker.part_name), "part_name is required.") 31 assert(defined(invoker.test_packages), "test_packages is required.") 32 33 part_name = invoker.part_name 34 subsystem_name = invoker.subsystem_name 35 assert(subsystem_name != "") 36 assert(part_name != "") 37 38 _deps = [] 39 if (defined(invoker.deps)) { 40 _deps += invoker.deps 41 } 42 43 group(target_name) { 44 if (defined(invoker.testonly)) { 45 testonly = invoker.testonly 46 } 47 deps = _deps 48 deps += invoker.test_packages 49 } 50} 51 52template("ohos_part_test") { 53 _ohos_part_test(target_name) { 54 testonly = invoker.testonly 55 deps = invoker.deps 56 part_name = invoker.part_name 57 subsystem_name = invoker.subsystem_name 58 test_packages = invoker.test_packages 59 } 60} 61