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("../../sensor.gni") 15 16HDF_CORE_PATH = "../../../../hdf_core" 17if (defined(ohos_lite)) { 18 import("//build/lite/config/component/lite_component.gni") 19 import("//build/lite/config/test.gni") 20} else { 21 import("//build/ohos.gni") 22 import("//build/test.gni") 23 import("$HDF_CORE_PATH/adapter/uhdf2/uhdf.gni") 24} 25 26if (defined(ohos_lite)) { 27 unittest("hdf_peripheral_sensor_test") { 28 output_extension = "bin" 29 output_dir = "$root_out_dir/test/unittest/hdf" 30 include_dirs = [ 31 "//third_party/bounds_checking_function/include", 32 "../../interfaces/include", 33 ] 34 35 sources = [ "./common/hdf_sensor_test.cpp" ] 36 cflags = [ 37 "-Wall", 38 "-Wextra", 39 "-Werror", 40 "-fsigned-char", 41 "-fno-common", 42 "-fno-strict-aliasing", 43 ] 44 if (ohos_build_compiler != "clang") { 45 cflags += [ 46 "-Wno-format", 47 "-Wno-format-extra-args", 48 ] 49 } 50 public_deps = [ 51 "$HDF_CORE_PATH/adapter/build/test_common:libhdf_test_common", 52 "$HDF_CORE_PATH/adapter/uhdf/manager:hdf_core", 53 "$HDF_CORE_PATH/adapter/uhdf/posix:hdf_posix_osal", 54 "../../hal:hdi_sensor", 55 "//third_party/bounds_checking_function:libsec_shared", 56 ] 57 58 external_deps = [ "hilog_lite:hilog_shared" ] 59 } 60} else { 61 module_output_path = "drivers_peripheral_sensor/sensor" 62 ohos_unittest("hdf_unittest_sensor") { 63 module_out_path = module_output_path 64 include_dirs = [] 65 66 sources = [ "./common/hdf_sensor_test.cpp" ] 67 cflags = [ 68 "-Wall", 69 "-Wextra", 70 "-Werror", 71 "-fsigned-char", 72 "-fno-common", 73 "-fno-strict-aliasing", 74 ] 75 deps = [ "../../hal:hdi_sensor" ] 76 if (is_standard_system) { 77 external_deps = [ 78 "hdf_core:libhdf_utils", 79 "hilog:libhilog", 80 ] 81 if (c_utils_enable) { 82 external_deps += [ "c_utils:utils" ] 83 } 84 } else { 85 external_deps = [ "hilog:libhilog" ] 86 } 87 } 88} 89