[libcamera-devel,v3,2/7] apps: lc-compliance: Check that requests complete successfully
diff mbox series

Message ID 20231230162912.827669-3-jacopo.mondi@ideasonboard.com
State Accepted
Headers show
Series
  • apps: lc-compliance: Properties and multi-stream tests
Related show

Commit Message

Jacopo Mondi Dec. 30, 2023, 4:29 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>
---
 src/apps/lc-compliance/simple_capture.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Kieran Bingham Jan. 12, 2024, 11:40 a.m. UTC | #1
Quoting Jacopo Mondi via libcamera-devel (2023-12-30 16:29:07)
> 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>

This sounds and looks pretty reasonable. So I would say this should
already be good to go.

I'll be keen to see lc-compliance run more and grow in our automated
tests.


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/apps/lc-compliance/simple_capture.cpp | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/apps/lc-compliance/simple_capture.cpp b/src/apps/lc-compliance/simple_capture.cpp
> index cf4d7cf38bc3..e22a339c4e1c 100644
> --- a/src/apps/lc-compliance/simple_capture.cpp
> +++ b/src/apps/lc-compliance/simple_capture.cpp
> @@ -127,6 +127,9 @@ int SimpleCaptureBalanced::queueRequest(Request *request)
>  
>  void SimpleCaptureBalanced::requestComplete(Request *request)
>  {
> +       EXPECT_EQ(request->status(), Request::Status::RequestComplete)
> +               << "Request didn't complete successfully";
> +
>         captureCount_++;
>         if (captureCount_ >= captureLimit_) {
>                 loop_->exit(0);
> @@ -184,6 +187,9 @@ void SimpleCaptureUnbalanced::requestComplete(Request *request)
>                 return;
>         }
>  
> +       EXPECT_EQ(request->status(), Request::Status::RequestComplete)
> +               << "Request didn't complete successfully";
> +
>         request->reuse(Request::ReuseBuffers);
>         if (camera_->queueRequest(request))
>                 loop_->exit(-EINVAL);
> -- 
> 2.41.0
>

Patch
diff mbox series

diff --git a/src/apps/lc-compliance/simple_capture.cpp b/src/apps/lc-compliance/simple_capture.cpp
index cf4d7cf38bc3..e22a339c4e1c 100644
--- a/src/apps/lc-compliance/simple_capture.cpp
+++ b/src/apps/lc-compliance/simple_capture.cpp
@@ -127,6 +127,9 @@  int SimpleCaptureBalanced::queueRequest(Request *request)
 
 void SimpleCaptureBalanced::requestComplete(Request *request)
 {
+	EXPECT_EQ(request->status(), Request::Status::RequestComplete)
+		<< "Request didn't complete successfully";
+
 	captureCount_++;
 	if (captureCount_ >= captureLimit_) {
 		loop_->exit(0);
@@ -184,6 +187,9 @@  void SimpleCaptureUnbalanced::requestComplete(Request *request)
 		return;
 	}
 
+	EXPECT_EQ(request->status(), Request::Status::RequestComplete)
+		<< "Request didn't complete successfully";
+
 	request->reuse(Request::ReuseBuffers);
 	if (camera_->queueRequest(request))
 		loop_->exit(-EINVAL);