1# Copyright (c) 2021-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/lite/config/component/lite_component.gni")
18  import("//build/lite/config/test.gni")
19
20  if (ohos_build_type == "debug") {
21    unittest("test_faultloggerd") {
22      output_extension = "bin"
23      output_dir = "$root_out_dir/test/unittest/faultloggerd"
24      sources = [
25        "dumpcatcher_system_test.cpp",
26        "faultloggerd_system_test.cpp",
27      ]
28      sources += [ "$c_utils_src_path/directory_ex.cpp" ]
29
30      include_dirs = [
31        "$c_utils_include_path",
32        "$faultloggerd_common_path/dfxutil",
33        "$faultloggerd_interfaces_path/innerkits/backtrace/include",
34        "$faultloggerd_path/interfaces/common",
35        "$faultloggerd_path/interfaces/innerkits/dump_catcher/include",
36        "$faultloggerd_path/interfaces/innerkits/procinfo/include",
37        "$faultloggerd_path/test/utils",
38        "$hilog_lite_include_path",
39      ]
40
41      deps = [
42        "$faultloggerd_common_path/dfxutil:dfx_util",
43        "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher",
44        "$faultloggerd_path/interfaces/innerkits/procinfo:libdfx_procinfo",
45        "$faultloggerd_path/test/utils:dfx_test_util",
46      ]
47
48      external_deps = [ "hilog_lite:hilog_shared" ]
49    }
50  }
51
52  group("systemtest") {
53    deps = [ ":test_faultloggerd" ]
54  }
55} else {
56  import("//build/config/features.gni")
57  import("//build/test.gni")
58
59  config("module_private_config") {
60    visibility = [ ":*" ]
61
62    include_dirs = [
63      "$faultloggerd_path/interfaces/innerkits/dump_catcher/include/",
64      "$faultloggerd_path/test/utils",
65    ]
66
67    cflags_cc = [ "-fno-exceptions" ]
68
69    if (processdump_minidebuginfo_enable) {
70      defines = [ "PROCESSDUMP_MINIDEBUGINFO" ]
71    }
72  }
73
74  module_output_path = "faultloggerd/faultloggerd_native"
75
76  ohos_systemtest("test_faultloggerd") {
77    module_out_path = module_output_path
78    sources = [
79      "dumpcatcher_system_test.cpp",
80      "faultloggerd_system_test.cpp",
81    ]
82
83    configs = [
84      ":module_private_config",
85      "$faultloggerd_path/common/build:coverage_flags",
86    ]
87
88    deps = [
89      "$faultloggerd_path/common/dfxutil:dfx_util",
90      "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher",
91      "$faultloggerd_path/interfaces/innerkits/procinfo:libdfx_procinfo",
92      "$faultloggerd_path/test/utils:dfx_test_util",
93      "$faultloggerd_path/tools/crasher_c:crasher_c",
94      "$faultloggerd_path/tools/crasher_cpp:crasher_cpp",
95    ]
96    if (support_jsapi) {
97      deps += [ "$faultloggerd_path/test/resource:FaultloggerdJsTest" ]
98    }
99    resource_config_file = "$faultloggerd_path/test/resource/ohos_test.xml"
100
101    external_deps = [
102      "c_utils:utils",
103      "googletest:gtest_main",
104    ]
105  }
106
107  group("systemtest") {
108    testonly = true
109    deps = [ ":test_faultloggerd" ]
110  }
111}
112