1# Copyright (c) 2021-2022 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/test.gni") 15import("//foundation/ability/ability_runtime/ability_runtime.gni") 16 17module_output_path = "ability_tools/tools" 18 19config("tools_aa_config_mock") { 20 include_dirs = [ 21 "${ability_runtime_path}/tools/test/mock", 22 "//third_party/googletest/googlemock/include", 23 ] 24} 25 26tools_aa_mock_sources = 27 [ "${ability_runtime_path}/tools/test/mock/mock_ability_manager_stub.cpp" ] 28 29ohos_moduletest("aa_command_dumpsys_module_test") { 30 module_out_path = module_output_path 31 32 sources = [ "aa_command_dumpsys_module_test.cpp" ] 33 sources += tools_aa_mock_sources 34 35 configs = [ ":tools_aa_config_mock" ] 36 37 cflags = [] 38 if (target_cpu == "arm") { 39 cflags += [ "-DBINDER_IPC_32BIT" ] 40 } 41 42 deps = [ 43 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 44 "${ability_runtime_services_path}/abilitymgr:abilityms", 45 "//third_party/googletest:gmock_main", 46 "//third_party/googletest:gtest_main", 47 ] 48 49 external_deps = [ 50 "ability_base:configuration", 51 "bundle_framework:appexecfwk_base", 52 "c_utils:utils", 53 "hilog:libhilog", 54 "ipc:ipc_core", 55 ] 56} 57 58ohos_moduletest("aa_command_start_module_test") { 59 module_out_path = module_output_path 60 61 sources = [ "aa_command_start_module_test.cpp" ] 62 sources += tools_aa_mock_sources 63 64 configs = [ ":tools_aa_config_mock" ] 65 66 cflags = [] 67 if (target_cpu == "arm") { 68 cflags += [ "-DBINDER_IPC_32BIT" ] 69 } 70 71 deps = [ 72 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 73 "${ability_runtime_services_path}/abilitymgr:abilityms", 74 "//third_party/googletest:gmock_main", 75 "//third_party/googletest:gtest_main", 76 ] 77 78 external_deps = [ 79 "ability_base:configuration", 80 "bundle_framework:appexecfwk_base", 81 "hilog:libhilog", 82 "ipc:ipc_core", 83 ] 84} 85 86ohos_moduletest("aa_command_stop_service_module_test") { 87 module_out_path = module_output_path 88 89 sources = [ "aa_command_stop_service_module_test.cpp" ] 90 sources += tools_aa_mock_sources 91 92 configs = [ ":tools_aa_config_mock" ] 93 94 cflags = [] 95 if (target_cpu == "arm") { 96 cflags += [ "-DBINDER_IPC_32BIT" ] 97 } 98 99 deps = [ 100 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 101 "${ability_runtime_services_path}/abilitymgr:abilityms", 102 "//third_party/googletest:gmock_main", 103 "//third_party/googletest:gtest_main", 104 ] 105 106 external_deps = [ 107 "ability_base:configuration", 108 "bundle_framework:appexecfwk_base", 109 "hilog:libhilog", 110 "ipc:ipc_core", 111 ] 112} 113 114ohos_moduletest("aa_command_dump_module_test") { 115 module_out_path = module_output_path 116 117 sources = [ "aa_command_dump_module_test.cpp" ] 118 sources += tools_aa_mock_sources 119 120 configs = [ ":tools_aa_config_mock" ] 121 122 cflags = [] 123 if (target_cpu == "arm") { 124 cflags += [ "-DBINDER_IPC_32BIT" ] 125 } 126 127 deps = [ 128 "${ability_runtime_path}/tools/aa:tools_aa_source_set", 129 "${ability_runtime_services_path}/abilitymgr:abilityms", 130 "//third_party/googletest:gmock_main", 131 "//third_party/googletest:gtest_main", 132 ] 133 134 external_deps = [ 135 "ability_base:configuration", 136 "bundle_framework:appexecfwk_base", 137 "hilog:libhilog", 138 "ipc:ipc_core", 139 ] 140} 141 142group("moduletest") { 143 testonly = true 144 145 deps = [ 146 ":aa_command_dump_module_test", 147 ":aa_command_dumpsys_module_test", 148 ":aa_command_start_module_test", 149 ":aa_command_stop_service_module_test", 150 ] 151} 152