# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//build/test.gni") import("../../../base/config.gni") module_output_path = "${OHOS_PROFILER_TEST_MODULE_OUTPUT_PATH}/device" config("module_private_config") { visibility = [ ":*" ] defines = [ "is_ohos=1", "HAVE_LIBUNWIND=1", "HIPERF_DEBUG", "CONFIG_NO_HILOG", "target_cpu_${target_cpu}", ] if (current_toolchain != host_toolchain) { defines += [ "HAVE_HILOG" ] } } ohos_unittest("nativehook_ut") { module_out_path = module_output_path sources = [ "../../memory_plugin/src/buffer_splitter.cpp", "unittest/check_hook_data_test.cpp", "unittest/hook_client_test.cpp", "unittest/hook_socket_client_test.cpp", "unittest/stack_writer_test.cpp", ] public_deps = [ "${OHOS_PROFILER_DIR}/device/services/shared_memory:shared_memory_source", "${OHOS_PROFILER_DIR}/protos/services:profiler_service_all_type_source", ] deps = [ "${OHOS_PROFILER_DIR}/device/plugins/native_daemon:native_daemon", "${OHOS_PROFILER_DIR}/device/plugins/native_hook:native_hook_source", "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp", "${OHOS_PROFILER_DIR}/protos/types/plugins/native_hook:native_hook_cpp_standard", "//third_party/bounds_checking_function:libsec_static", "//third_party/googletest:gtest_main", ] include_dirs = [ "../include", "../../native_daemon/include", "../../api/include", "../../api/src", "../../memory_plugin/include", "../../../base/include/", "${OHOS_PROFILER_DIR}/interfaces/kits", "${OHOS_PROFILER_DIR}/device/services/ipc/include", "${OHOS_PROFILER_DIR}/device/services/shared_memory/include", "${OHOS_PROFILER_DIR}/device/services/profiler_service/include", "//third_party/googletest/googletest/include/gtest", "//third_party/musl/include/musl_preinit_common.h", "//third_party/bounds_checking_function/include", ] cflags = [ "-Wno-inconsistent-missing-override", "-Dprivate=public", #allow test code access private members "-Dprotected=public", #allow test code access private members ] external_deps = [ "hilog:libhilog" ] configs = [ ":module_private_config" ] subsystem_name = "${OHOS_PROFILER_SUBSYS_NAME}" part_name = "${OHOS_PROFILER_PART_NAME}" } group("unittest") { testonly = true deps = [ ":nativehook_ut" ] }