Skip to content

Enable tests for D555 #14056

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions unit-tests/live/d500/test-detect-dds-device.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2025 Intel Corporation. All Rights Reserved.

#test:donotrun:!dds
#test:device D555

import pyrealsense2 as rs
from rspy import test, log

# this test will query for device, test check it is DDS and exit

with test.closure("Detect DDS device"):
dev, _ = test.find_first_device_or_exit()
if test.check(dev.supports(rs.camera_info.connection_type)):
connection_type = dev.get_info(rs.camera_info.connection_type)
test.check(connection_type == "DDS")

test.print_results_and_exit()
6 changes: 3 additions & 3 deletions unit-tests/live/d500/test-get-set-calib-config-table-api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2024 Intel Corporation. All Rights Reserved.

# test:donotrun ## TODO: change this when D5555 device is connected to libCI
# test:donotrun ## TODO: change this when relevant device is connected to libCI

import pyrealsense2 as rs
from rspy import test, log
Expand Down Expand Up @@ -86,7 +86,7 @@

# verify the JSON objects are equal (comparing JSON object because
# the JSON string can have different order of inner fields
test.check_equal(json.loads(read_result), json.loads(new_calib_config))
test.check_equal_jsons(json.loads(read_result), json.loads(new_calib_config))

test.finish()

Expand Down Expand Up @@ -232,7 +232,7 @@

# verify the JSON objects are equal (comparing JSON object because
# the JSON string can have different order of inner fields
test.check_equal(json.loads(read_result), json.loads(original_calib_config))
test.check_equal_jsons(json.loads(read_result), json.loads(original_calib_config))

test.finish()

Expand Down
3 changes: 2 additions & 1 deletion unit-tests/live/debug_protocol/test-build-command.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# Copyright(c) 2022 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device each(D555)

import pyrealsense2 as rs
from rspy import devices, log, test, file, repo
from rspy import log, test, file, repo


#############################################################################################
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/frames/test-depth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2023 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device each(D500*)

import pyrealsense2 as rs
from rspy import test, log
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/frames/test-pipeline-start-stop.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# test:donotrun:!nightly
# Currently, we exclude D457 as it's failing
# test:device each(D400*) !D457
# test:device each(D500*)
# On D455 and other units with IMU it takes ~4 seconds per iteration
# test:timeout 220

Expand Down
6 changes: 5 additions & 1 deletion unit-tests/live/frames/test-t2ff-pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

# test:device each(D400*)
# test:device each(D500*)


import pyrealsense2 as rs
Expand All @@ -26,8 +27,11 @@
if product_line == "D400":
max_delay_for_depth_frame = 1
max_delay_for_color_frame = 1
elif product_line == "D500":
max_delay_for_depth_frame = 1
max_delay_for_color_frame = 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pipeline start take less than 1 sec for D555?

else:
log.f("This test support only D400 devices")
log.f("Not supported product line " + product_line)


def time_to_first_frame(config):
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/frames/test-t2ff-sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

# test:device each(D400*)
# test:device each(D500*)

import pyrealsense2 as rs
from rspy.stopwatch import Stopwatch
Expand Down
5 changes: 3 additions & 2 deletions unit-tests/live/hw-reset/test-sanity.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2023 Intel Corporation. All Rights Reserved.


# test:device each(D400*) !D457 # D457 device is known for HW reset issues..
# test:device each(D500*)

import pyrealsense2 as rs
from rspy import test, log
from rspy import test, log, devices
from rspy.timer import Timer
import time

Expand Down Expand Up @@ -49,6 +49,7 @@ def device_changed( info ):
test.check(device_removed)

log.out("Pending for device addition")
t = Timer( devices.MAX_ENUMERATION_TIME )
t.start()
while not t.has_expired():
if ( device_added ):
Expand Down
22 changes: 17 additions & 5 deletions unit-tests/live/hw-reset/test-t2enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2023 Intel Corporation. All Rights Reserved.

# test:device each(D400*) !D457 # D457 device is known for HW reset issues..
# test:device each(D500*)

import pyrealsense2 as rs
from rspy import test, log
Expand All @@ -15,6 +16,7 @@
device_removed = False
device_added = False
MAX_ENUM_TIME_D400 = 5 # [sec]
MAX_ENUM_TIME_D500 = 15 # [sec]

def device_changed( info ):
global dev, device_removed, device_added
Expand All @@ -28,9 +30,14 @@ def device_changed( info ):
log.out( "Device addition detected at: ", time.perf_counter())
device_added = True

def get_max_enum_rime_by_device( dev ):
def get_max_enum_time_by_device( dev ):
if dev.get_info( rs.camera_info.product_line ) == "D400":
return MAX_ENUM_TIME_D400;
return MAX_ENUM_TIME_D400
elif dev.get_info( rs.camera_info.product_line ) == "D500":
if dev.get_info( rs.camera_info.connection_type) == "DDS":
print(18)
return MAX_ENUM_TIME_D500 + 3 # some extra time for discovery and initialization for DDS
return MAX_ENUM_TIME_D500
return 0;

################################################################################################
Expand All @@ -40,7 +47,7 @@ def get_max_enum_rime_by_device( dev ):
dev, ctx = test.find_first_device_or_exit()
ctx.set_devices_changed_callback( device_changed )

max_dev_enum_time = get_max_enum_rime_by_device( dev )
max_dev_enum_time = get_max_enum_time_by_device( dev )
time.sleep(1)
log.out( "Sending HW-reset command" )
enumeration_sw = Stopwatch() # we know we add the device removal time, but it shouldn't take long
Expand All @@ -57,7 +64,8 @@ def get_max_enum_rime_by_device( dev ):
test.check( device_removed and not t.has_expired() ) # verifying we are not timed out

log.out( "Pending for device addition" )
t.start()
buffer = 5 # we add 5 seconds so if the test pass the creteria by a short amount of time we can print it
t = Timer( max_dev_enum_time + buffer )
r_2_e_time = 0 # reset to enumeration time
while not t.has_expired():
if ( device_added ):
Expand All @@ -67,7 +75,11 @@ def get_max_enum_rime_by_device( dev ):

test.check( device_added )
test.check( r_2_e_time < max_dev_enum_time )
log.d( "Enumeration time took", r_2_e_time, "[sec]" )

if r_2_e_time:
log.d( "Enumeration time took", r_2_e_time, "[sec]" )
else:
log.e( "Enumeration did not occur in ", max_dev_enum_time + buffer, "[sec]" )

test.finish()

Expand Down
42 changes: 20 additions & 22 deletions unit-tests/live/intrinsics/test-motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# test:device:jetson D457
# test:device:!jetson D455
# test:device:!jetson each(D500*)
# This test check existence motion intrinsic data in accel and gyro profiles.

import pyrealsense2 as rs
Expand All @@ -16,25 +17,22 @@
test.check(motion_sensor)

if motion_sensor:

motion_profile_accel = next(p for p in motion_sensor.profiles if p.stream_type() == rs.stream.accel)
motion_profile_gyro = next(p for p in motion_sensor.profiles if p.stream_type() == rs.stream.gyro)

test.check(motion_profile_accel and motion_profile_gyro)

if motion_profile_accel:
motion_profile_accel = motion_profile_accel.as_motion_stream_profile()
intrinsics_accel = motion_profile_accel.get_motion_intrinsics()

log.d(str(intrinsics_accel))
test.check(len(str(intrinsics_accel)) > 0) # Checking if intrinsics has data

if motion_profile_gyro:
motion_profile_gyro = motion_profile_gyro.as_motion_stream_profile()
intrinsics_gyro = motion_profile_gyro.get_motion_intrinsics()

log.d(intrinsics_gyro)
test.check(len(str(intrinsics_gyro)) > 0) # Checking if intrinsics has data

test.finish()
test.print_results_and_exit()
if rs.stream.motion in [p.stream_type() for p in motion_sensor.profiles]: # D555 works with combined motion instead of accel and gyro
motion_profile = next(p for p in motion_sensor.profiles if p.stream_type() == rs.stream.motion)
motion_profiles = [motion_profile]
else:
motion_profile_accel = next(p for p in motion_sensor.profiles if p.stream_type() == rs.stream.accel)
motion_profile_gyro = next(p for p in motion_sensor.profiles if p.stream_type() == rs.stream.gyro)
test.check(motion_profile_accel and motion_profile_gyro)
motion_profiles = [motion_profile_accel, motion_profile_gyro]

print(motion_profiles)
for motion_profile in motion_profiles:
motion_profile = motion_profile.as_motion_stream_profile()
intrinsics = motion_profile.get_motion_intrinsics()

log.d(str(intrinsics))
test.check(len(str(intrinsics)) > 0) # Checking if intrinsics has data

test.finish()
test.print_results_and_exit()
1 change: 1 addition & 0 deletions unit-tests/live/metadata/test-enabled.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

#test:device each(D400*)
#test:device each(D500*)
#test:priority 1
#test:flag windows

Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/metadata/test-usb-type-found.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


#test:device each(D400*) !D457
#test:device each(D500*) !D555
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this pass without finding a D500 device?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes - tested with just a D400 connected and it passed



import pyrealsense2 as rs
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/options/test-options-watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2024 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device each(D555)

import pyrealsense2 as rs
from rspy import test
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/options/test-out-of-range-throw.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2020 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device each(D555)

import pyrealsense2 as rs
from rspy import test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

#test:device each(D400*) !D421 !D405
#test:device each(D500*)

import pyrealsense2 as rs
from rspy import test, log
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/options/test-set-gain-stress-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2021 Intel Corporation. All Rights Reserved.

# test:device each(D400*)
# test:device each(D500*)
# test:donotrun:!nightly

import pyrealsense2 as rs
Expand Down
1 change: 1 addition & 0 deletions unit-tests/live/streaming/test-y16-calibration-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright(c) 2023 Intel Corporation. All Rights Reserved.

# test:device D400*
# test:device each(D555)
# This test checks streaming y16 profile

import time
Expand Down
56 changes: 54 additions & 2 deletions unit-tests/py/rspy/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ def _count_check():

def check_passed():
"""
Function for when a check fails
:return: always False (so you can 'return check_failed()'
Function for when a check passes
:return: always True (so you can 'return check_passed()'
"""
_count_check()
print_info( error = False )
Expand Down Expand Up @@ -297,6 +297,58 @@ def check_equal( result, expected, on_fail=LOG ):

check_equal_lists = check_equal

# Recursive function to compare two JSON objects with epsilon for floats
def check_equal_jsons(json1, json2, epsilon=1e-6, path="root"):
"""
Compares two JSON-like objects with support for float tolerance and ignoring field order.
:param json1: The actual JSON object.
:param json2: The expected JSON object.
:param epsilon: The tolerance for float comparison.
:param path: The current path in the JSON structure for logging mismatches.
:return: True if JSONs are equal within tolerance, False otherwise.
"""
def log_difference(path, j1, j2):
print(f"Mismatch at {path}:")
print(f" left : {j1}")
print(f" right : {j2}")

# Normalize dictionaries by sorting their keys, so order doesn't matter
if isinstance(json1, dict) and isinstance(json2, dict):
if set(json1.keys()) != set(json2.keys()):
log_difference(path, json1, json2)
return False
# Recursively compare each key-value pair
for key in json1:
if not check_equal_jsons(json1[key], json2[key], epsilon, path=f"{path}.{key}"):
return False

# Compare lists by their length and then by recursively comparing each item
elif isinstance(json1, list) and isinstance(json2, list):
if len(json1) != len(json2):
log_difference(path, json1, json2)
return False
# Sort lists of dictionaries by a normalized key structure to ensure order-independence
sorted_json1 = sorted(json1, key=lambda x: str(x) if isinstance(x, (dict, list)) else x)
sorted_json2 = sorted(json2, key=lambda x: str(x) if isinstance(x, (dict, list)) else x)
for i, (item1, item2) in enumerate(zip(sorted_json1, sorted_json2)):
if not check_equal_jsons(item1, item2, epsilon, path=f"{path}[{i}]"):
return False

# Compare floats with epsilon tolerance
elif isinstance(json1, float) and isinstance(json2, float):
if abs(json1 - json2) > epsilon:
log_difference(path, json1, json2)
return False

# Direct comparison for other types
else:
if json1 != json2:
log_difference(path, json1, json2)
return False

return True



def check_between( result, min, max, on_fail=LOG ):
"""
Expand Down
7 changes: 5 additions & 2 deletions unit-tests/py/rspy/unifi.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# License: Apache 2.0. See LICENSE file in root directory.
# Copyright(c) 2025 Intel Corporation. All Rights Reserved.

import os
import sys
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # to allow running this script directly
sys.path.append(parent_dir)
from rspy import log
import time
import platform, re
from rspy import device_hub
import os

if __name__ == '__main__':
import os, sys, getopt
Expand Down Expand Up @@ -198,7 +201,7 @@ def enable_ports(self, ports=None, disable_other_ports=False, sleep_on_change=0)
ports = self.all_ports()

if disable_other_ports:
other_ports = set(self.all_ports()) - set(ports)
other_ports = set(self.all_ports()) - set([int(p) for p in ports])
self.disable_ports(list(other_ports), sleep_on_change)

if not ports: # ports is []
Expand Down
Loading