summaryrefslogtreecommitdiff
path: root/neuralnetworks/aidl/utils/test/DeviceTest.cpp
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2021-10-05 14:10:41 -0700
committerXusong Wang <xusongw@google.com>2022-01-18 10:51:29 -0800
commit11f30c81ef7d45fd97bf0dcc3f3ba2ae42689504 (patch)
tree251f0fb62aa0f9d55b4a0d121f41f73507261163 /neuralnetworks/aidl/utils/test/DeviceTest.cpp
parent018fc3cac8b2361ad28a97685f9449a99326c9cd (diff)
Reusable execution at HAL level -- HAL.
This CL modifies the canonical/AIDL adapter to use IExecution object if available. Bug: 202405342 Bug: 202431255 Test: NNT_static Test: CtsNNAPITestCases Test: VtsHalNeuralnetworksTargetTest Change-Id: I6aac3c57f97ac87a5ba3f78cfd843fcc403decff Merged-In: I6aac3c57f97ac87a5ba3f78cfd843fcc403decff (cherry picked from commit 7f5c7d293c2dad462dc9c0f1f1a160fb2c2c9a9b)
Diffstat (limited to 'neuralnetworks/aidl/utils/test/DeviceTest.cpp')
-rw-r--r--neuralnetworks/aidl/utils/test/DeviceTest.cpp27
1 files changed, 3 insertions, 24 deletions
diff --git a/neuralnetworks/aidl/utils/test/DeviceTest.cpp b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
index 0366e7dff0..fb13af8d9f 100644
--- a/neuralnetworks/aidl/utils/test/DeviceTest.cpp
+++ b/neuralnetworks/aidl/utils/test/DeviceTest.cpp
@@ -17,6 +17,7 @@
#include "MockBuffer.h"
#include "MockDevice.h"
#include "MockPreparedModel.h"
+#include "TestUtils.h"
#include <aidl/android/hardware/neuralnetworks/BnDevice.h>
#include <android/binder_auto_utils.h>
@@ -146,26 +147,7 @@ constexpr auto makeDeadObjectFailure = [] {
return ndk::ScopedAStatus::fromStatus(STATUS_DEAD_OBJECT);
};
-class DeviceTest : public ::testing::TestWithParam<nn::Version> {
- protected:
- const nn::Version kVersion = GetParam();
-};
-
-std::string printDeviceTest(const testing::TestParamInfo<nn::Version>& info) {
- const nn::Version version = info.param;
- CHECK(!version.runtimeOnlyFeatures);
- switch (version.level) {
- case nn::Version::Level::FEATURE_LEVEL_5:
- return "v1";
- case nn::Version::Level::FEATURE_LEVEL_6:
- return "v2";
- case nn::Version::Level::FEATURE_LEVEL_7:
- return "v3";
- default:
- LOG(FATAL) << "Invalid AIDL version: " << version;
- return "invalid";
- }
-}
+class DeviceTest : public VersionedAidlUtilsTestBase {};
} // namespace
@@ -894,9 +876,6 @@ TEST_P(DeviceTest, allocateDeadObject) {
EXPECT_EQ(result.error().code, nn::ErrorStatus::DEAD_OBJECT);
}
-INSTANTIATE_TEST_SUITE_P(TestDevice, DeviceTest,
- ::testing::Values(nn::kVersionFeatureLevel5, nn::kVersionFeatureLevel6,
- nn::kVersionFeatureLevel7),
- printDeviceTest);
+INSTANTIATE_VERSIONED_AIDL_UTILS_TEST(DeviceTest, kAllAidlVersions);
} // namespace aidl::android::hardware::neuralnetworks::utils