Skip to content

Commit b8a7a7d

Browse files
committed
test_fps.py
1 parent 8b79c77 commit b8a7a7d

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

test/test_fps.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import subprocess
2+
import pytest
3+
import re
4+
5+
@pytest.mark.d457
6+
@pytest.mark.parametrize("device", {'0', '2'})
7+
@pytest.mark.parametrize("frames", {'100'})
8+
@pytest.mark.parametrize("timeout", {10})
9+
def test_fps(device, frames, timeout):
10+
try:
11+
cmd = [ "v4l2-ctl",
12+
"-d" + device,
13+
"--stream-mmap",
14+
"--stream-count",
15+
frames,
16+
"--verbose"]
17+
output = subprocess.run(cmd,
18+
check=True,
19+
text=True,
20+
capture_output=True,
21+
timeout=timeout).stderr.splitlines()
22+
last = None
23+
for line in output:
24+
m = re.search(r"cap dqbuf:.*seq:\s*(\d*)\s*bytesused:.*fps:\s*(\d+\.\d+)\s*.*", line)
25+
if m:
26+
frame = int(m.group(1))
27+
fps = float(m.group(2))
28+
if last:
29+
print(f"frame: {frame}/{last}, fps: {fps}")
30+
assert frame != last, f"Repeated frame: {frame}"
31+
assert frame == last+1, f"Frame droped between: {last} and {frame}"
32+
last = frame
33+
34+
except Exception as e:
35+
assert False, "Exception caught during test: {}".format(e)

test/test_metadata/test_metadata

1.25 KB
Binary file not shown.

0 commit comments

Comments
 (0)