1# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 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. 13import("//build/test.gni") 14import("../../../base/config.gni") 15 16module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" 17 18config("module_private_config") { 19 visibility = [ ":*" ] 20 defines = [ 21 "is_ohos=1", 22 "CONFIG_NO_HILOG", 23 "target_cpu_${target_cpu}", 24 ] 25 26 if (current_toolchain != host_toolchain) { 27 defines += [ "HAVE_HILOG" ] 28 } 29} 30 31ohos_unittest("xpowerplugin_ut") { 32 module_out_path = module_output_path 33 sources = [ 34 "../src/power_message_queue.cpp", 35 "../src/xpower_module.cpp", 36 "../src/xpower_plugin.cpp", 37 "unittest/xpower_plugin_unittest.cpp", 38 ] 39 deps = [ 40 "${OHOS_PROFILER_DIR}/protos/types/plugins/xpower_data:xpower_data_cpp", 41 "../../../base:hiprofiler_base", 42 ] 43 44 include_dirs = [ 45 "../include", 46 "../../api/include", 47 "${OHOS_PROFILER_DIR}/interfaces/kits", 48 "${OHOS_PROFILER_DIR}/device/base/include", 49 ] 50 51 cflags = [ 52 "-Wno-inconsistent-missing-override", 53 "-Dprivate=public", #allow test code access private members 54 "-Dprotected=public", #allow test code access private members 55 ] 56 external_deps = [ 57 "bounds_checking_function:libsec_shared", 58 "googletest:gtest", 59 "hilog:libhilog_base", 60 "protobuf:protobuf", 61 "protobuf:protobuf_lite", 62 ] 63 configs = [ ":module_private_config" ] 64 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 65 part_name = "${OHOS_PROFILER_PART_NAME}" 66} 67group("unittest") { 68 testonly = true 69 deps = [ ":xpowerplugin_ut" ] 70} 71