# 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("//build/test.gni") module_output_path = "neural_network_runtime/" config("module_private_config") { visibility = [ ":*" ] include_dirs = [ "//third_party/googletest/googlemock/include", "../../..", "../../../frameworks/native", "../../../frameworks/native/neural_network_runtime", "../../../frameworks/native/neural_network_core", "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", "//third_party/mindspore/mindspore-src/source/mindspore/lite/mindir/include", ] } ohos_unittest("CompilationV1_0Test") { module_out_path = module_output_path sources = [ "../common/v1_0/compilation_mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("ExecutorV1_0Test") { module_out_path = module_output_path sources = [ "../common/v1_0/executor_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("DeviceManagerV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/device_manager/device_manager_test.cpp" ] sources += [ "../common/v1_0/mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("DeviceRegistrarV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/device_registrar/device_registrar_test.cpp" ] sources += [ "../common/v1_0/mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("HDIDeviceV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/hdi_device/hdi_device_test.cpp" ] sources += [ "../common/v1_0/mock_idevice.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("HDIPreparedModelV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/hdi_prepared_model/hdi_prepared_model_test.cpp" ] sources += [ "../common/v1_0/mock_idevice.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("MemoryManagerTest") { module_out_path = module_output_path sources = [ "./memory_manager/memory_manager_test.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NeuralNetworkCoreV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/neural_network_core_test/neural_network_core_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("QuantParamsTest") { module_out_path = module_output_path sources = [ "./quant_param/quant_param_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NNBackendTest") { module_out_path = module_output_path sources = [ "./nn_backend/nn_backend_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NNCompiledCacheTest") { module_out_path = module_output_path sources = [ "./nn_compiled_cache/nn_compiled_cache_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NNCompilerTest") { module_out_path = module_output_path sources = [ "./nn_compiler/nn_compiler_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NNExecutorTest") { module_out_path = module_output_path sources = [ "./nn_executor/nn_executor_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NNTensor2_0Test") { module_out_path = module_output_path sources = [ "./nn_tensor/nn_tensor_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("TransformV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/transform/transform_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_1.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("InnerModelV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/inner_model/inner_model_test.cpp" ] sources += [ "../common/v1_0/inner_model_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NnTensorV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/inner_model/nn_tensor_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NnTensorDescV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/inner_model/nn_tensor_desc_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("NnValidationV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/inner_model/nn_validation_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("OpsRegistryV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/inner_model/ops_registry_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NeuralNetworkRuntimeV1_0Test") { module_out_path = module_output_path sources = [ "./v1_0/neural_network_runtime_test/neural_network_runtime_test.cpp" ] sources += [ "../common/v1_0/executor_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_1.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("CompilationV2_0Test") { module_out_path = module_output_path sources = [ "../common/v2_0/compilation_mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("ExecutorV2_0Test") { module_out_path = module_output_path sources = [ "../common/v2_0/executor_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("DeviceManagerV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/device_manager/device_manager_test.cpp" ] sources += [ "../common/v2_0/mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("DeviceRegistrarV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/device_registrar/device_registrar_test.cpp" ] sources += [ "../common/v2_0/mock_idevice.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("HDIDeviceV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/hdi_device/hdi_device_test.cpp" ] sources += [ "../common/v2_0/mock_idevice.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("HDIPreparedModelV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/hdi_prepared_model/hdi_prepared_model_test.cpp" ] sources += [ "../common/v2_0/mock_idevice.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("HDIPreparedModelV2_1Test") { module_out_path = module_output_path sources = [ "./v2_1/hdi_prepared_model/hdi_prepared_model_test.cpp" ] sources += [ "../common/v2_1/mock_idevice.cpp" ] sources += [ "../common/file_utils.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", ] } ohos_unittest("TransformV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/transform/transform_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "drivers_interface_nnrt:libnnrt_proxy_2.0", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("InnerModelV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/inner_model/inner_model_test.cpp" ] sources += [ "../common/v2_0/inner_model_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NnTensorV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/inner_model/nn_tensor_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NnValidationV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/inner_model/nn_validation_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("OpsRegistryV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/inner_model/ops_registry_test.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } ohos_unittest("NeuralNetworkRuntimeV2_0Test") { module_out_path = module_output_path sources = [ "./v2_0/neural_network_runtime_test/neural_network_runtime_test.cpp" ] sources += [ "../common/v2_0/executor_mock_device.cpp" ] configs = [ ":module_private_config" ] deps = [ "../../../frameworks/native/neural_network_core:libneural_network_core", "../../../frameworks/native/neural_network_runtime:libneural_network_runtime", "//third_party/googletest:gmock_main", "//third_party/googletest:gtest_main", ] external_deps = [ "c_utils:utils", "drivers_interface_nnrt:libnnrt_proxy_2.0", "hdf_core:libhdf_utils", "hilog:libhilog", "hitrace:libhitracechain", "mindspore:mindir", ] } group("components_unittest") { testonly = true deps = [ ":DeviceManagerV1_0Test", ":HDIDeviceV1_0Test", ":HDIDeviceV2_0Test", ":HDIPreparedModelV1_0Test", ":HDIPreparedModelV2_0Test", ":HDIPreparedModelV2_1Test", ":InnerModelV1_0Test", ":InnerModelV2_0Test", ":MemoryManagerTest", ":NNBackendTest", ":NNCompiledCacheTest", ":NNCompilerTest", ":NNExecutorTest", ":NNTensor2_0Test", ":NeuralNetworkCoreV1_0Test", ":NeuralNetworkRuntimeV1_0Test", ":NeuralNetworkRuntimeV2_0Test", ":NnTensorDescV1_0Test", ":NnTensorV1_0Test", ":NnTensorV2_0Test", ":NnValidationV1_0Test", ":NnValidationV2_0Test", ":OpsRegistryV1_0Test", ":OpsRegistryV2_0Test", ":QuantParamsTest", ":TransformV1_0Test", ":TransformV2_0Test", ] }