Repository navigation
Description
Location
With ENABLE_UNIT_TESTS=ON, 4 test files do not compile against cmocka 1.1.7. They use cmocka 2.x behavior.
test/cmocka/test_obs_ffmpeg_net_host.c:40(from obs-ffmpeg: SRT/URL host code behind hosts/<os>/obs-ffmpeg-net-host.h, AMF PCH named for its host (#853) #2068):assert_true(true);, but the file does not include<stdbool.h>. The cmocka 2.xcmocka.hincludes<stdbool.h>; the 1.1.7cmocka.hdoes not.error: 'true' undeclared (first use in this function)assert_int_in_range()is new in cmocka 2.0. cmocka 1.1.7 has onlyassert_in_range().test/cmocka/test_xcomposite_presence.c:58(linux-capture: XComposite tracks window state from X events instead of a round trip per frame (#1356) #1377)test/cmocka/test_xcomposite_search_backoff.c:70(linux-capture: XComposite backs off the window search while the window is unmapped (#1357) #1366)test/cmocka/test_xcomposite_window_events.c:238,:244,:255(linux-capture: XComposite tracks window state from X events instead of a round trip per frame (#1356) #1377)
error: implicit declaration of function 'assert_int_in_range'; did you mean 'assert_not_in_range'? [-Wimplicit-function-declaration]
test/cmocka/CMakeLists.txt:3 has find_package(CMocka CONFIG REQUIRED) with no version. Thus configure accepts 1.1.7, and the build stops later.
Class
Build failure (portability). No runtime effect.
How it is reached
Build master (1eaa4e1ff) on Debian 13 (gcc 14.2, libcmocka-dev 1.1.7-3) with ENABLE_UNIT_TESTS=ON, and build target cmocka-tests (-k 0). Result: 4 FAILED: objects, the 4 files above. All other tests build.
CI does not see this: the Linux jobs run on Ubuntu 26.04, which has cmocka 2.0.2. Ubuntu 24.04 and 25.10 have 1.1.7-3, the same as Debian 13.
Proposed fix and failing test
Decision needed: which cmocka versions do the tests support?
- A. Support 1.1.7 (recommended). Add
#include <stdbool.h>totest_obs_ffmpeg_net_host.c. Add a small compat header (for exampletest/cmocka/cmocka-compat.h) that definesassert_int_in_range()withassert_in_range()when cmocka does not define it, and include it in the 3 xcomposite tests. All 5 ranges have a minimum of 0 or more, so the unsignedassert_in_range()of 1.1.7 gives the same result. With cmocka 2.x the header does nothing, so the deprecatedassert_in_range()is not used there. - B. Require cmocka 2.0.
find_package(CMocka 2.0 CONFIG REQUIRED), and document it in the build docs. Debian 13 and Ubuntu 24.04 builds then stop at configure with a clear message. Nothing else changes.
Test (RED → GREEN): a CI job, or a Tier 2 step, that builds cmocka-tests against cmocka 1.1.7 (for example in a debian:13 container). RED on master: the 4 objects above fail. GREEN with A: the target builds, and the 4 tests pass. With B, the check is that configure fails with the version message.
I can make the PR for A (or B) after a decision.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
vpacher commentedon Oct 24, 2026
Claiming: #2197
Decision needed: which cmocka versions do the tests support? A: keep cmocka 1.1.7 working (
<stdbool.h>intest_obs_ffmpeg_net_host.c, and a compat header that mapsassert_int_in_range()toassert_in_range()when cmocka 1.x does not define it). B: require cmocka 2.0 infind_package, so configure stops on Debian 13 and Ubuntu 24.04. I recommend A. The PR waits for the answer.zackees commentedon Oct 24, 2026
Decided: A, keep cmocka 1.1.7 working.
<stdbool.h>totest_obs_ffmpeg_net_host.c.assert_int_in_range→assert_in_rangemapping in one compat header guarded by#ifndef assert_int_in_range, so it does nothing on 2.x.find_packageaccept 1.1, and add a check if you can (for example a Tier 2 configure that builds the tests against 1.1.7 headers). That's optional for this PR.(Coordinator decision.)
test/cmocka: Build the tests against cmocka 1.1 (obs-rust#2201)