You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
554 lines
15 KiB
554 lines
15 KiB
/*
|
|
* Copyright 2017 The Android Open Source Project
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
package {
|
|
// See: http://go/android-license-faq
|
|
// A large-scale-change added 'default_applicable_licenses' to import
|
|
// all of the 'license_kinds' from "packages_modules_NeuralNetworks_runtime_license"
|
|
// to get the below license kinds:
|
|
// SPDX-license-identifier-Apache-2.0
|
|
// SPDX-license-identifier-Artistic
|
|
default_applicable_licenses: [
|
|
"packages_modules_NeuralNetworks_runtime_license",
|
|
],
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "NeuralNetworksTest_default_libs",
|
|
defaults: ["neuralnetworks_defaults"],
|
|
host_supported: false,
|
|
// b/109953668, disable OpenMP
|
|
// openmp: true,
|
|
shared_libs: [
|
|
"android.hidl.allocator@1.0",
|
|
"android.hidl.memory@1.0",
|
|
"libandroid",
|
|
"libbase",
|
|
"libbinder_ndk",
|
|
"libcutils",
|
|
"libfmq",
|
|
"libhidlbase",
|
|
"libhidlmemory",
|
|
"liblog",
|
|
"libnativewindow",
|
|
"libneuralnetworks_packageinfo",
|
|
"libutils",
|
|
],
|
|
static_libs: [
|
|
"android.hardware.common-V2-ndk_platform",
|
|
"android.hardware.graphics.common-V2-ndk_platform",
|
|
"android.hardware.neuralnetworks-V1-ndk_platform",
|
|
"android.hardware.neuralnetworks@1.0",
|
|
"android.hardware.neuralnetworks@1.1",
|
|
"android.hardware.neuralnetworks@1.2",
|
|
"android.hardware.neuralnetworks@1.3",
|
|
"libaidlcommonsupport",
|
|
"libc++fs",
|
|
"libneuralnetworks_generated_test_harness",
|
|
"libtextclassifier_hash_static",
|
|
],
|
|
whole_static_libs: [
|
|
"libcrypto_static",
|
|
],
|
|
srcs: [
|
|
"RequireDebug.cpp", // Abort compilation if NDEBUG is defined
|
|
],
|
|
cflags: [
|
|
"-UNDEBUG",
|
|
],
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "NeuralNetworksTest_defaults",
|
|
defaults: ["NeuralNetworksTest_default_libs"],
|
|
srcs: [
|
|
// Subset of tests that rely only on public functionality.
|
|
//
|
|
// Changes to this list must be reflected in the "CtsNNAPITests_static"
|
|
// library to ensure CTS tests coverage.
|
|
"GeneratedTestUtils.cpp",
|
|
"TestAssertions.cpp",
|
|
"TestControlFlow.cpp",
|
|
"TestFree.cpp",
|
|
"TestGenerated.cpp",
|
|
"TestGpuNnapi.cpp",
|
|
"TestMemory.cpp",
|
|
"TestNeuralNetworksWrapper.cpp",
|
|
"TestOperandExtraParams.cpp",
|
|
"TestTrivialModel.cpp",
|
|
"TestUnknownDimensions.cpp",
|
|
"TestUnspecifiedDimensions.cpp",
|
|
"TestUpdatability.cpp",
|
|
"TestValidateModel.cpp",
|
|
"TestValidateOperations.cpp",
|
|
"TestValidation.cpp",
|
|
"TestWrapper.cpp",
|
|
|
|
],
|
|
header_libs: [
|
|
"libneuralnetworks_common_headers",
|
|
],
|
|
static_libs: [
|
|
"libgmock",
|
|
],
|
|
shared_libs: [
|
|
"libvulkan",
|
|
],
|
|
whole_static_libs: [
|
|
"neuralnetworks_generated_V1_0_example",
|
|
"neuralnetworks_generated_V1_1_example",
|
|
"neuralnetworks_generated_V1_2_example",
|
|
"neuralnetworks_generated_V1_3_cts_only_example",
|
|
"neuralnetworks_generated_V1_3_example",
|
|
],
|
|
}
|
|
|
|
cc_test {
|
|
name: "NeuralNetworksTest_shared_partial",
|
|
defaults: ["NeuralNetworksTest_defaults"],
|
|
srcs: [
|
|
"TestMain.cpp",
|
|
],
|
|
cflags: [
|
|
"-DNNTEST_ONLY_PUBLIC_API",
|
|
],
|
|
shared_libs: [
|
|
"libneuralnetworks",
|
|
],
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "NeuralNetworksTest_static_defaults",
|
|
defaults: ["NeuralNetworksTest_defaults"],
|
|
srcs: [
|
|
// Tests that rely on non-public functionality (i.e., symbols
|
|
// not exported from libneuralnetworks.so).
|
|
//
|
|
// b/109953668, disable OpenMP
|
|
// "TestOpenmpSettings.cpp",
|
|
"PreparedModelCallback.cpp",
|
|
"TestCompilationCaching.cpp",
|
|
"TestCompliance.cpp",
|
|
"TestExecution.cpp",
|
|
"TestExtensions.cpp",
|
|
"TestFailingDriver.cpp",
|
|
"TestIntrospectionControl.cpp",
|
|
"TestMemoryDomain.cpp",
|
|
"TestMemoryInternal.cpp",
|
|
"TestPartitioning.cpp",
|
|
"TestPartitioningRandom.cpp",
|
|
"TestRemoveDefaultArguments.cpp",
|
|
"fibonacci_extension/FibonacciDriver.cpp",
|
|
"fibonacci_extension/FibonacciExtensionTest.cpp",
|
|
|
|
"TestMain.cpp",
|
|
],
|
|
static_libs: [
|
|
"android.hardware.neuralnetworks@1.0-adapter-helper",
|
|
"android.hardware.neuralnetworks@1.1-adapter-helper",
|
|
"android.hardware.neuralnetworks@1.2-adapter-helper",
|
|
"android.hardware.neuralnetworks@1.3-adapter-helper",
|
|
"libSampleDriver",
|
|
"libgmock",
|
|
"libhidladapter",
|
|
"libneuralnetworks_common",
|
|
"libneuralnetworks_generated_test_harness",
|
|
"libneuralnetworks_static",
|
|
"neuralnetworks_test_utils",
|
|
],
|
|
shared_libs: [
|
|
"libcutils",
|
|
],
|
|
header_libs: [
|
|
"libneuralnetworks_private_headers",
|
|
"libutils_headers",
|
|
"neuralnetworks_example_fibonacci_extension",
|
|
],
|
|
}
|
|
|
|
cc_test {
|
|
name: "NeuralNetworksTest_static",
|
|
defaults: ["NeuralNetworksTest_static_defaults"],
|
|
test_suites: [
|
|
"general-tests",
|
|
],
|
|
}
|
|
|
|
cc_test {
|
|
name: "NeuralNetworksTest_static_fuzzing",
|
|
defaults: ["NeuralNetworksTest_default_libs"],
|
|
srcs: [
|
|
"GeneratedTestUtils.cpp",
|
|
"TestNeuralNetworksWrapper.cpp",
|
|
"fuzzing/OperationManager.cpp",
|
|
"fuzzing/RandomGraphGenerator.cpp",
|
|
"fuzzing/RandomGraphGeneratorUtils.cpp",
|
|
"fuzzing/RandomVariable.cpp",
|
|
"fuzzing/TestRandomGraph.cpp",
|
|
"fuzzing/operation_signatures/*.cpp",
|
|
],
|
|
static_libs: [
|
|
"libSampleDriver",
|
|
"libgmock",
|
|
"libneuralnetworks_common",
|
|
"libneuralnetworks_static",
|
|
"neuralnetworks_types",
|
|
"neuralnetworks_utils_hal_1_0",
|
|
"neuralnetworks_utils_hal_1_1",
|
|
"neuralnetworks_utils_hal_1_2",
|
|
"neuralnetworks_utils_hal_1_3",
|
|
],
|
|
shared_libs: ["libmemunreachable"],
|
|
header_libs: [
|
|
"libneuralnetworks_private_headers",
|
|
],
|
|
sanitize: {
|
|
integer_overflow: true,
|
|
},
|
|
}
|
|
|
|
cc_fuzz {
|
|
name: "libneuralnetworks_fuzzer",
|
|
defaults: [
|
|
"NeuralNetworksTest_default_libs",
|
|
"libneuralnetworks_fuzzer_defaults",
|
|
],
|
|
owner: "google",
|
|
fuzz_config: {
|
|
cc: ["butlermichael@google.com"],
|
|
// Temporarily disabled due to b/151102177.
|
|
fuzz_on_haiku_host: false,
|
|
fuzz_on_haiku_device: false,
|
|
},
|
|
srcs: [
|
|
"android_fuzzing/FuzzTest.cpp",
|
|
],
|
|
static_libs: [
|
|
"libneuralnetworks_common",
|
|
"libneuralnetworks_generated_test_harness",
|
|
"libneuralnetworks_static",
|
|
],
|
|
}
|
|
|
|
cc_fuzz {
|
|
name: "libneuralnetworks_driver_fuzzer",
|
|
defaults: [
|
|
"NeuralNetworksTest_default_libs",
|
|
"libneuralnetworks_fuzzer_defaults",
|
|
],
|
|
owner: "google",
|
|
fuzz_config: {
|
|
cc: ["butlermichael@google.com"],
|
|
// Temporarily disabled due to b/151102177.
|
|
fuzz_on_haiku_host: false,
|
|
fuzz_on_haiku_device: false,
|
|
},
|
|
srcs: [
|
|
"android_fuzzing/DriverFuzzTest.cpp",
|
|
],
|
|
static_libs: [
|
|
"libSampleDriver",
|
|
"libneuralnetworks_common",
|
|
"libneuralnetworks_generated_test_harness",
|
|
"libneuralnetworks_static",
|
|
],
|
|
}
|
|
|
|
// Temporarily disabled due to b/139889855.
|
|
cc_test {
|
|
name: "NeuralNetworksTest_static_asan",
|
|
defaults: ["NeuralNetworksTest_static_defaults"],
|
|
enabled: false,
|
|
sanitize: {
|
|
address: true,
|
|
},
|
|
// Declare explicit library dependency for continuous builds
|
|
target: {
|
|
android_arm: {
|
|
required: [
|
|
"libclang_rt.asan-arm-android",
|
|
],
|
|
},
|
|
android_arm64: {
|
|
required: [
|
|
"libclang_rt.asan-aarch64-android",
|
|
],
|
|
},
|
|
android_x86: {
|
|
required: [
|
|
"libclang_rt.asan-i686-android",
|
|
],
|
|
},
|
|
android_x86_64: {
|
|
required: [
|
|
"libclang_rt.asan-x86_64-android",
|
|
],
|
|
},
|
|
},
|
|
}
|
|
|
|
// Temporarily disabled due to b/139889855.
|
|
cc_test {
|
|
name: "NeuralNetworksTest_static_ubsan",
|
|
defaults: ["NeuralNetworksTest_static_defaults"],
|
|
enabled: false,
|
|
sanitize: {
|
|
undefined: true,
|
|
all_undefined: true,
|
|
diag: {
|
|
undefined: true,
|
|
},
|
|
},
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "NeuralNetworksTest_mt_defaults",
|
|
defaults: ["NeuralNetworksTest_default_libs"],
|
|
srcs: [
|
|
"GeneratedTestUtils.cpp",
|
|
"TestGenerated.cpp",
|
|
"TestMain.cpp",
|
|
"TestNeuralNetworksWrapper.cpp",
|
|
],
|
|
cflags: [
|
|
"-DNNTEST_MULTITHREADED",
|
|
],
|
|
static_libs: [
|
|
"libSampleDriver",
|
|
"libgmock",
|
|
"libneuralnetworks_common",
|
|
"libneuralnetworks_static",
|
|
],
|
|
whole_static_libs: [
|
|
"neuralnetworks_generated_V1_0_example",
|
|
"neuralnetworks_generated_V1_1_example",
|
|
"neuralnetworks_generated_V1_2_example",
|
|
"neuralnetworks_generated_V1_3_cts_only_example",
|
|
"neuralnetworks_generated_V1_3_example",
|
|
],
|
|
shared_libs: [
|
|
"libcutils",
|
|
],
|
|
header_libs: [
|
|
"libneuralnetworks_private_headers",
|
|
],
|
|
}
|
|
|
|
cc_test {
|
|
name: "NeuralNetworksTest_mt_static",
|
|
defaults: ["NeuralNetworksTest_mt_defaults"],
|
|
}
|
|
|
|
// Temporarily disabled due to b/139889855.
|
|
cc_test {
|
|
// Note: tsan not supported on Android (yet)
|
|
name: "NeuralNetworksTest_mt_static_asan",
|
|
defaults: ["NeuralNetworksTest_mt_defaults"],
|
|
enabled: false,
|
|
sanitize: {
|
|
address: true,
|
|
},
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "CtsNNAPITests_static",
|
|
defaults: ["neuralnetworks_float16"],
|
|
srcs: [
|
|
":libneuralnetworks_generated_test_harness_for_cts",
|
|
"CtsMain.cpp",
|
|
"GeneratedTestUtils.cpp",
|
|
"RequireDebug.cpp", // Abort compilation if NDEBUG is defined
|
|
"TestControlFlow.cpp",
|
|
"TestFree.cpp",
|
|
"TestGenerated.cpp",
|
|
"TestGpuNnapi.cpp",
|
|
"TestMemory.cpp",
|
|
"TestNeuralNetworksWrapper.cpp",
|
|
"TestTrivialModel.cpp",
|
|
"TestUnknownDimensions.cpp",
|
|
"TestUpdatability.cpp",
|
|
"TestValidateModel.cpp",
|
|
"TestValidateOperations.cpp",
|
|
"TestValidation.cpp",
|
|
"TestWrapper.cpp",
|
|
"fuzzing/OperationManager.cpp",
|
|
"fuzzing/RandomGraphGenerator.cpp",
|
|
"fuzzing/RandomGraphGeneratorUtils.cpp",
|
|
"fuzzing/RandomVariable.cpp",
|
|
"fuzzing/TestRandomGraph.cpp",
|
|
"fuzzing/operation_signatures/*.cpp",
|
|
"generated/spec_V1_*/*.example.cpp",
|
|
],
|
|
include_dirs: [
|
|
"packages/modules/NeuralNetworks/common/include",
|
|
"packages/modules/NeuralNetworks/runtime/",
|
|
"packages/modules/NeuralNetworks/runtime/include/",
|
|
"packages/modules/NeuralNetworks/tools/test_generator/test_harness/include",
|
|
],
|
|
cflags: [
|
|
"-DNNTEST_CTS",
|
|
"-DNNTEST_ONLY_PUBLIC_API",
|
|
"-UNDEBUG",
|
|
"-Wall",
|
|
"-Werror",
|
|
],
|
|
shared_libs: [
|
|
"libandroid",
|
|
"liblog",
|
|
"libneuralnetworks",
|
|
"libvulkan",
|
|
],
|
|
static_libs: [
|
|
"libbase_ndk",
|
|
"libgmock_ndk",
|
|
"libgtest_ndk_c++",
|
|
],
|
|
min_sdk_version: "30",
|
|
sdk_version: "current",
|
|
stl: "libc++_static",
|
|
}
|
|
|
|
cc_defaults {
|
|
name: "neuralnetworks_generated_defaults",
|
|
defaults: ["neuralnetworks_float16"],
|
|
// b/146324523, NNAPI host build capability
|
|
host_supported: false,
|
|
vendor_available: true,
|
|
static_libs: ["libneuralnetworks_generated_test_harness"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "neuralnetworks_generated_V1_0_example",
|
|
defaults: ["neuralnetworks_generated_defaults"],
|
|
srcs: ["generated/spec_V1_0/*.example.cpp"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "neuralnetworks_generated_V1_1_example",
|
|
defaults: ["neuralnetworks_generated_defaults"],
|
|
srcs: ["generated/spec_V1_1/*.example.cpp"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "neuralnetworks_generated_V1_2_example",
|
|
defaults: ["neuralnetworks_generated_defaults"],
|
|
srcs: ["generated/spec_V1_2/*.example.cpp"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "neuralnetworks_generated_V1_3_example",
|
|
defaults: ["neuralnetworks_generated_defaults"],
|
|
srcs: ["generated/spec_V1_3/*.example.cpp"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "neuralnetworks_generated_V1_3_cts_only_example",
|
|
defaults: ["neuralnetworks_float16"],
|
|
srcs: ["generated/spec_V1_3_cts_only/*.example.cpp"],
|
|
static_libs: ["libneuralnetworks_generated_test_harness"],
|
|
}
|
|
|
|
cc_library_static {
|
|
name: "NeuralNetworksTest_random_graph",
|
|
defaults: ["neuralnetworks_float16"],
|
|
srcs: [
|
|
":libneuralnetworks_generated_test_harness_for_cts",
|
|
"GeneratedTestUtils.cpp",
|
|
"TestNeuralNetworksWrapper.cpp",
|
|
"fuzzing/OperationManager.cpp",
|
|
"fuzzing/RandomGraphGenerator.cpp",
|
|
"fuzzing/RandomGraphGeneratorUtils.cpp",
|
|
"fuzzing/RandomVariable.cpp",
|
|
"fuzzing/operation_signatures/*.cpp",
|
|
],
|
|
include_dirs: [
|
|
"packages/modules/NeuralNetworks/common/include",
|
|
"packages/modules/NeuralNetworks/runtime/",
|
|
"packages/modules/NeuralNetworks/runtime/include/",
|
|
],
|
|
header_libs: [
|
|
"libneuralnetworks_generated_test_harness_headers_for_cts",
|
|
],
|
|
export_include_dirs: [
|
|
".",
|
|
"fuzzing",
|
|
],
|
|
cflags: [
|
|
"-UNDEBUG",
|
|
"-Wall",
|
|
"-Werror",
|
|
],
|
|
shared_libs: [
|
|
"libandroid",
|
|
"liblog",
|
|
"libneuralnetworks",
|
|
],
|
|
static_libs: [
|
|
"libbase_ndk",
|
|
"libgmock_ndk",
|
|
"libgtest_ndk_c++",
|
|
],
|
|
sanitize: {
|
|
address: true,
|
|
all_undefined: true,
|
|
},
|
|
strip: {
|
|
keep_symbols: true,
|
|
},
|
|
sdk_version: "current",
|
|
stl: "libc++_static",
|
|
}
|
|
|
|
cc_test {
|
|
name: "NeuralNetworksSupportLibraryTest",
|
|
srcs: [
|
|
"GeneratedTestUtils.cpp",
|
|
"SupportLibraryTestGenerated.cpp",
|
|
"SupportLibraryTestMain.cpp",
|
|
],
|
|
cflags: [
|
|
"-DNNTEST_COMPUTE_MODE",
|
|
"-DNNTEST_ONLY_PUBLIC_API",
|
|
"-DNNTEST_SLTS",
|
|
"-DNN_COMPATIBILITY_LIBRARY_BUILD",
|
|
"-Wall",
|
|
"-Werror",
|
|
],
|
|
shared_libs: [
|
|
"libandroid",
|
|
"liblog",
|
|
],
|
|
static_libs: [
|
|
"libbase_ndk",
|
|
"libgmock_ndk",
|
|
"libgtest_ndk_c++",
|
|
"libneuralnetworks_generated_test_harness",
|
|
"neuralnetworks_supportlibrary_loader",
|
|
],
|
|
whole_static_libs: [
|
|
"neuralnetworks_generated_V1_0_example",
|
|
"neuralnetworks_generated_V1_1_example",
|
|
"neuralnetworks_generated_V1_2_example",
|
|
"neuralnetworks_generated_V1_3_cts_only_example",
|
|
"neuralnetworks_generated_V1_3_example",
|
|
],
|
|
include_dirs: [
|
|
"packages/modules/NeuralNetworks/runtime/include/",
|
|
"packages/modules/NeuralNetworks/tools/test_generator/test_harness/include",
|
|
],
|
|
test_suites: ["general-tests"],
|
|
}
|