Modify fuzztest Signed-off-by:mayunteng_1<mayunteng@huawei.com>

This commit is contained in:
mayunteng_1 2022-12-29 14:56:12 +08:00
parent a2a5af0bba
commit 7088e5ae3b
4 changed files with 178 additions and 21 deletions

View File

@ -53,7 +53,10 @@
}
],
"test": [
"//base/msdp/device_status/services/native/test:devicestatussrv_test"
"//base/msdp/device_status/services/native/test:devicestatussrv_test",
"//base/msdp/device_status/libs/test:devicestatuslib_test",
"//base/msdp/device_status/test/fuzztest:device_status_fuzztest",
"//base/msdp/device_status:device_status_tests"
]
}
}

View File

@ -31,29 +31,10 @@ config("devicestatus_srv_public_config") {
]
}
ohos_shared_library("devicestatus_msdp_mock") {
ohos_shared_library("devicestatus_mock") {
sources = [
"src/devicestatus_data_parse.cpp",
"src/devicestatus_msdp_mock.cpp",
]
configs = [
"${device_status_utils_path}:devicestatus_utils_config",
":devicestatus_private_config",
]
public_configs = [ ":devicestatus_srv_public_config" ]
deps = [ "//third_party/cJSON:cjson_static" ]
external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
part_name = "${device_status_part_name}"
}
ohos_shared_library("devicestatus_sensor_mock") {
sources = [
"src/devicestatus_data_parse.cpp",
"src/devicestatus_sensor_mock.cpp",
]
@ -94,6 +75,7 @@ ohos_shared_library("devicestatus_algo") {
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//foundation/multimodalinput/input/util:libmmi-util",
"//third_party/cJSON:cjson_static",
"//third_party/jsoncpp",
]
external_deps = [

22
libs/test/BUILD.gn Normal file
View File

@ -0,0 +1,22 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//base/msdp/device_status/device_status.gni")
import("//build/test.gni")
group("devicestatuslib_test") {
testonly = true
deps = []
deps += [ "unittest:unittest" ]
}

150
libs/test/unittest/BUILD.gn Normal file
View File

@ -0,0 +1,150 @@
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//base/msdp/device_status/device_status.gni")
import("//build/test.gni")
module_output_path = "${device_status_part_name}/devicestatussrv"
config("devicestatus_private_config") {
visibility = [ ":*" ]
include_dirs = [
"include",
"//base/msdp/device_status/services/native/include",
"//base/msdp/device_status/libs/include",
"//base/msdp/device_status/libs/include/algorithm",
"//base/msdp/device_status/libs/include/datahub",
"//base/msdp/device_status/libs/interface",
"${device_status_interfaces_path}/innerkits/include",
"//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include/",
"${ability_runtime_path}/interfaces/kits/native/ability/native/",
"//base/sensors/sensor/interfaces/native/include/",
"//utils/system/safwk/native/include",
]
}
ohos_unittest("device_status_algorithm_test") {
module_out_path = module_output_path
sources = [ "src/device_status_algorithm_test.cpp" ]
configs = [
"${device_status_utils_path}:devicestatus_utils_config",
":devicestatus_private_config",
]
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"${device_status_root_path}/services:devicestatus_service",
"//base/msdp/device_status/libs:devicestatus_algo",
"//commonlibrary/c_utils/base:utils",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//foundation/multimodalinput/input/util:libmmi-util",
"//third_party/cJSON:cjson_static",
"//third_party/googletest:gtest_main",
"//third_party/jsoncpp",
]
external_deps = [
"ability_base:base",
"access_token:libaccesstoken_sdk",
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",
]
}
ohos_unittest("device_status_datahub_test") {
module_out_path = module_output_path
sources = [ "src/device_status_datahub_test.cpp" ]
configs = [
"${device_status_utils_path}:devicestatus_utils_config",
":devicestatus_private_config",
]
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"${device_status_root_path}/services:devicestatus_service",
"//base/msdp/device_status/libs:devicestatus_algo",
"//base/msdp/device_status/libs:devicestatus_mock",
"//commonlibrary/c_utils/base:utils",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//foundation/multimodalinput/input/util:libmmi-util",
"//third_party/cJSON:cjson_static",
"//third_party/googletest:gtest_main",
"//third_party/jsoncpp",
]
external_deps = [
"ability_base:base",
"access_token:libaccesstoken_sdk",
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",
]
}
ohos_unittest("device_status_msdp_mock_test") {
module_out_path = module_output_path
sources = [ "src/device_status_msdp_mock_test.cpp" ]
configs = [
"${device_status_utils_path}:devicestatus_utils_config",
":devicestatus_private_config",
]
deps = [
"${device_status_interfaces_path}/innerkits:devicestatus_client",
"${device_status_root_path}/services:devicestatus_service",
"//base/msdp/device_status/libs:devicestatus_algo",
"//base/msdp/device_status/libs:devicestatus_mock",
"//commonlibrary/c_utils/base:utils",
"//drivers/peripheral/sensor/hal:hdi_sensor",
"//foundation/multimodalinput/input/util:libmmi-util",
"//third_party/cJSON:cjson_static",
"//third_party/googletest:gtest_main",
"//third_party/jsoncpp",
]
external_deps = [
"ability_base:base",
"access_token:libaccesstoken_sdk",
"c_utils:utils",
"hiviewdfx_hilog_native:libhilog",
"input:libmmi-client",
"ipc:ipc_core",
"relational_store:native_rdb",
"safwk:system_ability_fwk",
"samgr:samgr_proxy",
"sensor:sensor_interface_native",
]
}
group("unittest") {
testonly = true
deps = []
deps += [ ":device_status_algorithm_test" ]
}