[libcamera-devel,v10,18/19] lc-compliance: Check that requests complete successfully
diff mbox series

Message ID 20221228223003.2265712-19-paul.elder@ideasonboard.com
State Accepted
Headers show
Series
  • lc-compliance: Add test to queue more requests than hardware depth
Related show

Commit Message

Paul Elder Dec. 28, 2022, 10:30 p.m. UTC
From: NĂ­colas F. R. A. Prado <nfraprado@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@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@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(+)

Patch
diff mbox series

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();
 }