Stop building the libgit2 test suite on every build - #108
Merged
hannesa2 merged 1 commit intoSep 21, 2026
Merged
Conversation
The flag meant to switch the Clar tests off has not matched the option libgit2 declares since its 1.x rename, so every build compiles a test suite that is never run. - Pass -DBUILD_TESTS:BOOL=OFF, the name the pinned libgit2 declares, in place of the -DBUILD_CLAR:BOOL=OFF that now matches nothing. - Leave the rest of the configure line untouched: BUILD_TESTS gates only enable_testing() and the tests subdirectory, never src, so the archive this script installs is unchanged.
goneng
added a commit
to goneng/gitx
that referenced
this pull request
Sep 21, 2026
Every GitX build runs libgit2's cmake build, which compiled a Clar test suite that is never run, because the flag meant to switch it off stopped matching libgit2's own option name at the 1.x rename. - Move the objective-git pointer onto gitx/objective-git#108, which passes -DBUILD_TESTS:BOOL=OFF in place of the dead -DBUILD_CLAR:BOOL=OFF and cuts 471 of the 667 objects the build compiles. - Take that fix alone rather than the current objective-git master, which has since moved on to unrelated work in gitx#107.
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.
The flag meant to switch the Clar tests off has not matched the option
libgit2 declares since its 1.x rename, so every build compiles a test
suite that is never run.
-DBUILD_TESTS:BOOL=OFF, the name the pinned libgit2 declares, inplace of the
-DBUILD_CLAR:BOOL=OFFthat now matches nothing.BUILD_TESTSgates onlyenable_testing()and thetestssubdirectory, neversrc, so thearchive this script installs is unchanged.
Why the flag stopped working
libgit2 renamed the option in its 1.x line. The pinned 1.9.7 declares
at
CMakeLists.txt:23, andBUILD_CLARappears nowhere in the tree.cmake accepts the unknown
-Dwithout complaint, caches it, and warnsabout it only if you ask, so the line has read as if it were doing its
job.
BUILD_TESTSdefaults toON, so the suite has been built on everyrun since the bump.
Nothing consumes it.
script/update_libgit2installslibgit2.aandnothing else, and this repo's own workflow has the
Test projectstepcommented out, so the Clar binaries were compiled and then discarded on
every CI run on both architectures.
The one other thing
BUILD_TESTSgates istests/headertest, acompile-only self-containment check over libgit2's own headers. That is
worth having upstream, where the headers are edited, but not here, where
libgit2 is a pinned submodule we do not modify.
Measurements
Timed back to back on an Intel Mac, same checkout,
rm -rf buildbothtimes as the script always does:
471 of the 667 objects, 71%, were the test suite, and this script runs
from an Xcode Run Script phase as well as from CI.
On the CI runners, comparing the
Run script/update_libgit2step of thisPR against the same step on master at 442b5dd:
Less than the nine minutes above, in proportion as well as absolutely:
the runners are much faster than the machine that produced the first
table, and a fixed slice of that step is cmake's configure probes, which
this change does not touch.
The logs confirm the same per-build object counts there as locally: 196
objects with none of them tests, against 667 with 470 tests on master.
Note that each job builds libgit2 twice over, once in the
Run script/update_libgit2step and again from the Xcode Run Scriptphase during
Archive project, each time from scratch because thescript always does
rm -rf build. So the saving above lands twice perjob, and the x86_64 job compiles 392 objects here against 1334 on
master.
Test plan
External/libgit2.ais the same size to the byte, 6,433,360, andexports an identical set of 2,097 global text symbols, diffed via
nm -g.libgit2_tests.diror
util_tests.dirobjects, and that the 196 remaining objects are thesame library objects as before,
headertest.c.oexcepted.script/update_libgit2is what theBuildjob runs on bothmacos-15-intelandmacos-26, so CI exercises this directly on botharchitectures through to
xcodebuild archive.Not addressed here
The script still does
rm -rf buildand reconfigures from scratch onevery invocation, so it pays the remaining 7m40s even when nothing
changed. #97 is the change for that, and the two are independent: this
one shrinks the rebuild, that one avoids it. Worth noting that #97 as it
stands also adds
EXCLUDED_ARCHS = x86_64to four build configurations,which would stop the project building on Intel hardware.