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_processdump") { 22 output_extension = "bin" 23 output_dir = "$root_out_dir/test/unittest/faultloggerd" 24 25 include_dirs = [ 26 "$c_utils_include_path", 27 "$faultloggerd_common_path/dfxutil", 28 "$faultloggerd_interfaces_path/common", 29 "$faultloggerd_interfaces_path/innerkits/procinfo/include", 30 "$faultloggerd_interfaces_path/innerkits/unwinder/include", 31 "$faultloggerd_path/test/utils", 32 "$faultloggerd_path/tools/process_dump", 33 "//third_party/googletest/googlemock/include", 34 "$hilog_lite_include_path", 35 ] 36 37 sources = [ 38 "dfx_processdump_test.cpp", 39 "multithread_constructor.c", 40 "process_dump_test.cpp", 41 ] 42 sources += [ "$c_utils_src_path/directory_ex.cpp" ] 43 44 deps = [ 45 "$faultloggerd_interfaces_path/innerkits/procinfo:libdfx_procinfo", 46 "$faultloggerd_interfaces_path/innerkits/unwinder:libunwinder", 47 "$faultloggerd_path/test/utils:dfx_test_util", 48 "$faultloggerd_path/tools/process_dump:process_info_src", 49 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 50 ] 51 } 52 } 53 54 group("unittest") { 55 deps = [ ":test_processdump" ] 56 } 57} else { 58 import("//build/config/features.gni") 59 import("//build/test.gni") 60 61 config("module_private_config") { 62 visibility = [ ":*" ] 63 64 include_dirs = [ 65 "$faultloggerd_common_path/dfxutil", 66 "$faultloggerd_interfaces_path/common", 67 "$faultloggerd_interfaces_path/innerkits/unwinder/include", 68 "$faultloggerd_path/test/utils", 69 "$faultloggerd_path/tools/process_dump", 70 ] 71 } 72 73 module_output_path = "faultloggerd/process_dump" 74 75 ohos_unittest("test_processdump") { 76 module_out_path = module_output_path 77 sources = [ 78 "dfx_processdump_test.cpp", 79 "multithread_constructor.c", 80 "process_dump_test.cpp", 81 ] 82 83 configs = [ 84 ":module_private_config", 85 "$faultloggerd_path/common/build:coverage_flags", 86 "//third_party/jsoncpp:jsoncpp_public_config", 87 ] 88 89 defines = [ "UNITTEST" ] 90 91 deps = [ 92 "$faultloggerd_path/interfaces/innerkits/unwinder:libunwinder_static", 93 "$faultloggerd_path/test/utils:dfx_test_util", 94 "$faultloggerd_path/tools/process_dump:process_info_src", 95 "//third_party/googletest:gmock_main", 96 "//third_party/googletest:gtest_main", 97 "//third_party/jsoncpp:jsoncpp", 98 ] 99 external_deps = [ "c_utils:utils" ] 100 if (support_jsapi) { 101 deps += [ "$faultloggerd_path/test/resource:FaultloggerdJsTest" ] 102 } 103 resource_config_file = "$faultloggerd_path/test/resource/ohos_test.xml" 104 } 105 106 ohos_unittest("test_faultstack") { 107 module_out_path = module_output_path 108 sources = [ "fault_stack_test.cpp" ] 109 110 configs = [ 111 ":module_private_config", 112 "$faultloggerd_path/common/build:coverage_flags", 113 "//third_party/jsoncpp:jsoncpp_public_config", 114 ] 115 116 defines = [ "UNITTEST" ] 117 118 deps = [ 119 "$faultloggerd_path/interfaces/innerkits/unwinder:libunwinder_static", 120 "$faultloggerd_path/tools/process_dump:process_info_src", 121 "//third_party/googletest:gmock_main", 122 "//third_party/googletest:gtest_main", 123 "//third_party/jsoncpp:jsoncpp", 124 ] 125 126 external_deps = [ "c_utils:utils" ] 127 } 128 129 group("unittest") { 130 testonly = true 131 deps = [ 132 ":test_faultstack", 133 ":test_processdump", 134 ] 135 } 136} 137