summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvichal Rakesh <arakesh@google.com>2022-03-09 01:00:34 +0000
committerAvichal Rakesh <arakesh@google.com>2022-03-09 21:55:24 +0000
commitfbcf7ea5143a51059fadbf74e56508c6dd095a67 (patch)
treed782f9f102e91cba0ae98e18d17a1edd2a5277ed
parent2bb879d8bb843a33171c32e058587c41355f27ac (diff)
Camera: Misc VTS test fixes
This CL fixes two tests: * `systemCameraTest`: Fix incorrect vector initialization. The test was accidentally using the size constructor instead of initialization list constructor. * `processMultiCaptureRequestPreview`: Allow unsupported stream configs. The test assumed that all stream combinations from physical cameras that back a LogicalMultiCamera were supported. This led to false test failures. This CL allows the test to exit early if the HAL reports that a stream combination is not supported. Bug: 222648486 Test: `test VtsAidlHalCameraProvider_TargetTest` pass on failing devices Change-Id: I009cc2f4b8b94a26b813883cdc1403ae0eb5c477
-rw-r--r--camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp19
-rw-r--r--camera/provider/aidl/vts/camera_aidl_test.cpp11
-rw-r--r--camera/provider/aidl/vts/camera_aidl_test.h3
3 files changed, 25 insertions, 8 deletions
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index d1fa94e5e3..463f5d186a 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -163,7 +163,7 @@ TEST_P(CameraAidlTest, systemCameraTest) {
std::map<std::string, std::vector<SystemCameraKind>> hiddenPhysicalIdToLogicalMap;
for (const auto& name : cameraDeviceNames) {
std::shared_ptr<ICameraDevice> device;
- ALOGI("getCameraCharacteristics: Testing camera device %s", name.c_str());
+ ALOGI("systemCameraTest: Testing camera device %s", name.c_str());
ndk::ScopedAStatus ret = mProvider->getCameraDeviceInterface(name, &device);
ASSERT_TRUE(ret.isOk());
ASSERT_NE(device, nullptr);
@@ -196,13 +196,14 @@ TEST_P(CameraAidlTest, systemCameraTest) {
break;
}
}
+
// For hidden physical cameras, collect their associated logical cameras
// and store the system camera kind.
if (!isPublicId) {
auto it = hiddenPhysicalIdToLogicalMap.find(physicalId);
if (it == hiddenPhysicalIdToLogicalMap.end()) {
hiddenPhysicalIdToLogicalMap.insert(std::make_pair(
- physicalId, std::vector<SystemCameraKind>(systemCameraKind)));
+ physicalId, std::vector<SystemCameraKind>({systemCameraKind})));
} else {
it->second.push_back(systemCameraKind);
}
@@ -1450,6 +1451,7 @@ TEST_P(CameraAidlTest, processMultiCaptureRequestPreview) {
for (const auto& name : cameraDeviceNames) {
std::string version, deviceId;
+ ALOGI("processMultiCaptureRequestPreview: Test device %s", name.c_str());
ASSERT_TRUE(matchDeviceName(name, mProviderType, &version, &deviceId));
CameraMetadata metadata;
@@ -1466,6 +1468,7 @@ TEST_P(CameraAidlTest, processMultiCaptureRequestPreview) {
ASSERT_TRUE(ret.isOk());
continue;
}
+ ASSERT_EQ(Status::OK, rc);
std::unordered_set<std::string> physicalIds;
rc = getPhysicalCameraIds(staticMeta, &physicalIds);
@@ -1521,10 +1524,14 @@ TEST_P(CameraAidlTest, processMultiCaptureRequestPreview) {
Stream previewStream;
std::shared_ptr<DeviceCb> cb;
- configurePreviewStreams(name, mProvider, &previewThreshold, physicalIds, &mSession,
- &previewStream, &halStreams /*out*/,
- &supportsPartialResults /*out*/, &partialResultCount /*out*/,
- &useHalBufManager /*out*/, &cb /*out*/, 0 /*streamConfigCounter*/);
+ configurePreviewStreams(
+ name, mProvider, &previewThreshold, physicalIds, &mSession, &previewStream,
+ &halStreams /*out*/, &supportsPartialResults /*out*/, &partialResultCount /*out*/,
+ &useHalBufManager /*out*/, &cb /*out*/, 0 /*streamConfigCounter*/, true);
+ if (mSession == nullptr) {
+ // stream combination not supported by HAL, skip test for device
+ continue;
+ }
::aidl::android::hardware::common::fmq::MQDescriptor<
int8_t, aidl::android::hardware::common::fmq::SynchronizedReadWrite>
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 858dfd5fdc..ee0c6914d4 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -1564,6 +1564,7 @@ void CameraAidlTest::openEmptyDeviceSession(const std::string& name,
ASSERT_NE(*session, nullptr);
ret = (*device)->getCameraCharacteristics(staticMeta);
+ ASSERT_TRUE(ret.isOk());
}
void CameraAidlTest::openEmptyInjectionSession(const std::string& name,
@@ -2474,7 +2475,7 @@ void CameraAidlTest::configurePreviewStreams(
std::shared_ptr<ICameraDeviceSession>* session, Stream* previewStream,
std::vector<HalStream>* halStreams, bool* supportsPartialResults,
int32_t* partialResultCount, bool* useHalBufManager, std::shared_ptr<DeviceCb>* cb,
- int32_t streamConfigCounter) {
+ int32_t streamConfigCounter, bool allowUnsupport) {
ASSERT_NE(nullptr, session);
ASSERT_NE(nullptr, halStreams);
ASSERT_NE(nullptr, previewStream);
@@ -2561,6 +2562,14 @@ void CameraAidlTest::configurePreviewStreams(
bool supported = false;
ret = device->isStreamCombinationSupported(config, &supported);
ASSERT_TRUE(ret.isOk());
+ if (allowUnsupport && !supported) {
+ // stream combination not supported. return null session
+ ret = (*session)->close();
+ ASSERT_TRUE(ret.isOk());
+ *session = nullptr;
+ return;
+ }
+ ASSERT_TRUE(supported) << "Stream combination must be supported.";
config.streamConfigCounter = streamConfigCounter;
std::vector<HalStream> halConfigs;
diff --git a/camera/provider/aidl/vts/camera_aidl_test.h b/camera/provider/aidl/vts/camera_aidl_test.h
index 1ca457b331..ac4b2c9d0e 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.h
+++ b/camera/provider/aidl/vts/camera_aidl_test.h
@@ -190,7 +190,8 @@ class CameraAidlTest : public ::testing::TestWithParam<std::string> {
std::shared_ptr<ICameraDeviceSession>* session /*out*/, Stream* previewStream /*out*/,
std::vector<HalStream>* halStreams /*out*/, bool* supportsPartialResults /*out*/,
int32_t* partialResultCount /*out*/, bool* useHalBufManager /*out*/,
- std::shared_ptr<DeviceCb>* cb /*out*/, int32_t streamConfigCounter = 0);
+ std::shared_ptr<DeviceCb>* cb /*out*/, int32_t streamConfigCounter = 0,
+ bool allowUnsupport = false);
void configurePreviewStream(
const std::string& name, const std::shared_ptr<ICameraProvider>& provider,