Skip to content

Commit

Permalink
PR #12778 from dmipx: add rs-enumerate-devices test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored Mar 31, 2024
2 parents 58c8961 + 86dfa0a commit 51b0194
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions unit-tests/live/tools/test-enumerate-devices.py
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()

0 comments on commit 51b0194

Please sign in to comment.