1800b99b8Sopenharmony_ci# Copyright (c) 2021-2024 Huawei Device Co., Ltd. 2800b99b8Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3800b99b8Sopenharmony_ci# you may not use this file except in compliance with the License. 4800b99b8Sopenharmony_ci# You may obtain a copy of the License at 5800b99b8Sopenharmony_ci# 6800b99b8Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7800b99b8Sopenharmony_ci# 8800b99b8Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9800b99b8Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10800b99b8Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11800b99b8Sopenharmony_ci# See the License for the specific language governing permissions and 12800b99b8Sopenharmony_ci# limitations under the License. 13800b99b8Sopenharmony_ci 14800b99b8Sopenharmony_ciimport("//base/hiviewdfx/faultloggerd/faultloggerd.gni") 15800b99b8Sopenharmony_ci 16800b99b8Sopenharmony_ciif (defined(ohos_lite)) { 17800b99b8Sopenharmony_ci import("//build/lite/config/component/lite_component.gni") 18800b99b8Sopenharmony_ci import("//build/lite/config/test.gni") 19800b99b8Sopenharmony_ci 20800b99b8Sopenharmony_ci if (ohos_build_type == "debug") { 21800b99b8Sopenharmony_ci unittest("test_service") { 22800b99b8Sopenharmony_ci output_extension = "bin" 23800b99b8Sopenharmony_ci output_dir = "$root_out_dir/test/unittest/faultloggerd" 24800b99b8Sopenharmony_ci 25800b99b8Sopenharmony_ci include_dirs = [ 26800b99b8Sopenharmony_ci "$c_utils_include_path", 27800b99b8Sopenharmony_ci "$faultloggerd_path/services", 28800b99b8Sopenharmony_ci "$hilog_lite_include_path", 29800b99b8Sopenharmony_ci "$faultloggerd_path/tools/process_dump", 30800b99b8Sopenharmony_ci "$faultloggerd_path/interfaces/innerkits/faultloggerd_client/include", 31800b99b8Sopenharmony_ci "$faultloggerd_path/interfaces/innerkits/faultloggerd_client", 32800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/common", 33800b99b8Sopenharmony_ci "$faultloggerd_path/common/cutil", 34800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxlog", 35800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxutil", 36800b99b8Sopenharmony_ci ] 37800b99b8Sopenharmony_ci 38800b99b8Sopenharmony_ci sources = [ 39800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_client.cpp", 40800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.cpp", 41800b99b8Sopenharmony_ci "$faultloggerd_path/common/cutil/dfx_cutil.c", 42800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_config.cpp", 43800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_daemon.cpp", 44800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_pipe.cpp", 45800b99b8Sopenharmony_ci "faultlogger_config_test.cpp", 46800b99b8Sopenharmony_ci ] 47800b99b8Sopenharmony_ci sources += [ "$c_utils_src_path/directory_ex.cpp" ] 48800b99b8Sopenharmony_ci 49800b99b8Sopenharmony_ci deps = [ 50800b99b8Sopenharmony_ci "$faultloggerd_common_path/trace:dfx_trace", 51800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxlog:dfx_hilog", 52800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxutil:dfx_util", 53800b99b8Sopenharmony_ci "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 54800b99b8Sopenharmony_ci "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 55800b99b8Sopenharmony_ci ] 56800b99b8Sopenharmony_ci 57800b99b8Sopenharmony_ci external_deps = [ 58800b99b8Sopenharmony_ci "hilog_lite:hilog_shared", 59800b99b8Sopenharmony_ci "init:libbegetutil", 60800b99b8Sopenharmony_ci ] 61800b99b8Sopenharmony_ci 62800b99b8Sopenharmony_ci if (faultloggerd_hisysevent_enable) { 63800b99b8Sopenharmony_ci deps += [ "hisysevent:libhisysevent" ] 64800b99b8Sopenharmony_ci } else { 65800b99b8Sopenharmony_ci defines = [ "HISYSEVENT_DISABLE" ] 66800b99b8Sopenharmony_ci } 67800b99b8Sopenharmony_ci } 68800b99b8Sopenharmony_ci } 69800b99b8Sopenharmony_ci 70800b99b8Sopenharmony_ci group("unittest") { 71800b99b8Sopenharmony_ci deps = [ ":test_service" ] 72800b99b8Sopenharmony_ci } 73800b99b8Sopenharmony_ci} else { 74800b99b8Sopenharmony_ci import("//build/config/features.gni") 75800b99b8Sopenharmony_ci import("//build/test.gni") 76800b99b8Sopenharmony_ci 77800b99b8Sopenharmony_ci config("module_private_config") { 78800b99b8Sopenharmony_ci visibility = [ ":*" ] 79800b99b8Sopenharmony_ci 80800b99b8Sopenharmony_ci include_dirs = [ 81800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.h", 82800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/", 83800b99b8Sopenharmony_ci "$faultloggerd_path/services", 84800b99b8Sopenharmony_ci "$faultloggerd_path/common/cutil", 85800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxlog", 86800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxutil", 87800b99b8Sopenharmony_ci ] 88800b99b8Sopenharmony_ci } 89800b99b8Sopenharmony_ci 90800b99b8Sopenharmony_ci ohos_unittest("test_service") { 91800b99b8Sopenharmony_ci module_out_path = "faultloggerd/services" 92800b99b8Sopenharmony_ci 93800b99b8Sopenharmony_ci include_dirs = [ 94800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/include", 95800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.h", 96800b99b8Sopenharmony_ci ] 97800b99b8Sopenharmony_ci defines = [ "FAULTLOGGERD_FUZZER" ] 98800b99b8Sopenharmony_ci 99800b99b8Sopenharmony_ci sources = [ 100800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_client.cpp", 101800b99b8Sopenharmony_ci "$faultloggerd_interfaces_path/innerkits/faultloggerd_client/faultloggerd_socket.cpp", 102800b99b8Sopenharmony_ci "$faultloggerd_path/common/cutil/dfx_cutil.c", 103800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_config.cpp", 104800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_daemon.cpp", 105800b99b8Sopenharmony_ci "$faultloggerd_path/services/fault_logger_pipe.cpp", 106800b99b8Sopenharmony_ci "faultlogger_config_test.cpp", 107800b99b8Sopenharmony_ci "faultlogger_daemon_test.cpp", 108800b99b8Sopenharmony_ci "faultlogger_pipe_test.cpp", 109800b99b8Sopenharmony_ci ] 110800b99b8Sopenharmony_ci 111800b99b8Sopenharmony_ci cflags = [ "-Dprivate=public" ] 112800b99b8Sopenharmony_ci configs = [ 113800b99b8Sopenharmony_ci ":module_private_config", 114800b99b8Sopenharmony_ci "$faultloggerd_path/common/build:coverage_flags", 115800b99b8Sopenharmony_ci ] 116800b99b8Sopenharmony_ci 117800b99b8Sopenharmony_ci deps = [ 118800b99b8Sopenharmony_ci "$faultloggerd_common_path/trace:dfx_trace", 119800b99b8Sopenharmony_ci "$faultloggerd_path/common/dfxutil:dfx_util", 120800b99b8Sopenharmony_ci "$faultloggerd_path/interfaces/innerkits/faultloggerd_client:libfaultloggerd", 121800b99b8Sopenharmony_ci ] 122800b99b8Sopenharmony_ci 123800b99b8Sopenharmony_ci external_deps = [ 124800b99b8Sopenharmony_ci "c_utils:utils", 125800b99b8Sopenharmony_ci "googletest:gmock_main", 126800b99b8Sopenharmony_ci "googletest:gtest_main", 127800b99b8Sopenharmony_ci "hilog:libhilog", 128800b99b8Sopenharmony_ci "hisysevent:libhisysevent", 129800b99b8Sopenharmony_ci "init:libbegetutil", 130800b99b8Sopenharmony_ci ] 131800b99b8Sopenharmony_ci } 132800b99b8Sopenharmony_ci 133800b99b8Sopenharmony_ci group("unittest") { 134800b99b8Sopenharmony_ci testonly = true 135800b99b8Sopenharmony_ci deps = [ ":test_service" ] 136800b99b8Sopenharmony_ci } 137800b99b8Sopenharmony_ci} 138