From 4609857ee4313961df3eaf5ccd6850a2a2cdd288 Mon Sep 17 00:00:00 2001 From: Manisha Jajoo Date: Thu, 21 Jun 2018 14:05:31 +0530 Subject: [PATCH 1/7] omx:component: add support for tunneled components in ComponentTest Test: make vts -j99 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 \ && vts-tradefed run commandAndExit vts \ --skip-all-system-status-check --primary-abi-only \ --skip-preconditions --module VtsHalMediaOmxV1_0Host \ -l INFO bug: 70933963 Change-Id: I5695820b225041f5b764506cdafacf7c95d836aa --- .../common/media_hidl_test_common.cpp | 38 +++++++++++++++---- .../VtsHalMediaOmxV1_0TargetComponentTest.cpp | 20 +++++++++- .../VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | 10 +++++ 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp index 34a96a0ce7..29be2a09b3 100644 --- a/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp +++ b/media/omx/1.0/vts/functional/common/media_hidl_test_common.cpp @@ -387,17 +387,28 @@ void changeStateLoadedtoIdle(sp omxNode, sp observer, OMX_StateIdle); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); + OMX_PARAM_PORTDEFINITIONTYPE portDefInput; + OMX_PARAM_PORTDEFINITIONTYPE portDefOutput; + status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexInput, &portDefInput); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexOutput, &portDefOutput); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + // Dont switch states until the ports are populated - status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); - ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + if (portDefInput.nBufferCountActual || portDefOutput.nBufferCountActual) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); + ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + } // allocate buffers on input port ASSERT_NO_FATAL_FAILURE(allocatePortBuffers( omxNode, iBuffer, kPortIndexInput, pm[0], allocGrap)); // Dont switch states until the ports are populated - status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); - ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + if (portDefOutput.nBufferCountActual) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); + ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + } // allocate buffers on output port ASSERT_NO_FATAL_FAILURE(allocatePortBuffers( @@ -430,9 +441,18 @@ void changeStateIdletoLoaded(sp omxNode, sp observer, OMX_StateLoaded); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); + OMX_PARAM_PORTDEFINITIONTYPE portDefInput; + OMX_PARAM_PORTDEFINITIONTYPE portDefOutput; + status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexInput, &portDefInput); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + status = getPortParam(omxNode, OMX_IndexParamPortDefinition, kPortIndexOutput, &portDefOutput); + EXPECT_EQ(status, ::android::hardware::media::omx::V1_0::Status::OK); + // dont change state until all buffers are freed - status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); - ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + if (portDefInput.nBufferCountActual || portDefOutput.nBufferCountActual) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); + ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + } for (size_t i = 0; i < iBuffer->size(); ++i) { status = omxNode->freeBuffer(kPortIndexInput, (*iBuffer)[i].id); @@ -440,8 +460,10 @@ void changeStateIdletoLoaded(sp omxNode, sp observer, } // dont change state until all buffers are freed - status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); - ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + if (portDefOutput.nBufferCountActual) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, iBuffer, oBuffer); + ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::TIMED_OUT); + } for (size_t i = 0; i < oBuffer->size(); ++i) { status = omxNode->freeBuffer(kPortIndexOutput, (*oBuffer)[i].id); diff --git a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp index 7750a12fac..2223583740 100644 --- a/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp +++ b/media/omx/1.0/vts/functional/component/VtsHalMediaOmxV1_0TargetComponentTest.cpp @@ -115,6 +115,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase { } if (compClass == unknown_class) disableTest = true; isSecure = false; + mTunnel = false; size_t suffixLen = strlen(".secure"); if (strlen(gEnv->getComponent().c_str()) >= suffixLen) { isSecure = @@ -122,6 +123,18 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase { strlen(gEnv->getComponent().c_str()) - suffixLen, ".secure"); } + if (compClass == video_decoder) { + omxNode->configureVideoTunnelMode( + 1, OMX_TRUE, 0, + [&](android::hardware::media::omx::V1_0::Status _s, + const ::android::hardware::hidl_handle& sidebandHandle) { + (void)sidebandHandle; + if (_s == android::hardware::media::omx::V1_0::Status::OK) + this->mTunnel = true; + }); + } + // NOTES: secure components are not covered in these tests. + // we are disabling tests for them if (disableTest) std::cout << "[ WARN ] Test Disabled \n"; } @@ -149,6 +162,7 @@ class ComponentHidlTest : public ::testing::VtsHalHidlTargetTestBase { sp observer; sp omxNode; standardCompClass compClass; + bool mTunnel; bool isSecure; bool disableTest; @@ -991,7 +1005,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Idle) { ASSERT_NO_FATAL_FAILURE( changeStateLoadedtoIdle(omxNode, observer, &pBuffer[0], &pBuffer[1], kPortIndexInput, kPortIndexOutput, portMode)); - for (size_t i = portBase; i < portBase + 2; i++) { + int range = mTunnel ? 1 : 2; + for (size_t i = portBase; i < portBase + range; i++) { status = omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); @@ -1104,7 +1119,8 @@ TEST_F(ComponentHidlTest, PortEnableDisable_Execute) { dispatchOutputBuffer(omxNode, &pBuffer[1], i, portMode[1])); } - for (size_t i = portBase; i < portBase + 2; i++) { + int range = mTunnel ? 1 : 2; + for (size_t i = portBase; i < portBase + range; i++) { status = omxNode->sendCommand(toRawCommandType(OMX_CommandPortDisable), i); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 1db9f7531a..df048c6bf2 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp @@ -153,7 +153,17 @@ class VideoDecHidlTest : public ::testing::VtsHalHidlTargetTestBase { ".secure"); } if (isSecure) disableTest = true; + omxNode->configureVideoTunnelMode( + 1, OMX_TRUE, 0, + [&](android::hardware::media::omx::V1_0::Status _s, + const ::android::hardware::hidl_handle& sidebandHandle) { + (void)sidebandHandle; + if (_s == android::hardware::media::omx::V1_0::Status::OK) + this->disableTest = true; + }); if (disableTest) std::cout << "[ WARN ] Test Disabled \n"; + // NOTES: secure and tunneled components are not covered in these tests. + // we are disabling tests for them } virtual void TearDown() override { From b8524954e6c0ac4dae2083c8778426a406cdc1fe Mon Sep 17 00:00:00 2001 From: Emil Jahshan Date: Sun, 27 Jan 2019 11:56:25 +0200 Subject: [PATCH 2/7] VTS tests to work with depth Y16 modified VTS tests functions to work with the Y16 format with the correct dataspace. Y16 changes are in this patch: 847192 Test: ran and tested on intel depth camera D415 and a regular RGB camera Change-Id: Ie40347d58d4f72ed2fc9676bdaab2d1dca5dc5bc Signed-off-by: Emil Jahshan --- .../VtsHalCameraProviderV2_4TargetTest.cpp | 129 +++++++++++++++--- 1 file changed, 109 insertions(+), 20 deletions(-) diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp index 22b738256d..2a464d58fb 100644 --- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp +++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp @@ -671,6 +671,7 @@ public: HalStreamConfiguration *halStreamConfig /*out*/, bool *supportsPartialResults /*out*/, uint32_t *partialResultCount /*out*/); + bool isDepthOnly(camera_metadata_t* staticMeta); static Status getAvailableOutputStreams(camera_metadata_t *staticMeta, std::vector &outputStreams, const AvailableStream *threshold = nullptr); @@ -682,6 +683,10 @@ public: std::unordered_set *physicalIds/*out*/); static Status getSupportedKeys(camera_metadata_t *staticMeta, uint32_t tagId, std::unordered_set *requestIDs/*out*/); + static void fillOutputStreams(camera_metadata_ro_entry_t* entry, + std::vector& outputStreams, + const AvailableStream *threshold = nullptr, + const int32_t availableConfigOutputTag = 0u); static void constructFilteredSettings(const sp& session, const std::unordered_set& availableKeys, RequestTemplate reqTemplate, android::hardware::camera::common::V1_0::helper::CameraMetadata* defaultSettings/*out*/, @@ -2521,14 +2526,24 @@ TEST_F(CameraHidlTest, configureStreamsAvailableOutputs) { int32_t streamId = 0; for (auto& it : outputStreams) { V3_2::Stream stream3_2; - bool isJpeg = static_cast(it.format) == PixelFormat::BLOB; + V3_2::DataspaceFlags dataspaceFlag = 0; + switch (static_cast(it.format)) { + case PixelFormat::BLOB: + dataspaceFlag = static_cast(Dataspace::V0_JFIF); + break; + case PixelFormat::Y16: + dataspaceFlag = static_cast(Dataspace::DEPTH); + break; + default: + dataspaceFlag = static_cast(Dataspace::UNKNOWN); + } stream3_2 = {streamId, StreamType::OUTPUT, static_cast(it.width), static_cast(it.height), static_cast(it.format), GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, - (isJpeg) ? static_cast(Dataspace::V0_JFIF) : 0, + dataspaceFlag, StreamRotation::ROTATION_0}; ::android::hardware::hidl_vec streams3_2 = {stream3_2}; ::android::hardware::camera::device::V3_4::StreamConfiguration config3_4; @@ -2962,6 +2977,14 @@ TEST_F(CameraHidlTest, configureStreamsPreviewStillOutputs) { openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/); castSession(session, deviceVersion, &session3_3, &session3_4); + // Check if camera support depth only + if (isDepthOnly(staticMeta)) { + free_camera_metadata(staticMeta); + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + continue; + } + outputBlobStreams.clear(); ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputBlobStreams, @@ -3230,6 +3253,14 @@ TEST_F(CameraHidlTest, configureStreamsVideoStillOutputs) { openEmptyDeviceSession(name, mProvider, &session /*out*/, &staticMeta /*out*/); castSession(session, deviceVersion, &session3_3, &session3_4); + // Check if camera support depth only + if (isDepthOnly(staticMeta)) { + free_camera_metadata(staticMeta); + ret = session->close(); + ASSERT_TRUE(ret.isOk()); + continue; + } + outputBlobStreams.clear(); ASSERT_EQ(Status::OK, getAvailableOutputStreams(staticMeta, outputBlobStreams, @@ -4135,38 +4166,56 @@ TEST_F(CameraHidlTest, flushEmpty) { Status CameraHidlTest::getAvailableOutputStreams(camera_metadata_t *staticMeta, std::vector &outputStreams, const AvailableStream *threshold) { + AvailableStream depthPreviewThreshold = {kMaxPreviewWidth, kMaxPreviewHeight, + static_cast(PixelFormat::Y16)}; if (nullptr == staticMeta) { return Status::ILLEGAL_ARGUMENT; } - camera_metadata_ro_entry entry; - int rc = find_camera_metadata_ro_entry(staticMeta, - ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, &entry); - if ((0 != rc) || (0 != (entry.count % 4))) { + camera_metadata_ro_entry scalarEntry; + camera_metadata_ro_entry depthEntry; + int foundScalar = find_camera_metadata_ro_entry(staticMeta, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS, &scalarEntry); + int foundDepth = find_camera_metadata_ro_entry(staticMeta, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, &depthEntry); + if ((0 != foundScalar || (0 != (scalarEntry.count % 4))) && + (0 != foundDepth || (0 != (depthEntry.count % 4)))) { return Status::ILLEGAL_ARGUMENT; } - for (size_t i = 0; i < entry.count; i+=4) { - if (ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT == - entry.data.i32[i + 3]) { + if(foundScalar == 0 && (0 == (scalarEntry.count % 4))) { + fillOutputStreams(&scalarEntry, outputStreams, threshold, + ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT); + } + + if(foundDepth == 0 && (0 == (depthEntry.count % 4))) { + fillOutputStreams(&depthEntry, outputStreams, &depthPreviewThreshold, + ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS_OUTPUT); + } + + return Status::OK; +} + +void CameraHidlTest::fillOutputStreams(camera_metadata_ro_entry_t* entry, + std::vector& outputStreams, const AvailableStream* threshold, + const int32_t availableConfigOutputTag) { + for (size_t i = 0; i < entry->count; i+=4) { + if (availableConfigOutputTag == entry->data.i32[i + 3]) { if(nullptr == threshold) { - AvailableStream s = {entry.data.i32[i+1], - entry.data.i32[i+2], entry.data.i32[i]}; + AvailableStream s = {entry->data.i32[i+1], + entry->data.i32[i+2], entry->data.i32[i]}; outputStreams.push_back(s); } else { - if ((threshold->format == entry.data.i32[i]) && - (threshold->width >= entry.data.i32[i+1]) && - (threshold->height >= entry.data.i32[i+2])) { - AvailableStream s = {entry.data.i32[i+1], - entry.data.i32[i+2], threshold->format}; + if ((threshold->format == entry->data.i32[i]) && + (threshold->width >= entry->data.i32[i+1]) && + (threshold->height >= entry->data.i32[i+2])) { + AvailableStream s = {entry->data.i32[i+1], + entry->data.i32[i+2], threshold->format}; outputStreams.push_back(s); } } } - } - - return Status::OK; } // Get max jpeg buffer size in android.jpeg.maxSize @@ -4563,6 +4612,37 @@ void CameraHidlTest::configurePreviewStreams3_4(const std::string &name, int32_t ASSERT_TRUE(ret.isOk()); } +bool CameraHidlTest::isDepthOnly(camera_metadata_t* staticMeta) { + camera_metadata_ro_entry scalarEntry; + camera_metadata_ro_entry depthEntry; + + int rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &scalarEntry); + if (rc == 0) { + for (uint32_t i = 0; i < scalarEntry.count; i++) { + if (scalarEntry.data.u8[i] == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE) { + return false; + } + } + } + + for (uint32_t i = 0; i < scalarEntry.count; i++) { + if (scalarEntry.data.u8[i] == ANDROID_REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) { + + rc = find_camera_metadata_ro_entry( + staticMeta, ANDROID_DEPTH_AVAILABLE_DEPTH_STREAM_CONFIGURATIONS, &depthEntry); + size_t i = 0; + if (rc == 0 && depthEntry.data.i32[i] == static_cast(PixelFormat::Y16)) { + // only Depth16 format is supported now + return true; + } + break; + } + } + + return false; +} + // Open a device session and configure a preview stream. void CameraHidlTest::configurePreviewStream(const std::string &name, int32_t deviceVersion, sp provider, @@ -4638,11 +4718,20 @@ void CameraHidlTest::configurePreviewStream(const std::string &name, int32_t dev ASSERT_EQ(Status::OK, rc); ASSERT_FALSE(outputPreviewStreams.empty()); + V3_2::DataspaceFlags dataspaceFlag = 0; + switch (static_cast(outputPreviewStreams[0].format)) { + case PixelFormat::Y16: + dataspaceFlag = static_cast(Dataspace::DEPTH); + break; + default: + dataspaceFlag = static_cast(Dataspace::UNKNOWN); + } + V3_2::Stream stream3_2 = {0, StreamType::OUTPUT, static_cast (outputPreviewStreams[0].width), static_cast (outputPreviewStreams[0].height), static_cast (outputPreviewStreams[0].format), - GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, 0, StreamRotation::ROTATION_0}; + GRALLOC1_CONSUMER_USAGE_HWCOMPOSER, dataspaceFlag, StreamRotation::ROTATION_0}; ::android::hardware::hidl_vec streams3_2 = {stream3_2}; ::android::hardware::camera::device::V3_2::StreamConfiguration config3_2; ::android::hardware::camera::device::V3_4::StreamConfiguration config3_4; From 0d48dc81d08c2f6947537490c258c84d72cd3621 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 7 Mar 2019 13:04:33 -0800 Subject: [PATCH 3/7] health: skip VTS on healthd if vendor HAL is present. If vendor HAL is present, healthd is not used by the framework. VTS should skip testing it when this is the case. Provide a --force option to the test if one wants to test healthd. Fixes: 118852225 Test: on walleye, test healthd with and without --force. Change-Id: I85f792f25406b1c02887a0ac273730e719003e2f Merged-In: I85f792f25406b1c02887a0ac273730e719003e2f (cherry picked from commit e6807ddec17da45161b5f20396776a0ba38b3680) --- health/2.0/vts/functional/Android.bp | 1 + .../vts/functional/VtsHalHealthV2_0TargetTest.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/health/2.0/vts/functional/Android.bp b/health/2.0/vts/functional/Android.bp index 4ad01b98db..c4f2dc9e3a 100644 --- a/health/2.0/vts/functional/Android.bp +++ b/health/2.0/vts/functional/Android.bp @@ -19,6 +19,7 @@ cc_test { defaults: ["VtsHalTargetTestDefaults"], srcs: ["VtsHalHealthV2_0TargetTest.cpp"], static_libs: [ + "libgflags", "android.hardware.health@1.0", "android.hardware.health@2.0", ], diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp index c5431e45c2..55b48b86ff 100644 --- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp @@ -22,6 +22,7 @@ #include #include #include +#include using ::testing::AssertionFailure; using ::testing::AssertionResult; @@ -29,6 +30,8 @@ using ::testing::AssertionSuccess; using ::testing::VtsHalHidlTargetTestBase; using ::testing::VtsHalHidlTargetTestEnvBase; +DEFINE_bool(force, false, "Force test healthd even when the default instance is present."); + namespace android { namespace hardware { namespace health { @@ -57,6 +60,14 @@ class HealthHidlTest : public ::testing::VtsHalHidlTargetTestBase { public: virtual void SetUp() override { std::string serviceName = HealthHidlEnvironment::Instance()->getServiceName(); + + if (serviceName == "backup" && !FLAGS_force && + ::testing::VtsHalHidlTargetTestBase::getService() != nullptr) { + LOG(INFO) << "Skipping tests on healthd because the default instance is present. " + << "Use --force if you really want to test healthd."; + GTEST_SKIP(); + } + LOG(INFO) << "get service with name:" << serviceName; ASSERT_FALSE(serviceName.empty()); mHealth = ::testing::VtsHalHidlTargetTestBase::getService(serviceName); @@ -269,6 +280,7 @@ int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(HealthHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); HealthHidlEnvironment::Instance()->init(&argc, argv); + gflags::ParseCommandLineFlags(&argc, &argv, true /* remove flags */); int status = RUN_ALL_TESTS(); LOG(INFO) << "Test result = " << status; return status; From 68c09adf4c387650dadf3419334dc8db9da008ce Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 8 Mar 2019 11:37:33 -0800 Subject: [PATCH 4/7] health vts: implement GTEST_SKIP if not defined. gtest in Android P tree does not have GTEST_SKIP. Implement a naive version of it. Bug: 118852225 Test: manually undefine GTEST_SKIP, test with and without --force Change-Id: I8df1154d8a94a67ae28e8024de6022fcfe76384d Merged-In: I8df1154d8a94a67ae28e8024de6022fcfe76384d (cherry picked from commit 03b2a3477b9c39403a8cc641e0d7ef2d092eff66) --- .../functional/VtsHalHealthV2_0TargetTest.cpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp index 55b48b86ff..7bb47fdd1f 100644 --- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp @@ -17,6 +17,8 @@ #define LOG_TAG "health_hidl_hal_test" #include +#include +#include #include #include @@ -32,6 +34,39 @@ using ::testing::VtsHalHidlTargetTestEnvBase; DEFINE_bool(force, false, "Force test healthd even when the default instance is present."); +// If GTEST_SKIP is not implemented, use our own skipping mechanism +#ifndef GTEST_SKIP +static std::mutex gSkippedTestsMutex; +static std::set gSkippedTests; +static std::string GetCurrentTestName() { + const auto& info = ::testing::UnitTest::GetInstance()->current_test_info(); +#ifdef GTEST_REMOVE_LEGACY_TEST_CASEAPI_ + std::string test_suite = info->test_suite_name(); +#else + std::string test_suite = info->test_case_name(); +#endif + return test_suite + "." + info->name(); +} + +#define GTEST_SKIP() \ + do { \ + std::unique_lock lock(gSkippedTestsMutex); \ + gSkippedTests.insert(GetCurrentTestName()); \ + return; \ + } while (0) + +#define SKIP_IF_SKIPPED() \ + do { \ + std::unique_lock lock(gSkippedTestsMutex); \ + if (gSkippedTests.find(GetCurrentTestName()) != gSkippedTests.end()) { \ + std::cerr << "[ SKIPPED ] " << GetCurrentTestName() << std::endl; \ + return; \ + } \ + } while (0) +#else +#define SKIP_IF_SKIPPED() +#endif + namespace android { namespace hardware { namespace health { @@ -122,6 +157,7 @@ AssertionResult isAllOk(const Return& r) { * unregisterCallback, and update. */ TEST_F(HealthHidlTest, Callbacks) { + SKIP_IF_SKIPPED(); using namespace std::chrono_literals; sp firstCallback = new Callback(); sp secondCallback = new Callback(); @@ -158,6 +194,7 @@ TEST_F(HealthHidlTest, Callbacks) { } TEST_F(HealthHidlTest, UnregisterNonExistentCallback) { + SKIP_IF_SKIPPED(); sp callback = new Callback(); auto ret = mHealth->unregisterCallback(callback); ASSERT_OK(ret); @@ -239,6 +276,7 @@ bool verifyHealthInfo(const HealthInfo& health_info) { * interface IHealth. */ TEST_F(HealthHidlTest, Properties) { + SKIP_IF_SKIPPED(); EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) { EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0); })); From b2aa43ae94961c15f392a06b247c1d2f36a88581 Mon Sep 17 00:00:00 2001 From: sqian Date: Thu, 7 Mar 2019 20:58:17 -0800 Subject: [PATCH 5/7] Sleep one second after connect. Modem side need time for connect to finish. Test: Sanity (encountered by partner) Bug: 122442056 Change-Id: Ib688b968730fcf604ef3807db9b6bd817594cad6 --- radio/1.0/vts/functional/sap_hidl_hal_api.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp index da78f410d1..1d79ff61a0 100644 --- a/radio/1.0/vts/functional/sap_hidl_hal_api.cpp +++ b/radio/1.0/vts/functional/sap_hidl_hal_api.cpp @@ -26,6 +26,10 @@ TEST_F(SapHidlTest, connectReq) { sap->connectReq(token, maxMsgSize); EXPECT_EQ(std::cv_status::no_timeout, wait()); EXPECT_EQ(sapCb->sapResponseToken, token); + + // Modem side need time for connect to finish. Adding a waiting time to prevent + // disconnect being requested right after connect request. + sleep(1); } /* From f638d0a43a42a30ed59b512d115eb2dc7c93b038 Mon Sep 17 00:00:00 2001 From: Roshan Pius Date: Tue, 21 Aug 2018 14:05:21 -0700 Subject: [PATCH 6/7] wifi(vts): Don't enforce interface combination in VTS tests Devices are allowed to expose multiple AP or STA interfaces, fix the VTS tests to allow this. Bug: 112123615 Test: Compiles Change-Id: I6cf60b3cb0429ca78fe5a54d9e42ba144d7609e9 --- .../vts/functional/wifi_chip_hidl_test.cpp | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp index d16f1e7777..14d592707f 100644 --- a/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp +++ b/wifi/1.0/vts/functional/wifi_chip_hidl_test.cpp @@ -348,8 +348,8 @@ TEST_F(WifiChipHidlTest, GetDebugHostWakeReasonStats) { /* * CreateApIface - * Configures the chip in AP mode and ensures that only 1 iface creation - * succeeds. The 2nd iface creation should be rejected. + * Configures the chip in AP mode and ensures that at least 1 iface creation + * succeeds. */ TEST_F(WifiChipHidlTest, CreateApIface) { configureChipForIfaceType(IfaceType::AP, true); @@ -357,8 +357,6 @@ TEST_F(WifiChipHidlTest, CreateApIface) { sp iface; EXPECT_EQ(WifiStatusCode::SUCCESS, createApIface(&iface)); EXPECT_NE(nullptr, iface.get()); - - EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createApIface(&iface)); } /* @@ -443,8 +441,8 @@ TEST_F(WifiChipHidlTest, RemoveApIface) { /* * CreateNanIface - * Configures the chip in NAN mode and ensures that only 1 iface creation - * succeeds. The 2nd iface creation should be rejected. + * Configures the chip in NAN mode and ensures that at least 1 iface creation + * succeeds. */ TEST_F(WifiChipHidlTest, CreateNanIface) { if (!gEnv->isNanOn) return; @@ -453,8 +451,6 @@ TEST_F(WifiChipHidlTest, CreateNanIface) { sp iface; ASSERT_EQ(WifiStatusCode::SUCCESS, createNanIface(&iface)); EXPECT_NE(nullptr, iface.get()); - - EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createNanIface(&iface)); } /* @@ -543,8 +539,8 @@ TEST_F(WifiChipHidlTest, RemoveNanIface) { /* * CreateP2pIface - * Configures the chip in P2P mode and ensures that only 1 iface creation - * succeeds. The 2nd iface creation should be rejected. + * Configures the chip in P2P mode and ensures that at least 1 iface creation + * succeeds. */ TEST_F(WifiChipHidlTest, CreateP2pIface) { configureChipForIfaceType(IfaceType::P2P, true); @@ -552,8 +548,6 @@ TEST_F(WifiChipHidlTest, CreateP2pIface) { sp iface; EXPECT_EQ(WifiStatusCode::SUCCESS, createP2pIface(&iface)); EXPECT_NE(nullptr, iface.get()); - - EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createP2pIface(&iface)); } /* @@ -638,8 +632,8 @@ TEST_F(WifiChipHidlTest, RemoveP2pIface) { /* * CreateStaIface - * Configures the chip in STA mode and ensures that only 1 iface creation - * succeeds. The 2nd iface creation should be rejected. + * Configures the chip in STA mode and ensures that at least 1 iface creation + * succeeds. */ TEST_F(WifiChipHidlTest, CreateStaIface) { configureChipForIfaceType(IfaceType::STA, true); @@ -647,8 +641,6 @@ TEST_F(WifiChipHidlTest, CreateStaIface) { sp iface; EXPECT_EQ(WifiStatusCode::SUCCESS, createStaIface(&iface)); EXPECT_NE(nullptr, iface.get()); - - EXPECT_EQ(WifiStatusCode::ERROR_NOT_AVAILABLE, createStaIface(&iface)); } /* From eb73bff276e0a3cb92a7cd9ea333709ecc1c7295 Mon Sep 17 00:00:00 2001 From: "hayun.kim" Date: Mon, 1 Apr 2019 18:46:20 +0900 Subject: [PATCH 7/7] Fix VtsHalWifiV1_0Host#WifiStaIfaceHidlTest.SetScanningMacOui fail 1. snip the VtsHalWifiV1_0Host#WifiStaIfaceHidlTest.SetScanningMacOui test if SCAN_RAND capability is not supported on dut device Test: execute VtsHalWifiV1_0TargetTest of VTS test Bug: 129735587 Change-Id: I825e1df11c958b3b2476880c6c6f7b8ee7b292bf Signed-off-by: hayun Kim --- wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp b/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp index a3410287eb..3ced328c05 100644 --- a/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp +++ b/wifi/1.0/vts/functional/wifi_sta_iface_hidl_test.cpp @@ -249,6 +249,11 @@ TEST_F(WifiStaIfaceHidlTest, EnableNDOffload) { * code. */ TEST_F(WifiStaIfaceHidlTest, SetScanningMacOui) { + if (!isCapabilitySupported( + IWifiStaIface::StaIfaceCapabilityMask::SCAN_RAND)) { + // No-op if SetScanningMacOui is not supported. + return; + } const android::hardware::hidl_array kOui{ std::array{{0x10, 0x22, 0x33}}}; EXPECT_EQ(WifiStatusCode::SUCCESS,