Repository navigation
test/cmocka: Build the tests against cmocka 1.1 - #2201
Merged
Merged
Conversation
…t#2197) Debian 13 and Ubuntu 24.04/25.10 ship cmocka 1.1.7. CI's Ubuntu 26.04 has 2.0.2, so a test that uses a name new in cmocka 2.0 builds in CI but not on those systems. Three XComposite tests use assert_int_in_range(), which cmocka 1.1.7 does not have. The check fails for each use of a cmocka 2.x-only name in test/cmocka, unless the file includes cmocka-compat.h and that header maps the name. It fails now for the 5 assert_int_in_range() uses. Refs obs-rust#2197 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Four tests did not build with cmocka 1.1.7, the version in Debian 13 and Ubuntu 24.04/25.10: - test_obs_ffmpeg_net_host.c used true without <stdbool.h>. The cmocka 2.x cmocka.h includes it; the 1.1.7 cmocka.h does not. - The three XComposite tests used assert_int_in_range(), which is new in cmocka 2.0. cmocka-compat.h defines assert_int_in_range() with assert_in_range() when cmocka does not define it, so it does nothing with cmocka 2.x. All 5 ranges have a minimum of 0 or more, so the unsigned compare of 1.1 gives the same result. find_package() now asks for cmocka 1.1 or newer (both 1.1.7 and 2.0.2 accept any newer version request). ci/test_cmocka_compat.py passes. Fixes obs-rust#2197 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2197
What and why
Four tests in
test/cmockadid not build with cmocka 1.1.7, the version in Debian 13 and Ubuntu 24.04/25.10. CI did not see this, because its Ubuntu 26.04 has cmocka 2.0.2. This PR does option A, as decided on #2197:test_obs_ffmpeg_net_host.cincludes<stdbool.h>. The cmocka 2.xcmocka.hincludes it; the 1.1.7cmocka.hdoes not.test/cmocka/cmocka-compat.hdefinesassert_int_in_range()withassert_in_range(), under#ifndef assert_int_in_range. With cmocka 2.x it does nothing. The 3 XComposite tests include it. All 5 ranges have a minimum of 0 or more, so the unsigned compare of 1.1 gives the same result.find_package(CMocka 1.1 CONFIG REQUIRED). The config-version files of 1.1.7 and 2.0.2 both useAnyNewerVersion, so both accept the request.ci/test_cmocka_compat.py, so that this does not come back: it fails for each use of a cmocka 2.x-only name intest/cmocka(140 public names that the 2.0.2cmocka.hhas and the 1.1.7cmocka.hdoes not), unless the file includescmocka-compat.hand the header maps the name. It runs with the otherci/test_*.pyfiles.RED → GREEN
ci/test_cmocka_compat.py: 1 of 2 fails, with the 5assert_int_in_range()uses in the 3 XComposite tests. On Debian 13 (gcc 14.2,libcmocka-dev1.1.7-3+b1),cmocka-testswith-k 0: 4 objects fail ('true' undeclared, and 3 × implicit declaration ofassert_int_in_range).ci/test_cmocka_compat.py: 2 of 2 pass. On Debian 13, configure accepts cmocka 1.1.7, and all ofcmocka-testsbuilds (0 failures). Under ctest and Xvfb,test_obs_ffmpeg_net_host3/3,test_xcomposite_presence4/4,test_xcomposite_search_backoff4/4,test_xcomposite_window_events1/1 andtest_xcomposite_error_replies2/2 pass. PR CI covers cmocka 2.x.Checklist
master-W..., ratchets): noneNotes:
ci/local_gate.py --only clang-format --only gersemi) pass. The wholeci/test_*.pysuite on macOS gives the same 47 failures and errors as master (environment), and no new ones.true/falsemust reach<stdbool.h>itself. A static include scan gave 22 false positives on master, so only a build against cmocka 1.1.7 shows this reliably. A Tier 2 build against 1.1.7 (for example in adebian:13container) is the optional follow-up that bug: test/cmocka: 4 tests do not build with cmocka 1.1.7 (Debian 13, Ubuntu 24.04) #2197 names; it is not in this PR.AI note: Claude Code (Claude Opus 5.5) wrote the code, the check, the commit messages and this text under the submitter's direction, and ran the tests above on the submitter's machines.
🤖 Generated with Claude Code