13fc297bdSopenharmony_ci# Copyright (c) 2022-2023 Huawei Device Co., Ltd.
23fc297bdSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
33fc297bdSopenharmony_ci# you may not use this file except in compliance with the License.
43fc297bdSopenharmony_ci# You may obtain a copy of the License at
53fc297bdSopenharmony_ci#
63fc297bdSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
73fc297bdSopenharmony_ci#
83fc297bdSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
93fc297bdSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
103fc297bdSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113fc297bdSopenharmony_ci# See the License for the specific language governing permissions and
123fc297bdSopenharmony_ci# limitations under the License.
133fc297bdSopenharmony_ci
143fc297bdSopenharmony_ciimport("//build/test.gni")
153fc297bdSopenharmony_ciimport("../../soc_perf.gni")
163fc297bdSopenharmony_ci
173fc297bdSopenharmony_cimodule_output_path = "soc_perf/socperftest"
183fc297bdSopenharmony_ci
193fc297bdSopenharmony_ciconfig("module_private_config") {
203fc297bdSopenharmony_ci  visibility = [ ":*" ]
213fc297bdSopenharmony_ci
223fc297bdSopenharmony_ci  include_dirs = [
233fc297bdSopenharmony_ci    "${socperf_common}/include",
243fc297bdSopenharmony_ci    "${socperf_interfaces}/inner_api/socperf_client/include",
253fc297bdSopenharmony_ci    "${socperf_services}/core/include",
263fc297bdSopenharmony_ci    "${socperf_services}/server/include",
273fc297bdSopenharmony_ci  ]
283fc297bdSopenharmony_ci}
293fc297bdSopenharmony_ci
303fc297bdSopenharmony_ciohos_unittest("SocPerfServerTest") {
313fc297bdSopenharmony_ci  module_out_path = module_output_path
323fc297bdSopenharmony_ci
333fc297bdSopenharmony_ci  sources = [
343fc297bdSopenharmony_ci    "mock/mock_accesstoken_kit.cpp",
353fc297bdSopenharmony_ci    "mock/mock_system_ability.cpp",
363fc297bdSopenharmony_ci    "socperf_server_test.cpp",
373fc297bdSopenharmony_ci  ]
383fc297bdSopenharmony_ci
393fc297bdSopenharmony_ci  configs = [ ":module_private_config" ]
403fc297bdSopenharmony_ci
413fc297bdSopenharmony_ci  deps = [
423fc297bdSopenharmony_ci    "${socperf_services}:socperf_server_static",
433fc297bdSopenharmony_ci    "//third_party/googletest:gtest_main",
443fc297bdSopenharmony_ci    "//third_party/libxml2:libxml2",
453fc297bdSopenharmony_ci  ]
463fc297bdSopenharmony_ci
473fc297bdSopenharmony_ci  external_deps = [
483fc297bdSopenharmony_ci    "access_token:libaccesstoken_sdk",
493fc297bdSopenharmony_ci    "access_token:libtokenid_sdk",
503fc297bdSopenharmony_ci    "c_utils:utils",
513fc297bdSopenharmony_ci    "eventhandler:libeventhandler",
523fc297bdSopenharmony_ci    "ffrt:libffrt",
533fc297bdSopenharmony_ci    "hilog:libhilog",
543fc297bdSopenharmony_ci    "ipc:ipc_single",
553fc297bdSopenharmony_ci    "safwk:system_ability_fwk",
563fc297bdSopenharmony_ci    "samgr:samgr_proxy",
573fc297bdSopenharmony_ci  ]
583fc297bdSopenharmony_ci
593fc297bdSopenharmony_ci  sanitize = {
603fc297bdSopenharmony_ci    cfi = true
613fc297bdSopenharmony_ci    cfi_cross_dso = true
623fc297bdSopenharmony_ci    debug = false
633fc297bdSopenharmony_ci  }
643fc297bdSopenharmony_ci  branch_protector_ret = "pac_ret"
653fc297bdSopenharmony_ci}
663fc297bdSopenharmony_ci
673fc297bdSopenharmony_ciohos_unittest("SocPerfSubTest") {
683fc297bdSopenharmony_ci  module_out_path = module_output_path
693fc297bdSopenharmony_ci
703fc297bdSopenharmony_ci  sources = [ "socperf_sub_test.cpp" ]
713fc297bdSopenharmony_ci
723fc297bdSopenharmony_ci  configs = [ ":module_private_config" ]
733fc297bdSopenharmony_ci
743fc297bdSopenharmony_ci  deps = [
753fc297bdSopenharmony_ci    "${socperf_interfaces}/inner_api/socperf_client:socperf_client",
763fc297bdSopenharmony_ci    "//third_party/googletest:gtest_main",
773fc297bdSopenharmony_ci    "//third_party/libxml2:libxml2",
783fc297bdSopenharmony_ci  ]
793fc297bdSopenharmony_ci
803fc297bdSopenharmony_ci  external_deps = [
813fc297bdSopenharmony_ci    "c_utils:utils",
823fc297bdSopenharmony_ci    "eventhandler:libeventhandler",
833fc297bdSopenharmony_ci    "ffrt:libffrt",
843fc297bdSopenharmony_ci    "hilog:libhilog",
853fc297bdSopenharmony_ci    "ipc:ipc_single",
863fc297bdSopenharmony_ci    "safwk:system_ability_fwk",
873fc297bdSopenharmony_ci    "samgr:samgr_proxy",
883fc297bdSopenharmony_ci  ]
893fc297bdSopenharmony_ci}
903fc297bdSopenharmony_ci
913fc297bdSopenharmony_ciohos_unittest("SocPerfSubMockTest") {
923fc297bdSopenharmony_ci  module_out_path = module_output_path
933fc297bdSopenharmony_ci
943fc297bdSopenharmony_ci  sources = [
953fc297bdSopenharmony_ci    "mock/mock_socperf_client.cpp",
963fc297bdSopenharmony_ci    "socperf_sub_mock_test.cpp",
973fc297bdSopenharmony_ci  ]
983fc297bdSopenharmony_ci
993fc297bdSopenharmony_ci  configs = [ ":module_private_config" ]
1003fc297bdSopenharmony_ci
1013fc297bdSopenharmony_ci  deps = [
1023fc297bdSopenharmony_ci    "${socperf_interfaces}/inner_api/socperf_client:socperf_client",
1033fc297bdSopenharmony_ci    "//third_party/googletest:gtest_main",
1043fc297bdSopenharmony_ci    "//third_party/libxml2:libxml2",
1053fc297bdSopenharmony_ci  ]
1063fc297bdSopenharmony_ci
1073fc297bdSopenharmony_ci  external_deps = [
1083fc297bdSopenharmony_ci    "c_utils:utils",
1093fc297bdSopenharmony_ci    "eventhandler:libeventhandler",
1103fc297bdSopenharmony_ci    "ffrt:libffrt",
1113fc297bdSopenharmony_ci    "hilog:libhilog",
1123fc297bdSopenharmony_ci    "ipc:ipc_single",
1133fc297bdSopenharmony_ci    "safwk:system_ability_fwk",
1143fc297bdSopenharmony_ci    "samgr:samgr_proxy",
1153fc297bdSopenharmony_ci  ]
1163fc297bdSopenharmony_ci}
1173fc297bdSopenharmony_ci
1183fc297bdSopenharmony_cigroup("unittest") {
1193fc297bdSopenharmony_ci  testonly = true
1203fc297bdSopenharmony_ci  deps = [
1213fc297bdSopenharmony_ci    ":SocPerfServerTest",
1223fc297bdSopenharmony_ci    ":SocPerfSubMockTest",
1233fc297bdSopenharmony_ci    ":SocPerfSubTest",
1243fc297bdSopenharmony_ci  ]
1253fc297bdSopenharmony_ci}
126