Skip to content

Commit 16564f1

Browse files
committed
tests: Add Pi 5 video tests exceptions.
Right now, libcamera-vid on Pi 5 does not support segment, metadata and pause functionality. Stop these tests from running on Pi 5. Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent 9c35d4a commit 16564f1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

utils/test.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,39 @@
1212
# get a test in here.
1313

1414
import argparse
15+
from enum import Enum
16+
import fcntl
1517
import json
1618
import os
1719
import os.path
1820
import subprocess
1921
import sys
2022
from timeit import default_timer as timer
23+
import v4l2
2124
import numpy as np
2225

2326

27+
def get_platform():
28+
platform = 'vc4'
29+
try:
30+
for num in range(5):
31+
device = '/dev/video' + str(num)
32+
if os.path.exists(device):
33+
with open(device, 'rb+', buffering=0) as fd:
34+
caps = v4l2.v4l2_capability()
35+
fcntl.ioctl(fd, v4l2.VIDIOC_QUERYCAP, caps)
36+
decoded = caps.card.decode('utf-8')
37+
if decoded == 'rp1-cfe':
38+
platform = 'pisp'
39+
break
40+
elif decoded == 'unicam':
41+
break
42+
except Exception:
43+
pass
44+
45+
return platform
46+
47+
2448
class TestFailure(Exception):
2549
def __init__(self, message):
2650
self.message = message
@@ -345,6 +369,7 @@ def check_timestamps(file, preamble):
345369

346370

347371
def test_vid(exe_dir, output_dir):
372+
platform = get_platform()
348373
executable = os.path.join(exe_dir, 'libcamera-vid')
349374
output_h264 = os.path.join(output_dir, 'test.h264')
350375
output_mjpeg = os.path.join(output_dir, 'test.mjpeg')
@@ -383,6 +408,10 @@ def test_vid(exe_dir, output_dir):
383408
check_time(time_taken, 2, 6, "test_vid: mjpeg test")
384409
check_size(output_mjpeg, 1024, "test_vid: mjpeg test")
385410

411+
if platform == 'pisp':
412+
print("skipping unsupported Pi 5 libcamera-vid tests")
413+
return
414+
386415
# "segment test". As above, write the output in single frame segements.
387416
print(" segment test")
388417
retcode, time_taken = run_executable([executable, '-t', '2000', '--codec', 'mjpeg',

0 commit comments

Comments
 (0)