1# Copyright (c) 2021-2023 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/test.gni") 15import("./../../../../sensor.gni") 16 17ohos_unittest("SensorAgentTest") { 18 module_out_path = "sensor/interfaces/inner_api" 19 20 sources = [ 21 "$SUBSYSTEM_DIR/test/unittest/common/src/system_info.cpp", 22 "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api/sensor_agent_test.cpp", 23 ] 24 25 include_dirs = [ 26 "$SUBSYSTEM_DIR/interfaces/inner_api", 27 "$SUBSYSTEM_DIR/frameworks/native/include", 28 "$SUBSYSTEM_DIR/test/unittest/common/include", 29 "$SUBSYSTEM_DIR/utils/common/include", 30 ] 31 32 deps = [ 33 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 34 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 35 "//third_party/googletest:gmock_main", 36 "//third_party/googletest:gtest_main", 37 ] 38 39 external_deps = [ 40 "access_token:libaccesstoken_sdk", 41 "access_token:libnativetoken", 42 "access_token:libtoken_setproc", 43 "c_utils:utils", 44 "hilog:libhilog", 45 "ipc:ipc_single", 46 ] 47} 48 49ohos_unittest("SensorAlgorithmTest") { 50 module_out_path = "sensor/interfaces/inner_api" 51 52 sources = [ "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api/sensor_algorithm_test.cpp" ] 53 54 include_dirs = [ 55 "$SUBSYSTEM_DIR/interfaces/inner_api", 56 "$SUBSYSTEM_DIR/frameworks/native/include", 57 "$SUBSYSTEM_DIR/test/unittest/common/include", 58 "$SUBSYSTEM_DIR/utils/common/include", 59 ] 60 61 deps = [ 62 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 63 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 64 "//third_party/googletest:gmock_main", 65 "//third_party/googletest:gtest_main", 66 ] 67 68 external_deps = [ 69 "c_utils:utils", 70 "hilog:libhilog", 71 "ipc:ipc_single", 72 ] 73} 74 75ohos_unittest("SensorPowerTest") { 76 module_out_path = "sensor/interfaces/inner_api" 77 78 sources = [ 79 "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api/sensor_power_test.cpp", 80 ] 81 82 sanitize = { 83 cfi = true 84 cfi_cross_dso = true 85 debug = false 86 } 87 88 include_dirs = [ 89 "$SUBSYSTEM_DIR/utils/common/include", 90 "$SUBSYSTEM_DIR/interfaces/inner_api", 91 "$SUBSYSTEM_DIR/frameworks/native/include", 92 ] 93 94 deps = [ 95 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 96 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 97 "//third_party/googletest:gmock_main", 98 "//third_party/googletest:gtest_main", 99 ] 100 101 external_deps = [ 102 "access_token:libaccesstoken_sdk", 103 "access_token:libnativetoken", 104 "access_token:libtoken_setproc", 105 "c_utils:utils", 106 "hilog:libhilog", 107 "ipc:ipc_single", 108 ] 109} 110 111ohos_unittest("PostureTest") { 112 module_out_path = "sensor/interfaces/inner_api" 113 114 sources = 115 [ "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api/posture_test.cpp" ] 116 117 include_dirs = [ 118 "$SUBSYSTEM_DIR/utils/common/include", 119 "$SUBSYSTEM_DIR/interfaces/inner_api", 120 "$SUBSYSTEM_DIR/frameworks/native/include", 121 ] 122 123 deps = [ 124 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 125 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 126 "//third_party/googletest:gmock_main", 127 "//third_party/googletest:gtest_main", 128 ] 129 130 external_deps = [ 131 "c_utils:utils", 132 "hilog:libhilog", 133 "ipc:ipc_single", 134 ] 135} 136 137ohos_unittest("HeadPostureTest") { 138 module_out_path = "sensor/interfaces/inner_api" 139 140 sources = [ 141 "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api//head_posture_test.cpp", 142 ] 143 144 include_dirs = [ 145 "$SUBSYSTEM_DIR/utils/common/include", 146 "$SUBSYSTEM_DIR/interfaces/inner_api", 147 "$SUBSYSTEM_DIR/frameworks/native/include", 148 ] 149 150 deps = [ 151 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 152 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 153 "//third_party/googletest:gmock_main", 154 "//third_party/googletest:gtest_main", 155 ] 156 157 external_deps = [ 158 "c_utils:utils", 159 "hilog:libhilog", 160 "ipc:ipc_single", 161 ] 162} 163ohos_unittest("DropDetectionTest") { 164 module_out_path = "sensor/interfaces/inner_api" 165 166 sources = [ "$SUBSYSTEM_DIR/test/unittest/interfaces/inner_api//drop_detection_test.cpp" ] 167 168 include_dirs = [ 169 "$SUBSYSTEM_DIR/utils/common/include", 170 "$SUBSYSTEM_DIR/interfaces/inner_api", 171 "$SUBSYSTEM_DIR/frameworks/native/include", 172 ] 173 174 deps = [ 175 "$SUBSYSTEM_DIR/frameworks/native:sensor_target", 176 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 177 "//third_party/googletest:gmock_main", 178 "//third_party/googletest:gtest_main", 179 ] 180 181 external_deps = [ 182 "c_utils:utils", 183 "hilog:libhilog", 184 "ipc:ipc_single", 185 ] 186} 187group("unittest") { 188 testonly = true 189 deps = [ 190 ":DropDetectionTest", 191 ":HeadPostureTest", 192 ":PostureTest", 193 ":SensorAgentTest", 194 ":SensorAlgorithmTest", 195 ":SensorPowerTest", 196 ] 197} 198