From af9ac3b8a0b462f2c97a769d02e7ca4b048d6c16 Mon Sep 17 00:00:00 2001 From: Xusong Wang Date: Fri, 11 Sep 2020 10:47:03 -0700 Subject: [PATCH] Suppress gtest error for tests without any instance NNAPI VTS is parameterized by discovered devices. When there is no device available, the compilation caching and memory domain tests will not be instantiated, and will cause a gtest error. This patch suppresses the error by GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST macro. Bug: 168152007 Test: 1.2/1.3 VTS without NNAPI driver Change-Id: I715ae6f45df66e4a03c12b5d3f38bcc028a9ed7c --- neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp | 2 ++ neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp | 2 ++ neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp | 3 +++ 3 files changed, 7 insertions(+) diff --git a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp index 70bee35cf1..ede1600090 100644 --- a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp +++ b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp @@ -1209,6 +1209,7 @@ std::string printCompilationCachingTest( return gtestCompliantName(getName(namedDevice) + "_" + type); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompilationCachingTest); INSTANTIATE_TEST_SUITE_P(TestCompilationCaching, CompilationCachingTest, testing::Combine(kNamedDeviceChoices, kOperandTypeChoices), printCompilationCachingTest); @@ -1365,6 +1366,7 @@ std::string printCompilationCachingSecurityTest( return gtestCompliantName(getName(namedDevice) + "_" + type + "_" + std::to_string(seed)); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompilationCachingSecurityTest); INSTANTIATE_TEST_SUITE_P(TestCompilationCaching, CompilationCachingSecurityTest, testing::Combine(kNamedDeviceChoices, kOperandTypeChoices, testing::Range(0U, 10U)), diff --git a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp index 400349220e..edffa22cca 100644 --- a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp +++ b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp @@ -1200,6 +1200,7 @@ std::string printCompilationCachingTest( return gtestCompliantName(getName(namedDevice) + "_" + type); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompilationCachingTest); INSTANTIATE_TEST_SUITE_P(TestCompilationCaching, CompilationCachingTest, testing::Combine(kNamedDeviceChoices, kOperandTypeChoices), printCompilationCachingTest); @@ -1356,6 +1357,7 @@ std::string printCompilationCachingSecurityTest( return gtestCompliantName(getName(namedDevice) + "_" + type + "_" + std::to_string(seed)); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(CompilationCachingSecurityTest); INSTANTIATE_TEST_SUITE_P(TestCompilationCaching, CompilationCachingSecurityTest, testing::Combine(kNamedDeviceChoices, kOperandTypeChoices, testing::Range(0U, 10U)), diff --git a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp index 0c657e06c9..5facc5ee96 100644 --- a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp +++ b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp @@ -605,6 +605,7 @@ std::string printMemoryDomainAllocateTest( return gtestCompliantName(getName(namedDevice) + "_" + type); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemoryDomainAllocateTest); INSTANTIATE_TEST_SUITE_P(TestMemoryDomain, MemoryDomainAllocateTest, testing::Combine(kNamedDeviceChoices, kTestOperandTypeChoices), printMemoryDomainAllocateTest); @@ -829,6 +830,7 @@ std::string printMemoryDomainCopyTest( return gtestCompliantName(getName(namedDevice) + "_" + type); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemoryDomainCopyTest); INSTANTIATE_TEST_SUITE_P(TestMemoryDomain, MemoryDomainCopyTest, testing::Combine(kNamedDeviceChoices, kTestOperandTypeChoices), printMemoryDomainCopyTest); @@ -1195,6 +1197,7 @@ std::string printMemoryDomainExecutionTest( return gtestCompliantName(getName(namedDevice) + "_" + type + "_" + executorStr); } +GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemoryDomainExecutionTest); INSTANTIATE_TEST_SUITE_P(TestMemoryDomain, MemoryDomainExecutionTest, testing::Combine(kNamedDeviceChoices, kTestOperandTypeChoices, kExecutorChoices),