-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #12778 from dmipx: add rs-enumerate-devices test
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# License: Apache 2.0. See LICENSE file in root directory. | ||
# Copyright(c) 2024 Intel Corporation. All Rights Reserved. | ||
|
||
#test:device each(D400*) | ||
#test:device each(D500*) | ||
|
||
import pyrealsense2 as rs | ||
from rspy import log, repo, test | ||
from rspy.stopwatch import Stopwatch | ||
|
||
############################################################################################# | ||
# | ||
test.start( "Run enumerate-devices runtime test" ) | ||
rs_enumerate_devices = repo.find_built_exe( 'tools/enumerate-devices', 'rs-enumerate-devices' ) | ||
test.check(rs_enumerate_devices) | ||
if rs_enumerate_devices: | ||
import subprocess | ||
run_time_stopwatch = Stopwatch() | ||
run_time_threshold = 2 | ||
p = subprocess.run( [rs_enumerate_devices], | ||
stdout=None, | ||
stderr=subprocess.STDOUT, | ||
universal_newlines=True, | ||
timeout=10, | ||
check=False ) # don't fail on errors | ||
test.check(p.returncode == 0) # verify success return code | ||
run_time_seconds = run_time_stopwatch.get_elapsed() | ||
if run_time_seconds > run_time_threshold: | ||
log.e('Time elapsed too high!', run_time_seconds, ' > ', run_time_threshold) | ||
test.check(run_time_seconds < run_time_threshold) | ||
run_time_stopwatch.reset() | ||
else: | ||
log.e( 'no rs-enumerate-devices was found!' ) | ||
import sys | ||
log.d( 'sys.path=\n ' + '\n '.join( sys.path ) ) | ||
|
||
test.finish() | ||
# | ||
############################################################################################# | ||
test.print_results_and_exit() |