Skip to content

bug: test/cmocka: test_core_module_load's child runs on the C libobs in Tier 2 mode ON #1614

Closed

Description

@rdoupe

Test-infrastructure bug in this fork, not an upstream OBS bug and not user-visible: no upstream issue and no reporter. Found while reviewing how the Tier 2 lanes select a libobs. Since #750, test_core_module_load has checked core-module loading against the C libobs only, in both Tier 2 modes.

Location

  • test/cmocka/test_core_module_load.c, run_scenario(): the forked child calls unsetenv("LD_LIBRARY_PATH") before it execs the copy of the test (--child). That keeps core_module_stub_needs_dep.so's missing dependency out of reach, as libcef.so was in bug: libobs: OBS refuses to start when one core module can't be loaded (obs-browser.so without libcef.so), and a missing core module skips the ones after it #749.
  • rust/tools/linux-validate/validate.sh: mode ON selects libobs-with-rust only by putting <build>/libobs-with-rust first on LD_LIBRARY_PATH. The test binaries are linked with a RUNPATH (--enable-new-dtags) that names <build>/libobs, and that RUNPATH yields to LD_LIBRARY_PATH.
  • With LD_LIBRARY_PATH cleared, the child resolves libobs.so.30 through its RUNPATH, which is the C libobs. The lane's own check (ldd on test_bitstream) and the parent process both see libobs-with-rust, so nothing fails.

Class

Test gap. In mode ON, all three scenarios (all_present, missing_dependency, missing_file) run obs_startup() and obs_load_core_modules() on the C libobs, so a Rust-side regression in core-module loading would go unnoticed. No product code is affected.

How it is reached

Every Tier 2 mode ON run (CI's Linux Tier 2 jobs, OBS_TIER2_MODES=ON or the default OFF ON), whenever test_core_module_load is in the shard. Only Linux builds the test. macOS selects through DYLD_FRAMEWORK_PATH, and no test there clears it. No other cmocka test clears LD_LIBRARY_PATH or re-runs a libobs binary with a reset environment. The other tests that start children (pipe, pulse, v4l2, nvenc) launch shells or helpers, and those inherit the environment.

Reproduced on master

Master 819a325, both build lanes (ENABLE_RUST_LIBOBS OFF and ON), headless (private Xvfb, private D-Bus). Mode ON is the lane's LD_LIBRARY_PATH=<build>/libobs-with-rust. LD_DEBUG=libs shows which libobs.so.30 each process initializes:

Build Mode Parent maps Each child maps
master, C lane ON libobs-with-rust/libobs.so.30 libobs/libobs.so.30 (C)
master, Rust lane ON libobs-with-rust/libobs.so.30 libobs/libobs.so.30 (C)
master, both lanes OFF libobs/libobs.so.30 libobs/libobs.so.30

Fix

Before it forks, the parent finds the libobs.so it runs on in /proc/self/maps. The child then gets an LD_LIBRARY_PATH of that directory alone instead of none, so it runs on the libobs the lane selected. The missing dependency stays out of reach: it is in test/cmocka/, not next to libobs. A new case, same_libobs, compares the libobs the child mapped with the parent's. The three existing cases keep their expectations. PR follows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions