1# Copyright (c) 2022-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_dumpcatcher") { 22 output_extension = "bin" 23 24 output_dir = "$root_out_dir/test/unittest/faultloggerd" 25 26 sources = [ "dumpcatcher_interfaces_test.cpp" ] 27 28 include_dirs = [ 29 "include/", 30 "$faultloggerd_interfaces_path/common", 31 "$faultloggerd_path/interfaces/innerkits/backtrace/include", 32 "$faultloggerd_path/interfaces/innerkits/dump_catcher/include", 33 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 34 "$faultloggerd_path/interfaces/innerkits/formatter/include", 35 "$faultloggerd_path/test/utils", 36 "$faultloggerd_path/tools/process_dump", 37 "$faultloggerd_path/utils", 38 "$hilog_lite_include_path", 39 ] 40 41 deps = [ 42 "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher", 43 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 44 "$faultloggerd_path/test/utils:dfx_test_util", 45 ] 46 47 external_deps = [ "hilog_lite:hilog_shared" ] 48 } 49 } 50 51 group("unittest") { 52 deps = [ ":test_dumpcatcher" ] 53 } 54} else { 55 import("//build/config/features.gni") 56 import("//build/test.gni") 57 58 module_output_path = "faultloggerd/dump_catcher" 59 60 ohos_unittest("test_dumpcatcher") { 61 module_out_path = module_output_path 62 63 visibility = [ "*:*" ] 64 65 include_dirs = [ 66 "$faultloggerd_interfaces_path/common", 67 "$faultloggerd_path/interfaces/innerkits/backtrace/include", 68 "$faultloggerd_path/interfaces/innerkits/dump_catcher/include", 69 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 70 "$faultloggerd_path/interfaces/innerkits/formatter/include", 71 "$faultloggerd_path/test/utils", 72 ] 73 74 sources = [ 75 "dumpcatcher_command_test.cpp", 76 "dumpcatcher_interfaces_test.cpp", 77 ] 78 cflags_cc = [ "-Dprivate=public" ] 79 80 deps = [ 81 "$faultloggerd_interfaces_path/innerkits/backtrace:libbacktrace_local", 82 "$faultloggerd_interfaces_path/innerkits/formatter:libjson_stack_formatter", 83 "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher", 84 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 85 "$faultloggerd_path/interfaces/innerkits/procinfo:libdfx_procinfo", 86 "$faultloggerd_path/test/utils:dfx_test_util", 87 ] 88 if (support_jsapi) { 89 deps += [ "$faultloggerd_path/test/resource:FaultloggerdJsTest" ] 90 } 91 resource_config_file = "$faultloggerd_path/test/resource/ohos_test.xml" 92 external_deps = [ 93 "c_utils:utils", 94 "googletest:gtest_main", 95 "hilog:libhilog", 96 "jsoncpp:jsoncpp", 97 ] 98 } 99 100 group("unittest") { 101 testonly = true 102 deps = [ ":test_dumpcatcher" ] 103 } 104} 105