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

Message ID 20200711054555.495244-2-paul.elder@ideasonboard.com
State Accepted
Commit 74c8b508338ccdd0780aa1e067a1e8fcb9ee326b
Headers show
Series
  • [libcamera-devel,v2,1/2] tests: v4l2_compat: Prettify failure output
Related show

Commit Message

Paul Elder July 11, 2020, 5:45 a.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.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

---
Changes in v2:
- actually check the version number
---
 test/v4l2_compat/v4l2_compat_test.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch

diff --git a/test/v4l2_compat/v4l2_compat_test.py b/test/v4l2_compat/v4l2_compat_test.py
index 8aca222..b054fe6 100755
--- a/test/v4l2_compat/v4l2_compat_test.py
+++ b/test/v4l2_compat/v4l2_compat_test.py
@@ -9,12 +9,15 @@ 
 import argparse
 import glob
 import os
+from packaging import version
 import re
 import shutil
 import signal
 import subprocess
 import sys
 
+MIN_V4L_UTILS_VERSION = version.parse("1.21.0")
+
 TestPass = 0
 TestFail = -1
 TestSkip = 77
@@ -90,11 +93,21 @@  def main(argv):
         print('v4l2-compliance is not available')
         return TestSkip
 
+    ret, out = run_with_stdout(v4l2_compliance, '--version')
+    if (ret != 0 or version.parse(out[-2].split()[-1]) < MIN_V4L_UTILS_VERSION):
+        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, out = run_with_stdout(v4l2_ctl, '--version')
+    if (ret != 0 or version.parse(out[-2].split()[-1]) < MIN_V4L_UTILS_VERSION):
+        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')