Make VtsHalNeuralnetworksTargetTest run on the host
This change adds a host build of VtsHalNeuralnetworksTargetTest. In the
existing device build of VtsHalNeuralnetworksTargetTest, the drivers run
out-of-process. In the host build of VtsHalNeuralnetworkaTargetTest, the
driver runs in-process.
The in-process driver that runs on the host is the canonical sample
driver (which is just the CPU "driver", located in
packages/modules/NeuralNetworks/driver/sample) adapted to an AIDL
interface (by the adapter code in
hardware/interfaces/neuralnetworks/utils/adapter/aidl).
Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksTargetTest on host
Change-Id: Ia30dd3a7db8e0592b9f13d69c9831f8ffe10c371
diff --git a/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
index 77208aa..7451f7e 100644
--- a/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
@@ -23,7 +23,6 @@
#include <fcntl.h>
#include <ftw.h>
#include <gtest/gtest.h>
-#include <hidlmemory/mapping.h>
#include <unistd.h>
#include <cstdio>
@@ -34,7 +33,6 @@
#include "Callbacks.h"
#include "GeneratedTestHarness.h"
-#include "MemoryUtils.h"
#include "TestHarness.h"
#include "Utils.h"
#include "VtsHalNeuralnetworks.h"
@@ -229,7 +227,11 @@
// Create cache directory. The cache directory and a temporary cache file is always created
// to test the behavior of prepareModelFromCache, even when caching is not supported.
+#ifdef __ANDROID__
char cacheDirTemp[] = "/data/local/tmp/TestCompilationCachingXXXXXX";
+#else // __ANDROID__
+ char cacheDirTemp[] = "/tmp/TestCompilationCachingXXXXXX";
+#endif // __ANDROID__
char* cacheDir = mkdtemp(cacheDirTemp);
ASSERT_NE(cacheDir, nullptr);
mCacheDir = cacheDir;