1# Copyright (c) 2021 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 "include/", 27 "mock/", 28 "//commonlibrary/c_utils/base/include", 29 "$faultloggerd_path/common", 30 "$faultloggerd_path/tools/process_dump/test/mock/include/", 31 "$faultloggerd_path/tools/process_dump", 32 "$faultloggerd_path/utils", 33 "//third_party/libunwind/include/", 34 "//third_party/googletest/googlemock/include", 35 "$hilog_lite_include_path", 36 ] 37 38 sources = [ 39 "//base/hiviewdfx/faultloggerd/utils/directory_ex.cpp", 40 "src/dfx_base_test.cpp", 41 "src/dfx_maps_test.cpp", 42 "src/dfx_processdump_test.cpp", 43 "src/multithread_constructor.c", 44 "src/process_dfx_test.cpp", 45 "src/process_dump_test.cpp", 46 "src/process_frames_test.cpp", 47 ] 48 49 deps = [ 50 "$faultloggerd_path/common/util:dfx_cutil", 51 "$faultloggerd_path/tools/process_dump:process_info_src", 52 "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 53 "//third_party/libunwind:libunwind", 54 ] 55 } 56 } 57 58 group("unittest") { 59 deps = [ ":test_processdump" ] 60 } 61} else { 62 import("//build/config/features.gni") 63 import("//build/test.gni") 64 65 config("module_private_config") { 66 visibility = [ ":*" ] 67 68 include_dirs = [ 69 "include/", 70 "mock/", 71 "//commonlibrary/c_utils/base/include", 72 "$faultloggerd_path/common", 73 "$faultloggerd_path/tools/process_dump/test/mock/include/", 74 "$faultloggerd_path/tools/process_dump", 75 "//third_party/libunwind/include/", 76 ] 77 } 78 79 module_output_path = "faultloggerd/process_dump" 80 81 ohos_unittest("test_processdump") { 82 module_out_path = module_output_path 83 sources = [ 84 "src/dfx_base_test.cpp", 85 "src/dfx_maps_test.cpp", 86 "src/dfx_processdump_test.cpp", 87 "src/multithread_constructor.c", 88 "src/process_dfx_test.cpp", 89 "src/process_dump_test.cpp", 90 "src/process_frames_test.cpp", 91 ] 92 93 configs = [ ":module_private_config" ] 94 95 defines = [ "UNITTEST" ] 96 97 deps = [ 98 "$faultloggerd_path/common/util:dfx_cutil", 99 "$faultloggerd_path/tools/process_dump:process_info_src", 100 "//third_party/googletest:gmock_main", 101 "//third_party/googletest:gtest_main", 102 "//third_party/libunwind:libunwind", 103 ] 104 external_deps = [ "c_utils:utils" ] 105 } 106 107 group("unittest") { 108 testonly = true 109 deps = [ ":test_processdump" ] 110 } 111} 112