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