Repository navigation
Skip rosbag tests when the installed librealsense2 cannot play compressed db3 - #3558
Conversation
sysrsbuild-gh-agentic
left a comment
There was a problem hiding this comment.
Auto-review by rs-agentic bot. Good approach overall — probing the binary instead of comparing versions is the right call. A few items worth addressing.
|
@AviaAv handing this over to you since it follows your db3 migration. The pre-release job has been red on every branch since #3539: it installs This PR guards it with a conftest that skips the |
|
The first attempt did not fire — pre-release stayed red and my skip reason never appeared in the log, so I pulled the actual deb apart to see why. Two findings: the b142f56 resolves the library through the dynamic loader instead ( |
|
@AviaAv re-pinging for a review — this is ready now. All checks are green on 4bdd88b, including the three pre-release jobs that have been red on every branch since #3539, and the bot threads are answered. The pre-release runs also dropped from 26-28 min to 11-17 min, and the log shows the rosbag files skipping in under a second each with everything else still running, so the guard is doing what it says rather than passing by luck. Still your call whether to take it at all: pre-release is not a required check and |
AviaAv
left a comment
There was a problem hiding this comment.
Approach and probe verified — v2.58.4 has zero compressedDepth occurrences in src/media/ros2/, development has them in 4 files, so the discriminator is sound. Source-build CI ran all rosbag tests (36 tests, 4 pre-existing skips); pre-release now skips them. Both test-plan items hold.
Three comments inline: one real over-skip, one uncaught OSError, one observability gap.
🤖 Generated by AI
| skip = pytest.mark.skip(reason="installed librealsense2 cannot play compressed .db3 " | ||
| "recordings (needs librealsense PR #15556)") | ||
| for item in items: | ||
| if 'rosbag' in item.keywords: |
There was a problem hiding this comment.
Over-skips two tests that don't depend on the SDK version:
test_rosbag_db3_play_test.py:35— its own header says "Verify vanillaros2 bag play(not librealsense)"; it reads the.db3through rosbag2's own reader. It passed inpre-releasebefore this PR, and is skipped now (Test Consolidate publish_tf and enable_tf in launch/includes/realsense_r200_nodelet.launch.xml #9, 0.61s).test_rosbag_depth_tests.py:174test_non_existing_rosbag— expects 0 chunks, never callsrun_test, passes on any SDK.
The marker is right for both (they do use a recording), so exempt rather than strip:
if 'rosbag' in item.keywords and 'no_librealsense' not in item.keywords:plus @pytest.mark.no_librealsense on those two.
🤖 Generated by AI
There was a problem hiding this comment.
Good catch - fixed in 56eb005. Both now carry @pytest.mark.no_librealsense and the hook exempts it, so they run in pre-release again while keeping the rosbag marker.
There was a problem hiding this comment.
change approved — no_librealsense exemption added in conftest.py and @pytest.mark.no_librealsense applied to both tests in the new commit.
| except Exception: | ||
| pass | ||
| libs = [lib for d in os.environ.get('LD_LIBRARY_PATH', '').split(':') if d | ||
| for lib in glob.glob(os.path.join(d, 'librealsense2.so*')) if os.path.getsize(lib)] |
There was a problem hiding this comment.
os.path.getsize(lib) sits outside the try, so it breaks fail-open instead of extending it: a dangling librealsense2.so* symlink in any LD_LIBRARY_PATH directory raises OSError into pytest collection — a collection error, not a skip and not a run.
The size filter also changes nothing; a zero-byte .so fails the substring check anyway. Drop it:
libs = [lib for d in os.environ.get('LD_LIBRARY_PATH', '').split(':') if d
for lib in glob.glob(os.path.join(d, 'librealsense2.so*'))]🤖 Generated by AI
There was a problem hiding this comment.
Fixed in 56eb005 - size filter dropped. You are right that it broke the fail-open property it looked like it was helping.
There was a problem hiding this comment.
change approved — os.path.getsize removed; glob fallback is clean with no size check.
|
|
||
|
|
||
| def pytest_collection_modifyitems(config, items): | ||
| if sdk_plays_compressed_db3(): |
There was a problem hiding this comment.
When this skips, nothing in the log says so. 19 tests disappear from the run with no reason and no path printed — so if the probe ever resolves the wrong .so, it looks identical to an old SDK.
One print fixes it:
def pytest_collection_modifyitems(config, items):
path = librealsense_path()
if sdk_plays_compressed_db3(path):
return
print(f"rosbag tests skipped: {path} lacks compressed .db3 support")with sdk_plays_compressed_db3 taking the path instead of calling librealsense_path() itself.
🤖 Generated by AI
There was a problem hiding this comment.
Fixed in 56eb005 - sdk_plays_compressed_db3 takes the path now and the hook prints it on skip. This one bit me already: when the first attempt silently failed open, the log looked identical to an old SDK and I had to unpack the deb to tell the difference.
There was a problem hiding this comment.
change approved — print("rosbag tests skipped: %s lacks compressed .db3 support" % path) is present in the new conftest.py.
4bdd88b to
56eb005
Compare
|
@AviaAv all three addressed in 56eb005, and the branch is rebased onto current Checks are re-running; worth a look at whether |
Overview: Makes the rosbag tests skip, instead of fail, when the installed librealsense2 is too old to play back the compressed
.db3recordings they now use.Tracked on [RSDSO-21716]
Why
The
pre-releaseworkflow has failed on every commit since #3539, on every branch. It installsros-humble-librealsense2 2.58.4fromrepo.ros2.org/ubuntu/testing, and the migrated tests feed it recordings whose frames live on/compressedand/compressedDepthtopics. Support for reading those landed in librealsense PR #15556, which is not in v2.58.4, so the SDK reader logsfor every metadata message and delivers no frames. 8 of 11 tests fail or time out.
main.ymlis unaffected because it builds librealsense from thedevelopmentbranch.test_rosbag_db3_play_test.pyused to guard against exactly this ("rosdistro's librealsense2 may predate the bag-to-db3 converter"), but that probe did not survive the migration.Summary
realsense2_camera/test/conftest.py(43 lines, 13 of them the license header), which skips everyrosbag-marked test when the installed librealsense2 cannot read compressed.db3./compressedDepthtopic suffix rather than comparing versions: a source build ofdevelopmentreports 2.58.0, lower than the released 2.58.4 that lacks the support, so a version floor would skip the tests exactly where they pass.@pytest.mark.rosbag.The guard becomes inert on its own once a librealsense2 package containing #15556 reaches the ROS servers.
Test plan
pre-release(humble/jazzy/kilted) reports the rosbag tests as skipped instead of the current 8 failures.CIandCI - Rollingstay green — they build librealsense fromdevelopment, so the probe must let the tests run there.Both are readable from this PR's own checks; the second is the one that proves the probe does not over-skip.
🤖 Generated by AI