[libcamera-devel] [PATCH v9 17/18] lc-compliance: Check that requests complete successfully

Paul Elder paul.elder at ideasonboard.com
Fri Dec 16 13:29:38 CET 2022


From: Nícolas F. R. A. Prado <nfraprado at collabora.com>

When a request fails to queue it is completed but with its status set to
RequestCancelled. Add a check in the requestComplete callback to make
sure that the request was completed successfully.

For the SimpleCaptureUnbalanced test we need to do this check only if
the capture isn't over yet, otherwise the few extra requests that get
cancelled at the end, which is the normal behavior, will make the test
fail.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
Reviewed-by: Paul Elder <paul.elder at ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>

---
Changes in v9:
- rebased

Changes in v8:
- Fixed issue in UnbalancedStop test where requests cancelled due to stop() call
  were failing the test
- Fixed formatting

Changes in v5:
- New
---
 src/apps/lc-compliance/simple_capture.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/apps/lc-compliance/simple_capture.cpp b/src/apps/lc-compliance/simple_capture.cpp
index a37a98ac..02b00d9a 100644
--- a/src/apps/lc-compliance/simple_capture.cpp
+++ b/src/apps/lc-compliance/simple_capture.cpp
@@ -164,6 +164,9 @@ int SimpleCaptureBalanced::queueRequest(Request *request)
 
 void SimpleCaptureBalanced::requestComplete(Request *request)
 {
+	EXPECT_EQ(request->status(), Request::Status::RequestComplete)
+		<< "Request didn't complete successfully";
+
 	if (captureCompleted())
 		return;
 
@@ -201,6 +204,9 @@ void SimpleCaptureUnbalanced::requestComplete(Request *request)
 	if (captureCompleted())
 		return;
 
+	EXPECT_EQ(request->status(), Request::Status::RequestComplete)
+		<< "Request didn't complete successfully";
+
 	request->reuse(Request::ReuseBuffers);
 	if (camera_->queueRequest(request))
 		loop_->exit(-EINVAL);
@@ -232,5 +238,8 @@ void SimpleCaptureOverflow::capture()
 
 void SimpleCaptureOverflow::requestComplete([[maybe_unused]] Request *request)
 {
+	EXPECT_EQ(request->status(), Request::Status::RequestComplete)
+		<< "Request didn't complete successfully";
+
 	captureCompleted();
 }
-- 
2.35.1



More information about the libcamera-devel mailing list