* [PATCH 0/2] meson-windows-test ci output fixes @ 2025-11-18 9:32 Jeff King 2025-11-18 9:32 ` [PATCH 1/2] unit-test: ignore --no-chain-lint Jeff King 2025-11-18 9:35 ` [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs Jeff King 0 siblings, 2 replies; 4+ messages in thread From: Jeff King @ 2025-11-18 9:32 UTC (permalink / raw) To: git I ran into a failed test a month or two ago that triggered only on the windows-meson-test jobs. But those jobs don't actually show you any output from the test scripts! This is what I hacked up to improve things. [1/2]: unit-test: ignore --no-chain-lint [2/2]: ci(windows-meson-test): handle options and output like other test jobs .github/workflows/main.yml | 12 +++++++++++- ci/run-test-slice-meson.sh | 13 +++++++++++++ t/unit-tests/unit-test.c | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 ci/run-test-slice-meson.sh -Peff ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] unit-test: ignore --no-chain-lint 2025-11-18 9:32 [PATCH 0/2] meson-windows-test ci output fixes Jeff King @ 2025-11-18 9:32 ` Jeff King 2025-11-18 9:35 ` [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs Jeff King 1 sibling, 0 replies; 4+ messages in thread From: Jeff King @ 2025-11-18 9:32 UTC (permalink / raw) To: git In the same spirit as 9faf3963b6 (t: introduce compatibility options to clar-based tests, 2024-12-13), we should ignore --no-chain-lint passed to our clar tests, since it may appear in GIT_TEST_OPTS to be used with other tests. This is particularly important on Windows CI, where --no-chain-lint is added to the test options by default, and the meson build will pass all options to the unit tests. The only reason our meson Windows CI job does not run into this currently is that it is not respecting GIT_TEST_OPTS at all! So ignoring this option is a prerequisite to fixing that situation. Signed-off-by: Jeff King <peff@peff•net> --- t/unit-tests/unit-test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c index 5af645048a..752fb38fb3 100644 --- a/t/unit-tests/unit-test.c +++ b/t/unit-tests/unit-test.c @@ -29,6 +29,7 @@ int cmd_main(int argc, const char **argv) OPT_NOOP_NOARG('d', "debug"), OPT_NOOP_NOARG(0, "github-workflow-markup"), OPT_NOOP_NOARG(0, "no-bin-wrappers"), + OPT_NOOP_ARG(0, "no-chain-lint"), OPT_NOOP_ARG(0, "root"), OPT_NOOP_ARG(0, "stress"), OPT_NOOP_NOARG(0, "tee"), -- 2.52.0.278.gadc6434dc3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs 2025-11-18 9:32 [PATCH 0/2] meson-windows-test ci output fixes Jeff King 2025-11-18 9:32 ` [PATCH 1/2] unit-test: ignore --no-chain-lint Jeff King @ 2025-11-18 9:35 ` Jeff King 2025-11-25 17:39 ` Johannes Schindelin 1 sibling, 1 reply; 4+ messages in thread From: Jeff King @ 2025-11-18 9:35 UTC (permalink / raw) To: git The GitHub windows-meson-test jobs directly run "meson test" with the --slice option. This means they skip all of the ci/lib.sh infrastructure, and in particular: 1. They do not actually set any GIT_TEST_OPTS like --verbose-log or -x. 2. They do not do the usual handle_failed_tests() magic to print test failures or tar up failed directories. As a result, you get almost no feedback at all when a test fails in this job, making debugging rather tricky. Let's try to make this behave more like the other CI jobs. Because we're on Windows, we can't just use the normal run-build-and-tests.sh script. Our build runs as a separate job (like the non-meson Windows job), and then we parallelize the tests across several job slices. So we need something like the run-test-slice.sh script that the "windows-test" job uses. In theory we could just swap out the "make" invocation there for "meson". But it doesn't quite work, because "make" knows how to pull GIT_TEST_OPTS out of GIT-BUILD-OPTIONS automatically. But for meson, we have to extract them into the --test-args option ourselves. I tried making the logic in run-test-slice.sh conditional, but there ended up being hardly any common code at all (and there are some tricky ordering constraints). So I added up with a new meson-specific test-slice runner. Signed-off-by: Jeff King <peff@peff•net> --- BTW, one curiosity. I tried swapping out "pwsh" as the shell for "bash", to match what the non-meson test does. And it _mostly_ works, but curiously it causes a handful of mergetool tests to fail (it looks like maybe "c:\foo" Windows-style paths get used where we expect "/c/foo" paths). I didn't dig further, and just added it to my "things that confuse and terrify me about Windows" list. .github/workflows/main.yml | 12 +++++++++++- ci/run-test-slice-meson.sh | 13 +++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 ci/run-test-slice-meson.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 816d5a34c4..27ebf2c8cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -298,7 +298,17 @@ jobs: path: build - name: Test shell: pwsh - run: meson test -C build --no-rebuild --print-errorlogs --slice "$(1+${{ matrix.nr }})/10" + run: ci/run-test-slice-meson.sh build ${{matrix.nr}} 10 + - name: print test failures + if: failure() && env.FAILED_TEST_ARTIFACTS != '' + shell: bash + run: ci/print-test-failures.sh + - name: Upload failed tests' directories + if: failure() && env.FAILED_TEST_ARTIFACTS != '' + uses: actions/upload-artifact@v4 + with: + name: failed-tests-windows-meson-${{ matrix.nr }} + path: ${{env.FAILED_TEST_ARTIFACTS}} regular: name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) diff --git a/ci/run-test-slice-meson.sh b/ci/run-test-slice-meson.sh new file mode 100755 index 0000000000..961c94fba0 --- /dev/null +++ b/ci/run-test-slice-meson.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# We must load the build options so we know where to find +# things like TEST_OUTPUT_DIRECTORY. This has to come before +# loading lib.sh, though, because it may clobber some CI lib +# variables like our custom GIT_TEST_OPTS. +. "$1"/GIT-BUILD-OPTIONS +. ${0%/*}/lib.sh + +group "Run tests" \ + meson test -C "$1" --no-rebuild --print-errorlogs \ + --test-args="$GIT_TEST_OPTS" --slice "$((1+$2))/$3" || +handle_failed_tests -- 2.52.0.278.gadc6434dc3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs 2025-11-18 9:35 ` [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs Jeff King @ 2025-11-25 17:39 ` Johannes Schindelin 0 siblings, 0 replies; 4+ messages in thread From: Johannes Schindelin @ 2025-11-25 17:39 UTC (permalink / raw) To: Jeff King; +Cc: git Hi Jeff, On Tue, 18 Nov 2025, Jeff King wrote: > The GitHub windows-meson-test jobs directly run "meson test" with the > --slice option. This means they skip all of the ci/lib.sh > infrastructure, and in particular: > > 1. They do not actually set any GIT_TEST_OPTS like --verbose-log or > -x. > > 2. They do not do the usual handle_failed_tests() magic to print test > failures or tar up failed directories. > > As a result, you get almost no feedback at all when a test fails in this > job, making debugging rather tricky. > > Let's try to make this behave more like the other CI jobs. Because we're > on Windows, we can't just use the normal run-build-and-tests.sh script. > Our build runs as a separate job (like the non-meson Windows job), and > then we parallelize the tests across several job slices. So we need > something like the run-test-slice.sh script that the "windows-test" job > uses. > > In theory we could just swap out the "make" invocation there for > "meson". But it doesn't quite work, because "make" knows how to pull > GIT_TEST_OPTS out of GIT-BUILD-OPTIONS automatically. But for meson, we > have to extract them into the --test-args option ourselves. I tried > making the logic in run-test-slice.sh conditional, but there ended up > being hardly any common code at all (and there are some tricky ordering > constraints). So I added up with a new meson-specific test-slice runner. > > Signed-off-by: Jeff King <peff@peff•net> > --- Thank you for fixing this. The patch looks good to me. I cannot help but wonder whether switching to Meson was worth it, as we're not only deviating from the mainstream (if MSYS2 is any indication, Meson usage is negligible: 16 packages use it in MSYS2, 294 use CMake, and 975 use GNU make), but also are forced to repeat the very same steps we already took for `make`-based builds and then for CMake builds. This very much makes me think of some saying I vaguely remember that involves history and something about repetitions. > BTW, one curiosity. I tried swapping out "pwsh" as the shell for "bash", > to match what the non-meson test does. And it _mostly_ works, but > curiously it causes a handful of mergetool tests to fail (it looks like > maybe "c:\foo" Windows-style paths get used where we expect "/c/foo" > paths). I didn't dig further, and just added it to my "things that > confuse and terrify me about Windows" list. Indeed, the path conversion kicks in, where `/mingw64` gets converted to `D:\git-for-windows-minimal\mingw64` or something like that so that PowerShell isn't losing its mind over paths that simply don't exist. When you then call Bash (implicitly, as you know all too well Git's test suite depends on it in a major way, which is still a shame), this conversion is not reverted, at least not fully. Ciao, Johannes > > .github/workflows/main.yml | 12 +++++++++++- > ci/run-test-slice-meson.sh | 13 +++++++++++++ > 2 files changed, 24 insertions(+), 1 deletion(-) > create mode 100755 ci/run-test-slice-meson.sh > > diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml > index 816d5a34c4..27ebf2c8cc 100644 > --- a/.github/workflows/main.yml > +++ b/.github/workflows/main.yml > @@ -298,7 +298,17 @@ jobs: > path: build > - name: Test > shell: pwsh > - run: meson test -C build --no-rebuild --print-errorlogs --slice "$(1+${{ matrix.nr }})/10" > + run: ci/run-test-slice-meson.sh build ${{matrix.nr}} 10 > + - name: print test failures > + if: failure() && env.FAILED_TEST_ARTIFACTS != '' > + shell: bash > + run: ci/print-test-failures.sh > + - name: Upload failed tests' directories > + if: failure() && env.FAILED_TEST_ARTIFACTS != '' > + uses: actions/upload-artifact@v4 > + with: > + name: failed-tests-windows-meson-${{ matrix.nr }} > + path: ${{env.FAILED_TEST_ARTIFACTS}} > > regular: > name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}}) > diff --git a/ci/run-test-slice-meson.sh b/ci/run-test-slice-meson.sh > new file mode 100755 > index 0000000000..961c94fba0 > --- /dev/null > +++ b/ci/run-test-slice-meson.sh > @@ -0,0 +1,13 @@ > +#!/bin/sh > + > +# We must load the build options so we know where to find > +# things like TEST_OUTPUT_DIRECTORY. This has to come before > +# loading lib.sh, though, because it may clobber some CI lib > +# variables like our custom GIT_TEST_OPTS. > +. "$1"/GIT-BUILD-OPTIONS > +. ${0%/*}/lib.sh > + > +group "Run tests" \ > + meson test -C "$1" --no-rebuild --print-errorlogs \ > + --test-args="$GIT_TEST_OPTS" --slice "$((1+$2))/$3" || > +handle_failed_tests > -- > 2.52.0.278.gadc6434dc3 > > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-25 17:39 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-11-18 9:32 [PATCH 0/2] meson-windows-test ci output fixes Jeff King 2025-11-18 9:32 ` [PATCH 1/2] unit-test: ignore --no-chain-lint Jeff King 2025-11-18 9:35 ` [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs Jeff King 2025-11-25 17:39 ` Johannes Schindelin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox