-
Notifications
You must be signed in to change notification settings - Fork 30
Ci: testing frame order and fps #330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b8a7a7d
b7c7239
933728e
cd30c11
8b79c77
d9e3acd
c8dcd4b
f8af750
c6c1177
193b8cb
0c78331
5d81889
84c4c6f
c5c5215
5421f88
f993ef1
30bb9c3
0d66c52
7dc7fd3
f3101ae
8461377
d483738
6f2d76c
94edb77
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException | ||
|
|
||
| pipeline { | ||
| agent { label 'rs-orin-01.realsenseai.com' } | ||
|
|
||
| options { | ||
| timestamps() | ||
| timeout(time: 30, unit: 'MINUTES') | ||
| } | ||
|
|
||
| parameters { | ||
| booleanParam(name: 'REBOOT', defaultValue: false) | ||
| } | ||
|
|
||
| stages { | ||
| stage('Get artifacts') { | ||
| when { | ||
| expression { params.REBOOT == true } | ||
| } | ||
| steps { | ||
| script { | ||
| copyArtifacts filter: '**/*.tar.bz2', | ||
| projectName: 'D4xx_Kernel_Module_Jetson_JP6', | ||
| flatten: true, | ||
| target: 'artifacts/' | ||
| } | ||
| } | ||
| } | ||
| stage('Install artifacts') { | ||
| when { | ||
| expression { params.REBOOT == true } | ||
| } | ||
| steps { | ||
| sh """#!/bin/sh | ||
| tar -xf artifacts/rootfs.tar.bz2 | ||
| # external script on agent to install artifacts | ||
| sudo install.tegra.artifacts.sh | ||
| """ | ||
| script { | ||
| build job: env.JOB_NAME, | ||
| wait: false, | ||
| parameters: [ booleanParam(name: 'REBOOT', value: false) ] | ||
| } | ||
| } | ||
| post { | ||
| success { | ||
| sh 'nohup sudo reboot &' | ||
| } | ||
| } | ||
| } | ||
| stage('Pytest') { | ||
| when { | ||
| expression { params.REBOOT == false } | ||
| } | ||
| steps { | ||
| sh """#!/bin/sh | ||
| pytest --tb=no -s test | ||
| """ | ||
| } | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [pytest] | ||
| markers = | ||
| d457: realsense D457 camera | ||
|
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,97 @@ | ||||||
| import subprocess | ||||||
| import pytest | ||||||
| import re | ||||||
|
|
||||||
| @pytest.mark.d457 | ||||||
| @pytest.mark.parametrize("frames", {150}) | ||||||
| @pytest.mark.parametrize("device", {'0', '2'}) | ||||||
| def test_fps(device, frames): | ||||||
| try: | ||||||
| print(f"\nDevice: {device}") | ||||||
| formats = get_formats(device) | ||||||
| for w, h in formats: | ||||||
| print(f"Format: {w}x{h}") | ||||||
| for FPS in formats[(w, h)]: | ||||||
| cmd = [ "v4l2-ctl", | ||||||
| f"-d{device}", | ||||||
| f"--set-fmt-video=width={w},height={h}", | ||||||
| ] | ||||||
| subprocess.check_call(cmd) | ||||||
| print(f"FPS/{FPS}:", end=' ') | ||||||
| cmd = [ "v4l2-ctl", | ||||||
| f"-d{device}", | ||||||
| "-p", | ||||||
| f"{FPS}", | ||||||
| ] | ||||||
| subprocess.check_call(cmd, stdout=subprocess.DEVNULL) | ||||||
| cmd = [ "v4l2-ctl", | ||||||
| f"-d{device}", | ||||||
| "--stream-mmap", | ||||||
| "--stream-count", | ||||||
| f"{frames}", | ||||||
| "--verbose", | ||||||
| ] | ||||||
| timeout = 4.0 * frames / FPS | ||||||
|
||||||
| output = subprocess.run(cmd, | ||||||
| check=True, | ||||||
| text=True, | ||||||
| capture_output=True, | ||||||
| timeout=timeout).stderr.splitlines() | ||||||
| last = None | ||||||
| skip = True # skip first FPS measurement | ||||||
| kpi = 5 # [%] | ||||||
|
||||||
| count = 0 | ||||||
| for line in output: | ||||||
| m = re.search(r"cap dqbuf:.*seq:\s*(\d*) bytesused:", line) | ||||||
| if m: | ||||||
| count += 1 | ||||||
| frame = int(m.group(1)) | ||||||
| # print(f"{frame}", end='') | ||||||
| if last: | ||||||
| assert frame > last, f"Repeated frame: {frame}" | ||||||
| assert (frame - last) < 3 , f"Frames dropped between: {last} and {frame}" | ||||||
|
||||||
| assert (frame - last) < 3 , f"Frames dropped between: {last} and {frame}" | |
| assert (frame - last) < 2 , f"Frames dropped between: {last} and {frame}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent spacing: there's an extra space before the closing parenthesis in
.format( e ). Should be.format(e)to match Python style conventions.