Skip to content

Commit

Permalink
tests: rs-enumerate-devices
Browse files Browse the repository at this point in the history
Referenced-by: [RSDSO-19607]

Signed-off-by: Dmitry Perchanov <[email protected]>
  • Loading branch information
dmipx committed Mar 20, 2024
1 parent 44a254f commit bdb3443
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions unit-tests/live/tools/test-enumerate-devices.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2024 Intel Corporation. All Rights Reserved.

import pyrealsense2 as rs
from rspy import log, repo, test
from rspy.stopwatch import Stopwatch

#############################################################################################
#
test.start( "Init" )
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
subprocess.run( [rs_enumerate_devices],
stdout=None,
stderr=subprocess.STDOUT,
universal_newlines=True,
timeout=10,
check=False ) # don't fail on errors
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 bdb3443

Please sign in to comment.