[libcamera-devel,2/2] tests: v4l2_compat: Check v4l2-compliance and v4l2-ctl versions

Message ID 20200710141508.468834-2-paul.elder@ideasonboard.com
State Superseded
Headers show
Series
  • [libcamera-devel,1/2] tests: v4l2_compat: Prettify failure output
Related show

Commit Message

Paul Elder July 10, 2020, 2:15 p.m. UTC
v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
continuing, though since neither of them currently are able to print
their version, simply checking if they can do so is sufficient.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
Obviously this depends on v4l2-compliance and v4l2-ctl having --version,
so that needs to be accepted first before this can be merged.
---
 test/v4l2_compat/v4l2_compat_test.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Laurent Pinchart July 10, 2020, 3:31 p.m. UTC | #1
Hi Paul,

Thank you for the patch.

On Fri, Jul 10, 2020 at 11:15:08PM +0900, Paul Elder wrote:
> v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
> v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
> continuing, though since neither of them currently are able to print
> their version, simply checking if they can do so is sufficient.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> Obviously this depends on v4l2-compliance and v4l2-ctl having --version,
> so that needs to be accepted first before this can be merged.

What happens with the --version arguments are not supported ? Will the
script raise an exception, or just return TestSkip ? In the latter case
I think we can merge this patch once the concept of the --version
argument is accepted.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  test/v4l2_compat/v4l2_compat_test.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
> index 8a8e59e..c97ae79 100755
> --- a/test/v4l2_compat/v4l2_compat_test.py
> +++ b/test/v4l2_compat/v4l2_compat_test.py
> @@ -98,11 +98,21 @@ def main(argv):
>          print('v4l2-compliance is not available')
>          return TestSkip
>  
> +    ret, _ = run_with_stdout(v4l2_compliance, '--version')
> +    if (ret != 0):
> +        print('v4l2-compliance version >= 1.21.0 required')
> +        return TestSkip
> +
>      v4l2_ctl = shutil.which('v4l2-ctl')
>      if v4l2_ctl is None:
>          print('v4l2-ctl is not available')
>          return TestSkip
>  
> +    ret, _ = run_with_stdout(v4l2_ctl, '--version')
> +    if (ret != 0):
> +        print('v4l2-ctl version >= 1.21.0 required')
> +        return TestSkip
> +
>      dev_nodes = glob.glob('/dev/video*')
>      if len(dev_nodes) == 0:
>          print('no video nodes available to test with')
Paul Elder July 11, 2020, 5:26 a.m. UTC | #2
Hi Laurent,

Thank you for the review.

On Fri, Jul 10, 2020 at 06:31:09PM +0300, Laurent Pinchart wrote:
> Hi Paul,
> 
> Thank you for the patch.
> 
> On Fri, Jul 10, 2020 at 11:15:08PM +0900, Paul Elder wrote:
> > v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
> > v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
> > continuing, though since neither of them currently are able to print
> > their version, simply checking if they can do so is sufficient.
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > 
> > ---
> > Obviously this depends on v4l2-compliance and v4l2-ctl having --version,
> > so that needs to be accepted first before this can be merged.
> 
> What happens with the --version arguments are not supported ? Will the
> script raise an exception, or just return TestSkip ? In the latter case

Oh, right. If it's not supported it'll just skip.

> I think we can merge this patch once the concept of the --version
> argument is accepted.

Alright.

> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> > ---
> >  test/v4l2_compat/v4l2_compat_test.py | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
> > index 8a8e59e..c97ae79 100755
> > --- a/test/v4l2_compat/v4l2_compat_test.py
> > +++ b/test/v4l2_compat/v4l2_compat_test.py
> > @@ -98,11 +98,21 @@ def main(argv):
> >          print('v4l2-compliance is not available')
> >          return TestSkip
> >  
> > +    ret, _ = run_with_stdout(v4l2_compliance, '--version')
> > +    if (ret != 0):
> > +        print('v4l2-compliance version >= 1.21.0 required')
> > +        return TestSkip
> > +
> >      v4l2_ctl = shutil.which('v4l2-ctl')
> >      if v4l2_ctl is None:
> >          print('v4l2-ctl is not available')
> >          return TestSkip
> >  
> > +    ret, _ = run_with_stdout(v4l2_ctl, '--version')
> > +    if (ret != 0):
> > +        print('v4l2-ctl version >= 1.21.0 required')
> > +        return TestSkip
> > +
> >      dev_nodes = glob.glob('/dev/video*')
> >      if len(dev_nodes) == 0:
> >          print('no video nodes available to test with')


Thanks,

Paul
Paul Elder July 11, 2020, 5:35 a.m. UTC | #3
Hi me,

On Fri, Jul 10, 2020 at 11:15:08PM +0900, Paul Elder wrote:
> v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
> v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
> continuing, though since neither of them currently are able to print
> their version, simply checking if they can do so is sufficient.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> 
> ---
> Obviously this depends on v4l2-compliance and v4l2-ctl having --version,
> so that needs to be accepted first before this can be merged.
> ---
>  test/v4l2_compat/v4l2_compat_test.py | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
> index 8a8e59e..c97ae79 100755
> --- a/test/v4l2_compat/v4l2_compat_test.py
> +++ b/test/v4l2_compat/v4l2_compat_test.py
> @@ -98,11 +98,21 @@ def main(argv):
>          print('v4l2-compliance is not available')
>          return TestSkip
>  
> +    ret, _ = run_with_stdout(v4l2_compliance, '--version')
> +    if (ret != 0):
> +        print('v4l2-compliance version >= 1.21.0 required')
> +        return TestSkip
> +

It just occurred to me that stuff might be backported in v4l-utils, so
to prepare for the case that --version might be backported, we should
still actually check the version.

>      v4l2_ctl = shutil.which('v4l2-ctl')
>      if v4l2_ctl is None:
>          print('v4l2-ctl is not available')
>          return TestSkip
>  
> +    ret, _ = run_with_stdout(v4l2_ctl, '--version')
> +    if (ret != 0):
> +        print('v4l2-ctl version >= 1.21.0 required')
> +        return TestSkip
> +
>      dev_nodes = glob.glob('/dev/video*')
>      if len(dev_nodes) == 0:
>          print('no video nodes available to test with')
> -- 
> 2.27.0
> 


Paul
Laurent Pinchart July 11, 2020, 1:17 p.m. UTC | #4
Hi Paul,

On Sat, Jul 11, 2020 at 02:35:00PM +0900, paul.elder@ideasonboard.com wrote:
> On Fri, Jul 10, 2020 at 11:15:08PM +0900, Paul Elder wrote:
> > v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
> > v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
> > continuing, though since neither of them currently are able to print
> > their version, simply checking if they can do so is sufficient.
> > 
> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> > 
> > ---
> > Obviously this depends on v4l2-compliance and v4l2-ctl having --version,
> > so that needs to be accepted first before this can be merged.
> > ---
> >  test/v4l2_compat/v4l2_compat_test.py | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
> > index 8a8e59e..c97ae79 100755
> > --- a/test/v4l2_compat/v4l2_compat_test.py
> > +++ b/test/v4l2_compat/v4l2_compat_test.py
> > @@ -98,11 +98,21 @@ def main(argv):
> >          print('v4l2-compliance is not available')
> >          return TestSkip
> >  
> > +    ret, _ = run_with_stdout(v4l2_compliance, '--version')
> > +    if (ret != 0):
> > +        print('v4l2-compliance version >= 1.21.0 required')
> > +        return TestSkip
> > +
> 
> It just occurred to me that stuff might be backported in v4l-utils, so
> to prepare for the case that --version might be backported, we should
> still actually check the version.

I'm not sure we really need to care about backports in v4l-utils. I
don't think it's a common situation, and with selective backports,
there's no way to check what features are supported anyway.

> >      v4l2_ctl = shutil.which('v4l2-ctl')
> >      if v4l2_ctl is None:
> >          print('v4l2-ctl is not available')
> >          return TestSkip
> >  
> > +    ret, _ = run_with_stdout(v4l2_ctl, '--version')
> > +    if (ret != 0):
> > +        print('v4l2-ctl version >= 1.21.0 required')
> > +        return TestSkip
> > +
> >      dev_nodes = glob.glob('/dev/video*')
> >      if len(dev_nodes) == 0:
> >          print('no video nodes available to test with')

Patch

diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
index 8a8e59e..c97ae79 100755
--- a/test/v4l2_compat/v4l2_compat_test.py
+++ b/test/v4l2_compat/v4l2_compat_test.py
@@ -98,11 +98,21 @@  def main(argv):
         print('v4l2-compliance is not available')
         return TestSkip
 
+    ret, _ = run_with_stdout(v4l2_compliance, '--version')
+    if (ret != 0):
+        print('v4l2-compliance version >= 1.21.0 required')
+        return TestSkip
+
     v4l2_ctl = shutil.which('v4l2-ctl')
     if v4l2_ctl is None:
         print('v4l2-ctl is not available')
         return TestSkip
 
+    ret, _ = run_with_stdout(v4l2_ctl, '--version')
+    if (ret != 0):
+        print('v4l2-ctl version >= 1.21.0 required')
+        return TestSkip
+
     dev_nodes = glob.glob('/dev/video*')
     if len(dev_nodes) == 0:
         print('no video nodes available to test with')