1# Copyright (c) 2021-2024 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_service") { 22 output_extension = "bin" 23 output_dir = "$root_out_dir/test/unittest/faultloggerd" 24 25 include_dirs = [ 26 "$c_utils_include_path", 27 "$faultloggerd_path/services", 28 "$hilog_lite_include_path", 29 "$faultloggerd_path/tools/process_dump", 30 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 31 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client", 32 "$faultloggerd_interfaces_path/common", 33 "$faultloggerd_path/common/cutil", 34 "$faultloggerd_path/common/dfxlog", 35 "$faultloggerd_path/common/dfxutil", 36 ] 37 38 sources = [ 39 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_client.cpp", 40 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.cpp", 41 "$faultloggerd_path/common/cutil/dfx_cutil.c", 42 "$faultloggerd_path/services/fault_logger_config.cpp", 43 "$faultloggerd_path/services/fault_logger_daemon.cpp", 44 "$faultloggerd_path/services/fault_logger_pipe.cpp", 45 "faultlogger_config_test.cpp", 46 "faultlogger_daemon_test.cpp", 47 "faultlogger_pipe_test.cpp", 48 ] 49 sources += [ "$c_utils_src_path/directory_ex.cpp" ] 50 51 deps = [ 52 "$faultloggerd_common_path/trace:dfx_trace", 53 "$faultloggerd_path/common/dfxlog:dfx_hilog", 54 "$faultloggerd_path/common/dfxutil:dfx_util", 55 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 56 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 57 ] 58 59 external_deps = [ 60 "hilog_lite:hilog_shared", 61 "init:libbegetutil", 62 ] 63 64 if (faultloggerd_hisysevent_enable) { 65 deps += [ "hisysevent:libhisysevent" ] 66 } else { 67 defines = [ "HISYSEVENT_DISABLE" ] 68 } 69 } 70 } 71 72 group("unittest") { 73 deps = [ ":test_service" ] 74 } 75} else { 76 import("//build/config/features.gni") 77 import("//build/test.gni") 78 79 config("module_private_config") { 80 visibility = [ ":*" ] 81 82 include_dirs = [ 83 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.h", 84 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/", 85 "$faultloggerd_path/services", 86 "$faultloggerd_path/common/cutil", 87 "$faultloggerd_path/common/dfxlog", 88 "$faultloggerd_path/common/dfxutil", 89 ] 90 } 91 92 ohos_unittest("test_service") { 93 module_out_path = "faultloggerd/services" 94 95 include_dirs = [ 96 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/include", 97 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.h", 98 ] 99 100 sources = [ 101 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_client.cpp", 102 "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.cpp", 103 "$faultloggerd_path/common/cutil/dfx_cutil.c", 104 "$faultloggerd_path/services/fault_logger_config.cpp", 105 "$faultloggerd_path/services/fault_logger_daemon.cpp", 106 "$faultloggerd_path/services/fault_logger_pipe.cpp", 107 "faultlogger_config_test.cpp", 108 "faultlogger_daemon_test.cpp", 109 "faultlogger_pipe_test.cpp", 110 ] 111 112 configs = [ 113 ":module_private_config", 114 "$faultloggerd_path/common/build:coverage_flags", 115 ] 116 117 deps = [ 118 "$faultloggerd_common_path/trace:dfx_trace", 119 "$faultloggerd_path/common/dfxutil:dfx_util", 120 "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 121 ] 122 123 external_deps = [ 124 "c_utils:utils", 125 "googletest:gmock_main", 126 "googletest:gtest_main", 127 "hilog:libhilog", 128 "hisysevent:libhisysevent", 129 "init:libbegetutil", 130 ] 131 } 132 133 group("unittest") { 134 testonly = true 135 deps = [ ":test_service" ] 136 } 137} 138