1# Copyright (c) 2023 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("//base/hiviewdfx/faultloggerd/faultloggerd.gni")
15
16if (!defined(ohos_lite)) {
17  import("//build/config/features.gni")
18  import("//build/test.gni")
19
20  module_output_path = "faultloggerd/benchmarktest"
21
22  ohos_benchmarktest("UnwindBenchmarkTest") {
23    module_out_path = module_output_path
24    include_dirs = [
25      "./",
26      "$faultloggerd_interfaces_path/common",
27      "$faultloggerd_interfaces_path/innerkits/unwinder/include",
28      "$faultloggerd_path/test/utils",
29    ]
30    cflags = [
31      "-O0",
32      "-Werror",
33      "-Wno-reorder-init-list",
34      "-Wno-header-hygiene",
35    ]
36    defines = [
37      "HAVE_CONFIG_H",
38      "HAVE_ELF_H",
39      "HAVE_LINK_H",
40      "LOCK_TO_CPU",
41    ]
42    if (libunwinder_debug) {
43      defines += [ "DFX_LOG_UNWIND" ]
44    }
45    sources = [
46      "$faultloggerd_test_path/benchmarktest/main/main_benchmark.cpp",
47      "unwind_local_benchmark.cpp",
48      "unwind_remote_benchmark.cpp",
49    ]
50    sources +=
51        [ "$faultloggerd_interfaces_path/innerkits/unwinder/dfx_ptrace.cpp" ]
52    deps = [
53      "$faultloggerd_common_path/dfxlog:dfx_hilog",
54      "$faultloggerd_common_path/dfxutil:dfx_util",
55      "$faultloggerd_path/test/utils:dfx_test_util",
56    ]
57
58    external_deps = [
59      "benchmark:benchmark",
60      "bounds_checking_function:libsec_shared",
61      "c_utils:utils",
62      "hilog:libhilog",
63      "libunwind:libunwind",
64    ]
65  }
66
67  group("benchmarktest") {
68    testonly = true
69    deps = [ ":UnwindBenchmarkTest" ]
70  }
71}
72