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