From 82442917e85d30398dbfabfd79c7b2f4456e9bcf Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Sun, 7 Apr 2024 23:01:57 +0300 Subject: [PATCH 1/2] adjust unit tests to peek default profile --- unit-tests/live/frames/test-fps.py | 8 ++++---- unit-tests/live/frames/test-t2ff-sensor.py | 15 ++++++--------- unit-tests/live/options/test-timestamp-domain.py | 4 ++-- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/unit-tests/live/frames/test-fps.py b/unit-tests/live/frames/test-fps.py index d9d7d2f440..01539188a8 100644 --- a/unit-tests/live/frames/test-fps.py +++ b/unit-tests/live/frames/test-fps.py @@ -86,10 +86,10 @@ def frame_cb(frame): and p.stream_type() == rs.stream.depth and p.format() == rs.format.z16) except StopIteration: - print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps)) + log.i("Requested fps: {:.1f} [Hz], not supported".format(requested_fps)) else: fps = measure_fps(ds, dp, time_to_test_fps[i]) - print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds)) + log.i("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds)) delta_Hz = requested_fps * 0.05 # Validation KPI is 5% test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz)) test.finish() @@ -114,10 +114,10 @@ def frame_cb(frame): and p.stream_type() == rs.stream.color and p.format() == rs.format.rgb8) except StopIteration: - print("Requested fps: {:.1f} [Hz], not supported".format(requested_fps)) + log.i("Requested fps: {:.1f} [Hz], not supported".format(requested_fps)) else: fps = measure_fps(cs, cp, time_to_test_fps[i]) - print("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds)) + log.i("Requested fps: {:.1f} [Hz], actual fps: {:.1f} [Hz]. Time to first frame {:.6f}".format(requested_fps, fps, first_frame_seconds)) delta_Hz = requested_fps * 0.05 # Validation KPI is 5% test.check(fps <= (requested_fps + delta_Hz) and fps >= (requested_fps - delta_Hz)) diff --git a/unit-tests/live/frames/test-t2ff-sensor.py b/unit-tests/live/frames/test-t2ff-sensor.py index b7f88ac04c..cf6a9f5b2a 100644 --- a/unit-tests/live/frames/test-t2ff-sensor.py +++ b/unit-tests/live/frames/test-t2ff-sensor.py @@ -59,13 +59,8 @@ def frame_cb(frame): test.finish() -# Set maximum delay for first frame according to product line -product_line = dev.get_info(rs.camera_info.product_line) -if product_line == "D400": - max_delay_for_depth_frame = 1 - max_delay_for_color_frame = 1 -else: - log.f( "This test support only D400 devices" ) +max_delay_for_depth_frame = 1 +max_delay_for_color_frame = 1 ds = dev.first_depth_sensor() @@ -74,12 +69,14 @@ def frame_cb(frame): dp = next(p for p in ds.profiles if p.fps() == 30 and p.stream_type() == rs.stream.depth - and p.format() == rs.format.z16) + and p.format() == rs.format.z16 + and p.is_default()) cp = next(p for p in cs.profiles if p.fps() == 30 and p.stream_type() == rs.stream.color - and p.format() == rs.format.rgb8) + and p.format() == rs.format.rgb8 + and p.is_default()) ##################################################################################################### diff --git a/unit-tests/live/options/test-timestamp-domain.py b/unit-tests/live/options/test-timestamp-domain.py index 2394c279ee..81fe973575 100644 --- a/unit-tests/live/options/test-timestamp-domain.py +++ b/unit-tests/live/options/test-timestamp-domain.py @@ -49,7 +49,7 @@ def set_and_verify_timestamp_domain(sensor, frame_queue, global_time_enabled: bo depth_frame_queue = rs.frame_queue(queue_capacity, keep_frames=False) depth_sensor = device.first_depth_sensor() -depth_profile = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth) +depth_profile = next(p for p in depth_sensor.profiles if p.stream_type() == rs.stream.depth and p.is_default()) depth_sensor.open(depth_profile) depth_sensor.start(depth_frame_queue) @@ -69,7 +69,7 @@ def set_and_verify_timestamp_domain(sensor, frame_queue, global_time_enabled: bo color_frame_queue = rs.frame_queue(queue_capacity, keep_frames=False) color_sensor = device.first_color_sensor() -color_profile = next(p for p in color_sensor.profiles if p.stream_type() == rs.stream.color) +color_profile = next(p for p in color_sensor.profiles if p.stream_type() == rs.stream.color and p.is_default()) color_sensor.open(color_profile) color_sensor.start(color_frame_queue) From 49baa398aab1d8746f4fa8ecd5804650d91421bb Mon Sep 17 00:00:00 2001 From: Nir Azkiel Date: Mon, 8 Apr 2024 10:58:56 +0300 Subject: [PATCH 2/2] add missing product line --- unit-tests/live/frames/test-t2ff-sensor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit-tests/live/frames/test-t2ff-sensor.py b/unit-tests/live/frames/test-t2ff-sensor.py index cf6a9f5b2a..ce783114ff 100644 --- a/unit-tests/live/frames/test-t2ff-sensor.py +++ b/unit-tests/live/frames/test-t2ff-sensor.py @@ -58,7 +58,7 @@ def frame_cb(frame): test.check(device_creation_time < max_time_for_device_creation) test.finish() - +product_line = dev.get_info(rs.camera_info.product_line) max_delay_for_depth_frame = 1 max_delay_for_color_frame = 1