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/test.gni") 15import("../../../base/config.gni") 16 17module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" 18config("module_private_config") { 19 visibility = [ ":*" ] 20 if (current_toolchain != host_toolchain) { 21 defines = [ "HAVE_HILOG" ] 22 } 23} 24 25ohos_unittest("memdataplugin_ut") { 26 module_out_path = module_output_path 27 sources = [ 28 "unittest/buffer_splitter_unittest.cpp", 29 "unittest/memory_data_plugin_unittest.cpp", 30 "unittest/smaps_stats_unittest.cpp", 31 ] 32 deps = [ 33 "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memdataplugin_source", 34 "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memorytest", 35 "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp", 36 "//third_party/bounds_checking_function:libsec_static", 37 "//third_party/googletest:gtest_main", 38 ] 39 include_dirs = [ 40 "../include", 41 "../../api/include", 42 "${OHOS_PROFILER_DIR}/interfaces/kits", 43 "${OHOS_PROFILER_DIR}/device/base/include", 44 "//third_party/googletest/googletest/include/gtest", 45 "//third_party/bounds_checking_function/include", 46 ] 47 cflags = [ 48 "-Wno-inconsistent-missing-override", 49 "-Dprivate=public", #allow test code access private members 50 ] 51 external_deps = [ "hilog:libhilog" ] 52 configs = [ ":module_private_config" ] 53 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 54 part_name = "${OHOS_PROFILER_PART_NAME}" 55 resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml" 56} 57 58ohos_unittest("smaps_stats_ut") { 59 module_out_path = module_output_path 60 sources = [ "unittest/smaps_stats_unittest.cpp" ] 61 deps = [ 62 "${OHOS_PROFILER_DIR}/device/plugins/memory_plugin:memdataplugin_source", 63 "${OHOS_PROFILER_DIR}/protos/types/plugins/memory_data:memory_data_cpp", 64 "//third_party/bounds_checking_function:libsec_static", 65 "//third_party/googletest:gtest_main", 66 ] 67 include_dirs = [ 68 "../include", 69 "../../api/include", 70 "${OHOS_PROFILER_DIR}/interfaces/kits", 71 "${OHOS_PROFILER_DIR}/device/base/include", 72 "//third_party/googletest/googletest/include/gtest", 73 "//third_party/bounds_checking_function/include", 74 ] 75 cflags = [ 76 "-Wno-inconsistent-missing-override", 77 "-Dprivate=public", #allow test code access private members 78 ] 79 external_deps = [ "hilog:libhilog" ] 80 configs = [ ":module_private_config" ] 81 subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" 82 resource_config_file = "${OHOS_PROFILER_DIR}/device/ohos_test.xml" 83} 84 85group("unittest") { 86 testonly = true 87 deps = [ 88 ":memdataplugin_ut", 89 ":smaps_stats_ut", 90 ] 91} 92