summaryrefslogtreecommitdiff
path: root/nn/runtime/test/TestMain.cpp
diff options
context:
space:
mode:
authorJean-Luc Brouillet <jeanluc@google.com>2017-07-25 00:17:50 -0700
committerMiao Wang <miaowang@google.com>2017-07-25 17:05:44 -0700
commit707dbd2d55f5dacf78ffb3ad7c8b3f37c2e9d758 (patch)
tree97a6af8eee2cb11a7df0b6469ef450dd344800f1 /nn/runtime/test/TestMain.cpp
parent96775128e3bcfdc5be51b62edc50309c83861fe8 (diff)
downloadml-707dbd2d55f5dacf78ffb3ad7c8b3f37c2e9d758.tar.gz
Pass the model as an HIDL component.
Major rework where instead of serializing the model and passing it in a shared memory, we pass it via HIDL. The runtime/test code does two run, one goes through the default CPU path, the other through any available driver. Note: The code in hardware/../sample was written by Michael Buttler. Bug: 63905942 Test: Runs both the CPU path and through the sample driver. Change-Id: Ie3ee975d33056ba299895b13193f4698a690dd04
Diffstat (limited to 'nn/runtime/test/TestMain.cpp')
-rw-r--r--nn/runtime/test/TestMain.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/nn/runtime/test/TestMain.cpp b/nn/runtime/test/TestMain.cpp
index e4e14c0ee..34b8e7a84 100644
--- a/nn/runtime/test/TestMain.cpp
+++ b/nn/runtime/test/TestMain.cpp
@@ -16,7 +16,7 @@
#include "Manager.h"
#include "NeuralNetworksWrapper.h"
-#include "SampleDriver.h"
+//#include "SampleDriver.h"
#include "Utils.h"
#include <gtest/gtest.h>
@@ -26,18 +26,13 @@ using namespace android::nn::wrapper;
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
- // Test with the CPU default path
+ // Test with the installed drivers.
int n1 = RUN_ALL_TESTS();
- // Create our own driver to simulate testing through the HAL.
- // A real Android program would not do this.
+ // Test with the CPU driver only.
nnAssert(ANeuralNetworksInitialize() == ANEURALNETWORKS_NO_ERROR);
- std::shared_ptr<android::nn::SampleDriver> sampleDriver {new android::nn::SampleDriver()};
- android::nn::DriverManager::get()->registerDriver(sampleDriver);
-
- // Tests a second time.
+ android::nn::DeviceManager::get()->setUseCpuOnly(true);
int n2 = RUN_ALL_TESTS();
ANeuralNetworksShutdown();
-
- return n1 != 0 || n2 != 0;;
+ return n1 | n2;
}