[libcamera-devel,3/3] test: list-cameras: skip if no camera is available

Message ID 20200725122442.1679820-4-vicamo.yang@canonical.com
State Superseded
Headers show
Series
  • fix test failures in package build systems
Related show

Commit Message

You-Sheng Yang July 25, 2020, 12:24 p.m. UTC
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
---
 test/list-cameras.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Laurent Pinchart July 26, 2020, 11:58 p.m. UTC | #1
Hi You-Sheng,

Thank you for the patch.

On Sat, Jul 25, 2020 at 08:24:42PM +0800, You-Sheng Yang wrote:
> Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
> ---
>  test/list-cameras.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp
> index e6a407a..f4cd3b7 100644
> --- a/test/list-cameras.cpp
> +++ b/test/list-cameras.cpp
> @@ -26,7 +26,7 @@ protected:
>  			return TestFail;
>  		}
>  
> -		return 0;
> +		return cm_->cameras().size() ? TestPass : TestSkip;

I think this test should instead be dropped completely. It's the first
test case we've added, in order to start development of the unit tests,
and it doesn't serve much purpose anymore as we have a bunch of other
tests that exercise the same API, and more.

>  	}
>  
>  	int run()

Patch

diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp
index e6a407a..f4cd3b7 100644
--- a/test/list-cameras.cpp
+++ b/test/list-cameras.cpp
@@ -26,7 +26,7 @@  protected:
 			return TestFail;
 		}
 
-		return 0;
+		return cm_->cameras().size() ? TestPass : TestSkip;
 	}
 
 	int run()