Update VTS tests with the new test harness.
Bug: 120601396
Test: All VTS
Change-Id: I539e75585b2cc01d153565814491361adfa048be
Merged-In: I539e75585b2cc01d153565814491361adfa048be
(cherry picked from commit 9e2b97b83cd3163750bebe55e6b55811ca8a6712)
diff --git a/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.h b/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.h
index 56fc825..82fc551 100644
--- a/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.h
+++ b/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.h
@@ -19,18 +19,48 @@
#include <android/hardware/neuralnetworks/1.1/IDevice.h>
#include "TestHarness.h"
+#include "VtsHalNeuralnetworks.h"
namespace android {
namespace hardware {
namespace neuralnetworks {
namespace V1_1 {
-namespace generated_tests {
+namespace vts {
+namespace functional {
+
+class GeneratedTestBase
+ : public NeuralnetworksHidlTest,
+ public ::testing::WithParamInterface<test_helper::TestModelManager::TestParam> {
+ protected:
+ void SetUp() override {
+ NeuralnetworksHidlTest::SetUp();
+ ASSERT_NE(mTestModel, nullptr);
+ }
+
+ const test_helper::TestModel* mTestModel = GetParam().second;
+};
+
+#define INSTANTIATE_GENERATED_TEST(TestSuite, filter) \
+ INSTANTIATE_TEST_SUITE_P( \
+ TestGenerated, TestSuite, \
+ ::testing::ValuesIn(::test_helper::TestModelManager::get().getTestModels(filter)), \
+ [](const auto& info) { return info.param.first; })
+
+// Tag for the validation tests, instantiated in VtsHalNeuralnetworks.cpp.
+// TODO: Clean up the hierarchy for ValidationTest.
+class ValidationTest : public GeneratedTestBase {
+ protected:
+ void validateEverything(const Model& model, const Request& request);
+
+ private:
+ void validateModel(const Model& model);
+ void validateRequest(const sp<IPreparedModel>& preparedModel, const Request& request);
+};
Model createModel(const ::test_helper::TestModel& testModel);
-void Execute(const sp<V1_1::IDevice>& device, const ::test_helper::TestModel& testModel);
-
-} // namespace generated_tests
+} // namespace functional
+} // namespace vts
} // namespace V1_1
} // namespace neuralnetworks
} // namespace hardware