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/faultloggerd_client", 37 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 38 "$faultloggerd_path/interfaces/innerkits/procinfo/include", 39 "$faultloggerd_path/test/utils", 40 "$hilog_lite_include_path", 41 ] 42 43 deps = [ 44 "$faultloggerd_common_path/dfxutil:dfx_util", 45 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client:libfaultloggerd", 46 "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher", 47 "$faultloggerd_path/interfaces/innerkits/procinfo:libdfx_procinfo", 48 "$faultloggerd_path/test/utils:dfx_test_util", 49 ] 50 51 external_deps = [ "hilog_lite:hilog_shared" ] 52 } 53 } 54 55 group("systemtest") { 56 if (ohos_build_type == "debug") { 57 deps = [ ":test_faultloggerd" ] 58 } 59 } 60} else { 61 import("//build/config/features.gni") 62 import("//build/test.gni") 63 64 config("module_private_config") { 65 visibility = [ ":*" ] 66 67 include_dirs = [ 68 "$faultloggerd_path/interfaces/innerkits/dump_catcher/include/", 69 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client", 70 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 71 "$faultloggerd_path/test/utils", 72 ] 73 74 cflags_cc = [ "-fno-exceptions" ] 75 76 if (processdump_minidebuginfo_enable) { 77 defines = [ "PROCESSDUMP_MINIDEBUGINFO" ] 78 } 79 } 80 81 ohos_systemtest("test_faultloggerd") { 82 module_out_path = "faultloggerd/faultloggerd/native" 83 sources = [ 84 "dumpcatcher_system_test.cpp", 85 "faultloggerd_system_test.cpp", 86 ] 87 88 configs = [ 89 ":module_private_config", 90 "$faultloggerd_path/common/build:coverage_flags", 91 ] 92 93 deps = [ 94 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client:libfaultloggerd", 95 "$faultloggerd_path/common/dfxutil:dfx_util", 96 "$faultloggerd_path/interfaces/innerkits/dump_catcher:libdfx_dumpcatcher", 97 "$faultloggerd_path/interfaces/innerkits/procinfo:libdfx_procinfo", 98 "$faultloggerd_path/test/utils:dfx_test_util", 99 "$faultloggerd_path/tools/crasher_c:crasher_c", 100 "$faultloggerd_path/tools/crasher_cpp:crasher_cpp", 101 ] 102 if (support_jsapi) { 103 deps += [ "$faultloggerd_path/test/resource:FaultloggerdJsTest" ] 104 } 105 resource_config_file = "$faultloggerd_path/test/resource/ohos_test.xml" 106 107 external_deps = [ 108 "c_utils:utils", 109 "googletest:gtest_main", 110 ] 111 } 112 113 group("systemtest") { 114 testonly = true 115 deps = [ ":test_faultloggerd" ] 116 } 117} 118