Consolidate NNAPI VTS utility code
This CL does additional NNAPI VTS test cleanup, including consolidating
duplicate functionality. Specifically, this CL:
* consolidates the createPreparedModel function, removing the duplicate
* consolidates the std::out ErrorStatus and DeviceStatus code into Utils
* changes non-null constant pointers to constant references
* removes redudant leading namespace specifiers (V1_0::, ::testing, etc.)
* makes the Valdiation tests free functions
* renames device to kDevice and mTestModel to kTestModel
Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest (with sample-all)
Change-Id: Ic401bb1f1760cc10384ac0d30c0c93409b63a9c7
Merged-In: Ic401bb1f1760cc10384ac0d30c0c93409b63a9c7
(cherry picked from commit e16af0a44ba9b76667a598b10a085f808efb8c7c)
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.h b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.h
index a42f271..10e46b7 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.h
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.h
@@ -25,32 +25,20 @@
class GeneratedTestBase
: public NeuralnetworksHidlTest,
- public ::testing::WithParamInterface<test_helper::TestModelManager::TestParam> {
+ public testing::WithParamInterface<test_helper::TestModelManager::TestParam> {
protected:
- void SetUp() override {
- NeuralnetworksHidlTest::SetUp();
- ASSERT_NE(mTestModel, nullptr);
- }
-
- const test_helper::TestModel* mTestModel = GetParam().second;
+ const test_helper::TestModel& kTestModel = *GetParam().second;
};
-#define INSTANTIATE_GENERATED_TEST(TestSuite, filter) \
- INSTANTIATE_TEST_SUITE_P( \
- TestGenerated, TestSuite, \
- ::testing::ValuesIn(::test_helper::TestModelManager::get().getTestModels(filter)), \
+#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);
-};
+class ValidationTest : public GeneratedTestBase {};
Model createModel(const ::test_helper::TestModel& testModel);