diff options
author | Mika Raento <mikie@google.com> | 2018-05-10 09:37:54 +0100 |
---|---|---|
committer | Mika Raento <mikie@google.com> | 2018-05-10 09:37:54 +0100 |
commit | 8af4cd092bd233e920ac8203ba62da2234edebc9 (patch) | |
tree | cd1ba62d34b95d3c31033f67be591ebbedd9b4fb | |
parent | f1a4694344c8acf2b157724ddf7df6ce2d1ac7bb (diff) | |
download | ml-8af4cd092bd233e920ac8203ba62da2234edebc9.tar.gz |
Fix tests that are to only use public API to do so
Changes the test targets so that the "Subset of tests that rely only on
public functionality" both:
- includes only tests that use the public API
- does not allow using internal APIs (remove includes and libs)
In addition to making the targets consistent, this makes it easier to
keep the CTS tests in sync.
Bug: 72448000
Bug: 77234888
Test: CtsNNAPITestCases
Change-Id: I799d7236c1f8107621efdd80036afc1bb901e024
-rw-r--r-- | nn/runtime/test/Android.bp | 21 | ||||
-rw-r--r-- | nn/runtime/test/TestMain.cpp | 7 |
2 files changed, 16 insertions, 12 deletions
diff --git a/nn/runtime/test/Android.bp b/nn/runtime/test/Android.bp index bada2f41f..deb240b06 100644 --- a/nn/runtime/test/Android.bp +++ b/nn/runtime/test/Android.bp @@ -21,10 +21,11 @@ cc_defaults { openmp: true, srcs: [ // Subset of tests that rely only on public functionality. - "Bridge.cpp", + // + // Changes to this list must be reflected in cts/tests/tests/neuralnetworks/Android.mk + // to ensure CTS tests coverage. "TestGenerated.cpp", "TestMemory.cpp", - "TestMemoryInternal.cpp", "TestTrivialModel.cpp", "TestUnknownDimensions.cpp", "TestValidateOperations.cpp", @@ -45,12 +46,7 @@ cc_defaults { "android.hidl.allocator@1.0", "android.hidl.memory@1.0", ], - static_libs: [ - "libneuralnetworks_common", - "libSampleDriver", - ], header_libs: [ - "libneuralnetworks_private_headers", "libneuralnetworks_generated_test_harness_headers", ], } @@ -68,9 +64,6 @@ cc_test { "libneuralnetworks", "libtextclassifier_hash", ], - static_libs: [ - "libneuralnetworks_common", - ], } cc_test { @@ -79,17 +72,23 @@ cc_test { srcs: [ "TestMain.cpp", + "Bridge.cpp", // Tests that rely on non-public functionality (i.e., symbols // not exported from libneuralnetworks.so). "TestExecution.cpp", + "TestMemoryInternal.cpp", "TestPartitioning.cpp", "TestPartitioningRandom.cpp", ], static_libs: [ "libneuralnetworks", "libneuralnetworks_common", + "libSampleDriver", ], shared_libs: [ "libcutils", - ] + ], + header_libs: [ + "libneuralnetworks_private_headers", + ], } diff --git a/nn/runtime/test/TestMain.cpp b/nn/runtime/test/TestMain.cpp index 7409c9376..01c733d20 100644 --- a/nn/runtime/test/TestMain.cpp +++ b/nn/runtime/test/TestMain.cpp @@ -14,9 +14,12 @@ * limitations under the License. */ -#include "Manager.h" #include "NeuralNetworksWrapper.h" + +#ifndef NNTEST_ONLY_PUBLIC_API +#include "Manager.h" #include "Utils.h" +#endif #include <gtest/gtest.h> @@ -25,7 +28,9 @@ using namespace android::nn::wrapper; int main(int argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); +#ifndef NNTEST_ONLY_PUBLIC_API android::nn::initVLogMask(); +#endif // Test with the installed drivers. int n1 = RUN_ALL_TESTS(); #ifdef NNTEST_ONLY_PUBLIC_API |