Home | History | Annotate | Download | only in test
      1 /*
      2  * Copyright 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 cc_defaults {
     18     name: "NeuralNetworksTest_default_libs",
     19     defaults: ["neuralnetworks_defaults"],
     20     host_supported: false,
     21     // b/109953668, disable OpenMP
     22     // openmp: true,
     23     shared_libs: [
     24         "libandroid",
     25         "libbase",
     26         "libbinder",
     27         "libcutils",
     28         "libfmq",
     29         "libhidlbase",
     30         "libhidltransport",
     31         "libhidlmemory",
     32         "liblog",
     33         "libnativewindow",
     34         "libtextclassifier_hash",
     35         "libui",
     36         "libutils",
     37         "android.hardware.neuralnetworks (at) 1.0",
     38         "android.hardware.neuralnetworks (at) 1.1",
     39         "android.hardware.neuralnetworks (at) 1.2",
     40         "android.hidl.allocator (at) 1.0",
     41         "android.hidl.memory (at) 1.0",
     42     ],
     43     static_libs: [
     44         "libc++fs",
     45         "libcrypto",
     46     ],
     47     header_libs: [
     48         "libneuralnetworks_generated_test_harness_headers",
     49     ],
     50 }
     51 
     52 cc_defaults {
     53     name: "NeuralNetworksTest_defaults",
     54     defaults: ["NeuralNetworksTest_default_libs"],
     55     srcs: [
     56         "TestNeuralNetworksWrapper.cpp",
     57 
     58         // Subset of tests that rely only on public functionality.
     59         //
     60         // Changes to this list must be reflected in cts/tests/tests/neuralnetworks/Android.mk
     61         // to ensure CTS tests coverage.
     62         "generated/tests/*.cpp",
     63         "TestGenerated.cpp",
     64         "TestMemory.cpp",
     65         "TestOperandExtraParams.cpp",
     66         "TestTrivialModel.cpp",
     67         "TestUnknownDimensions.cpp",
     68         "TestUnspecifiedDimensions.cpp",
     69         "TestValidateModel.cpp",
     70         "TestValidateOperations.cpp",
     71         "TestValidation.cpp",
     72         "TestWrapper.cpp",
     73     ],
     74     static_libs: [
     75         "libgmock",
     76     ],
     77 }
     78 
     79 cc_test {
     80     name: "NeuralNetworksTest_shared_partial",
     81     defaults: ["NeuralNetworksTest_defaults"],
     82     srcs: [
     83         "TestMain.cpp",
     84     ],
     85     cflags: [
     86         "-DNNTEST_ONLY_PUBLIC_API"
     87     ],
     88     shared_libs: [
     89         "libneuralnetworks",
     90         "libtextclassifier_hash",
     91     ],
     92 }
     93 
     94 cc_defaults {
     95     name: "NeuralNetworksTest_static_defaults",
     96     defaults: ["NeuralNetworksTest_defaults"],
     97     srcs: [
     98         "TestMain.cpp",
     99 
    100         "Bridge.cpp",
    101         // Tests that rely on non-public functionality (i.e., symbols
    102         // not exported from libneuralnetworks.so).
    103         "TestCompilationCaching.cpp",
    104         "TestCompliance.cpp",
    105         "TestExecution.cpp",
    106         "TestMemoryInternal.cpp",
    107         // b/109953668, disable OpenMP
    108         // "TestOpenmpSettings.cpp",
    109         "TestPartitioning.cpp",
    110         "TestPartitioningRandom.cpp",
    111         "TestIntrospectionControl.cpp",
    112         "TestExtensions.cpp",
    113         "fibonacci_extension/FibonacciExtensionTest.cpp",
    114         "fibonacci_extension/FibonacciDriver.cpp",
    115     ],
    116     static_libs: [
    117         "libgmock",
    118         "libneuralnetworks",
    119         "libneuralnetworks_common",
    120         "libSampleDriver",
    121     ],
    122     shared_libs: [
    123         "libcutils",
    124     ],
    125     header_libs: [
    126         "libneuralnetworks_private_headers",
    127         "neuralnetworks_test_vendor_fibonacci_extension",
    128     ],
    129     test_suites: [
    130         "general-tests",
    131     ],
    132 }
    133 
    134 cc_test {
    135     name: "NeuralNetworksTest_static",
    136     defaults: ["NeuralNetworksTest_static_defaults"],
    137 }
    138 
    139 cc_test {
    140     name: "NeuralNetworksTest_static_fuzzing",
    141     defaults: ["NeuralNetworksTest_default_libs"],
    142     srcs: [
    143         "TestNeuralNetworksWrapper.cpp",
    144         "fuzzing/operation_signatures/*.cpp",
    145         "fuzzing/OperationManager.cpp",
    146         "fuzzing/RandomGraphGenerator.cpp",
    147         "fuzzing/RandomGraphGeneratorUtils.cpp",
    148         "fuzzing/RandomVariable.cpp",
    149         "fuzzing/TestRandomGraph.cpp",
    150     ],
    151     static_libs: [
    152         "libgmock",
    153         "libneuralnetworks",
    154         "libneuralnetworks_common",
    155         "libSampleDriver",
    156     ],
    157     header_libs: [
    158         "libneuralnetworks_private_headers",
    159     ],
    160 }
    161 
    162 cc_test {
    163     name: "NeuralNetworksTest_static_asan",
    164     defaults: ["NeuralNetworksTest_static_defaults"],
    165     sanitize: {
    166       address: true,
    167     },
    168     // Declare explicit library dependency for continuous builds
    169     target: {
    170         android_arm: {
    171             required: [
    172                 "libclang_rt.asan-arm-android",
    173             ],
    174         },
    175         android_arm64: {
    176             required: [
    177                 "libclang_rt.asan-aarch64-android",
    178             ],
    179         },
    180         android_x86: {
    181             required: [
    182                 "libclang_rt.asan-i686-android",
    183             ],
    184         },
    185         android_x86_64: {
    186             required: [
    187                 "libclang_rt.asan-x86_64-android",
    188             ],
    189         },
    190     },
    191 }
    192 
    193 cc_test {
    194     name: "NeuralNetworksTest_static_ubsan",
    195     defaults: ["NeuralNetworksTest_static_defaults"],
    196     sanitize: {
    197       undefined: true,
    198       all_undefined: true,
    199       diag: {
    200         undefined: true,
    201       },
    202     },
    203 }
    204 
    205 cc_defaults {
    206     name: "NeuralNetworksTest_mt_defaults",
    207     defaults: ["NeuralNetworksTest_default_libs"],
    208     srcs: [
    209         "TestNeuralNetworksWrapper.cpp",
    210         "TestMain.cpp",
    211         "generated/tests/*.cpp",
    212         "TestGenerated.cpp",
    213     ],
    214     cflags: [
    215         "-DNNTEST_MULTITHREADED"
    216     ],
    217     static_libs: [
    218         "libgmock",
    219         "libneuralnetworks",
    220         "libneuralnetworks_common",
    221         "libSampleDriver",
    222     ],
    223     shared_libs: [
    224         "libcutils",
    225     ],
    226     header_libs: [
    227         "libneuralnetworks_private_headers",
    228     ],
    229 }
    230 
    231 cc_test {
    232     name: "NeuralNetworksTest_mt_static",
    233     defaults: ["NeuralNetworksTest_mt_defaults"],
    234 }
    235 
    236 cc_test {
    237     // Note: tsan not supported on Android (yet)
    238     name: "NeuralNetworksTest_mt_static_asan",
    239     defaults: ["NeuralNetworksTest_mt_defaults"],
    240     sanitize: {
    241       address: true,
    242     },
    243 }
    244