1# Copyright (c) 2022 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("//build/lite/config/component/lite_component.gni") 15import("../../../config.gni") 16 17if (defined(ohos_lite)) { 18 import("//build/lite/config/test.gni") 19 20 if (ohos_kernel_type != "liteos_m") { 21 test_output_root = "$root_out_dir/test/unittest/syscap_codec" 22 23 executable("test_syscap_napi_unittest") { 24 output_extension = "bin" 25 output_dir = test_output_root 26 27 include_dirs = [ 28 "//third_party/node/src", 29 "../../../src/", 30 "../../../include/", 31 "../../../interfaces/inner_api/", 32 "include/", 33 ] 34 include_dirs += [ syscap_codec_config_path ] 35 36 cflags = [ "-g3" ] 37 38 sources = [ 39 "../../../interfaces/inner_api/syscap_interface.c", 40 "../../../src/context_tool.c", 41 "../../../src/create_pcid.c", 42 "../../../src/endian_internal.c", 43 "../../../src/syscap_tool.c", 44 "../../../src/common_method.c", 45 "syscap_codec_test.cpp", 46 ] 47 48 defines = [ "NAPI_TEST" ] 49 50 deps = [ 51 "//build/lite/config/component/cJSON:cjson_static", 52 "//test/testfwk/developer_test/third_party/lib/cpp:gtest_main", 53 "//third_party/bounds_checking_function:libsec_static", 54 ] 55 } 56 } 57 58 group("unittest") { 59 if (ohos_kernel_type != "liteos_m") { 60 deps = [ ":test_syscap_napi_unittest" ] 61 } 62 } 63} else { 64 import("//build/ohos.gni") 65 import("//build/test.gni") 66 67 module_output_path = "developtools/syscap_codec" 68 69 ohos_unittest("syscap_codec_test") { 70 module_out_path = module_output_path 71 72 include_dirs = [ 73 "../../../src", 74 "../../../include", 75 "../../../interfaces/inner_api", 76 "../../../test/unittest/common/include", 77 ] 78 include_dirs += [ syscap_codec_config_path ] 79 80 sources = [ 81 "../../../interfaces/inner_api/syscap_interface.c", 82 "../../../src/context_tool.c", 83 "../../../src/create_pcid.c", 84 "../../../src/endian_internal.c", 85 "../../../src/syscap_tool.c", 86 "../../../src/common_method.c", 87 "syscap_codec_test.cpp", 88 ] 89 90 external_deps = [ 91 "bounds_checking_function:libsec_static", 92 "cJSON:cjson_static", 93 "googletest:gtest_main", 94 ] 95 } 96 97 group("unittest") { 98 testonly = true 99 deps = [ ":syscap_codec_test" ] 100 } 101} 102