From 121b6d6b543dc4afee4390b164ec291b65b5fac7 Mon Sep 17 00:00:00 2001 From: Matthew Sedam Date: Thu, 19 Jan 2023 19:04:53 +0000 Subject: [PATCH] Use GTEST_SKIP when a function is not supported on older HAL versions Bug: 258074235 Test: atest VtsAidlHalContextHubTargetTest Change-Id: Ibf25b63d4f5a6a822318a131ebfacbf2fb5d622c --- .../vts/VtsAidlHalContextHubTargetTest.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp index f7ff73d477..228a5698d1 100644 --- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp +++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp @@ -88,20 +88,20 @@ TEST_P(ContextHubAidl, TestEnableTestMode) { Status status = contextHub->setTestMode(true); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); } - - ASSERT_TRUE(status.isOk()); } TEST_P(ContextHubAidl, TestDisableTestMode) { Status status = contextHub->setTestMode(false); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); } - - ASSERT_TRUE(status.isOk()); } class EmptyContextHubCallback : public android::hardware::contexthub::BnContextHubCallback { @@ -186,11 +186,11 @@ TEST_P(ContextHubAidl, TestGetPreloadedNanoapps) { Status status = contextHub->getPreloadedNanoappIds(&preloadedNanoappIds); if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION || status.transactionError() == android::UNKNOWN_TRANSACTION) { - return; // not supported -> old API; or not implemented + GTEST_SKIP() << "Not supported -> old API; or not implemented"; + } else { + ASSERT_TRUE(status.isOk()); + ASSERT_FALSE(preloadedNanoappIds.empty()); } - - ASSERT_TRUE(status.isOk()); - ASSERT_FALSE(preloadedNanoappIds.empty()); } // Helper callback that puts the TransactionResult for the expectedTransactionId into a