{"thread":{"id":"64504","subject":"[PATCH 0/2] meson-windows-test ci output fixes","startedAt":"2025-11-18T09:32:22Z","lastAt":"2025-11-25T17:39:59Z","messageCount":4,"participants":["Jeff King","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"530889","messageId":"20251118093221.GA530337@coredump.intra.peff.net","threadId":"64504","inReplyTo":null,"subject":"[PATCH 0/2] meson-windows-test ci output fixes","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-11-18T09:32:21Z","receivedAt":"2025-11-18T09:32:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"I ran into a failed test a month or two ago that triggered only on the\nwindows-meson-test jobs. But those jobs don't actually show you any\noutput from the test scripts!\n\nThis is what I hacked up to improve things.\n\n  [1/2]: unit-test: ignore --no-chain-lint\n  [2/2]: ci(windows-meson-test): handle options and output like other test jobs\n\n .github/workflows/main.yml | 12 +++++++++++-\n ci/run-test-slice-meson.sh | 13 +++++++++++++\n t/unit-tests/unit-test.c   |  1 +\n 3 files changed, 25 insertions(+), 1 deletion(-)\n create mode 100755 ci/run-test-slice-meson.sh\n\n-Peff\n"},{"id":"530890","messageId":"20251118093243.GA530438@coredump.intra.peff.net","threadId":"64504","inReplyTo":"20251118093221.GA530337@coredump.intra.peff.net","subject":"[PATCH 1/2] unit-test: ignore --no-chain-lint","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-11-18T09:32:43Z","receivedAt":"2025-11-18T09:32:44Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"In the same spirit as 9faf3963b6 (t: introduce compatibility options to\nclar-based tests, 2024-12-13), we should ignore --no-chain-lint passed\nto our clar tests, since it may appear in GIT_TEST_OPTS to be used with\nother tests.\n\nThis is particularly important on Windows CI, where --no-chain-lint is\nadded to the test options by default, and the meson build will pass all\noptions to the unit tests. The only reason our meson Windows CI job does\nnot run into this currently is that it is not respecting GIT_TEST_OPTS\nat all! So ignoring this option is a prerequisite to fixing that\nsituation.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n t/unit-tests/unit-test.c | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/t/unit-tests/unit-test.c b/t/unit-tests/unit-test.c\nindex 5af645048a..752fb38fb3 100644\n--- a/t/unit-tests/unit-test.c\n+++ b/t/unit-tests/unit-test.c\n@@ -29,6 +29,7 @@ int cmd_main(int argc, const char **argv)\n \t\tOPT_NOOP_NOARG('d', \"debug\"),\n \t\tOPT_NOOP_NOARG(0, \"github-workflow-markup\"),\n \t\tOPT_NOOP_NOARG(0, \"no-bin-wrappers\"),\n+\t\tOPT_NOOP_ARG(0, \"no-chain-lint\"),\n \t\tOPT_NOOP_ARG(0, \"root\"),\n \t\tOPT_NOOP_ARG(0, \"stress\"),\n \t\tOPT_NOOP_NOARG(0, \"tee\"),\n-- \n2.52.0.278.gadc6434dc3\n\n"},{"id":"530891","messageId":"20251118093519.GB530438@coredump.intra.peff.net","threadId":"64504","inReplyTo":"20251118093221.GA530337@coredump.intra.peff.net","subject":"[PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2025-11-18T09:35:19Z","receivedAt":"2025-11-18T09:35:22Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"The GitHub windows-meson-test jobs directly run \"meson test\" with the\n--slice option. This means they skip all of the ci/lib.sh\ninfrastructure, and in particular:\n\n  1. They do not actually set any GIT_TEST_OPTS like --verbose-log or\n     -x.\n\n  2. They do not do the usual handle_failed_tests() magic to print test\n     failures or tar up failed directories.\n\nAs a result, you get almost no feedback at all when a test fails in this\njob, making debugging rather tricky.\n\nLet's try to make this behave more like the other CI jobs. Because we're\non Windows, we can't just use the normal run-build-and-tests.sh script.\nOur build runs as a separate job (like the non-meson Windows job), and\nthen we parallelize the tests across several job slices. So we need\nsomething like the run-test-slice.sh script that the \"windows-test\" job\nuses.\n\nIn theory we could just swap out the \"make\" invocation there for\n\"meson\". But it doesn't quite work, because \"make\" knows how to pull\nGIT_TEST_OPTS out of GIT-BUILD-OPTIONS automatically. But for meson, we\nhave to extract them into the --test-args option ourselves. I tried\nmaking the logic in run-test-slice.sh conditional, but there ended up\nbeing hardly any common code at all (and there are some tricky ordering\nconstraints). So I added up with a new meson-specific test-slice runner.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\nBTW, one curiosity. I tried swapping out \"pwsh\" as the shell for \"bash\",\nto match what the non-meson test does. And it _mostly_ works, but\ncuriously it causes a handful of mergetool tests to fail (it looks like\nmaybe \"c:\\foo\" Windows-style paths get used where we expect \"/c/foo\"\npaths). I didn't dig further, and just added it to my \"things that\nconfuse and terrify me about Windows\" list.\n\n .github/workflows/main.yml | 12 +++++++++++-\n ci/run-test-slice-meson.sh | 13 +++++++++++++\n 2 files changed, 24 insertions(+), 1 deletion(-)\n create mode 100755 ci/run-test-slice-meson.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 816d5a34c4..27ebf2c8cc 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -298,7 +298,17 @@ jobs:\n         path: build\n     - name: Test\n       shell: pwsh\n-      run: meson test -C build --no-rebuild --print-errorlogs --slice \"$(1+${{ matrix.nr }})/10\"\n+      run: ci/run-test-slice-meson.sh build ${{matrix.nr}} 10\n+    - name: print test failures\n+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n+      shell: bash\n+      run: ci/print-test-failures.sh\n+    - name: Upload failed tests' directories\n+      if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n+      uses: actions/upload-artifact@v4\n+      with:\n+        name: failed-tests-windows-meson-${{ matrix.nr }}\n+        path: ${{env.FAILED_TEST_ARTIFACTS}}\n \n   regular:\n     name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})\ndiff --git a/ci/run-test-slice-meson.sh b/ci/run-test-slice-meson.sh\nnew file mode 100755\nindex 0000000000..961c94fba0\n--- /dev/null\n+++ b/ci/run-test-slice-meson.sh\n@@ -0,0 +1,13 @@\n+#!/bin/sh\n+\n+# We must load the build options so we know where to find\n+# things like TEST_OUTPUT_DIRECTORY. This has to come before\n+# loading lib.sh, though, because it may clobber some CI lib\n+# variables like our custom GIT_TEST_OPTS.\n+. \"$1\"/GIT-BUILD-OPTIONS\n+. ${0%/*}/lib.sh\n+\n+group \"Run tests\" \\\n+\tmeson test -C \"$1\" --no-rebuild --print-errorlogs \\\n+\t\t--test-args=\"$GIT_TEST_OPTS\" --slice \"$((1+$2))/$3\" ||\n+handle_failed_tests\n-- \n2.52.0.278.gadc6434dc3\n"},{"id":"531267","messageId":"a15a12e5-9099-f43b-fa11-e18d53759c1b@gmx.de","threadId":"64504","inReplyTo":"20251118093519.GB530438@coredump.intra.peff.net","subject":"Re: [PATCH 2/2] ci(windows-meson-test): handle options and output like other test jobs","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2025-11-25T17:39:57Z","receivedAt":"2025-11-25T17:39:59Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Jeff,\n\nOn Tue, 18 Nov 2025, Jeff King wrote:\n\n> The GitHub windows-meson-test jobs directly run \"meson test\" with the\n> --slice option. This means they skip all of the ci/lib.sh\n> infrastructure, and in particular:\n> \n>   1. They do not actually set any GIT_TEST_OPTS like --verbose-log or\n>      -x.\n> \n>   2. They do not do the usual handle_failed_tests() magic to print test\n>      failures or tar up failed directories.\n> \n> As a result, you get almost no feedback at all when a test fails in this\n> job, making debugging rather tricky.\n> \n> Let's try to make this behave more like the other CI jobs. Because we're\n> on Windows, we can't just use the normal run-build-and-tests.sh script.\n> Our build runs as a separate job (like the non-meson Windows job), and\n> then we parallelize the tests across several job slices. So we need\n> something like the run-test-slice.sh script that the \"windows-test\" job\n> uses.\n> \n> In theory we could just swap out the \"make\" invocation there for\n> \"meson\". But it doesn't quite work, because \"make\" knows how to pull\n> GIT_TEST_OPTS out of GIT-BUILD-OPTIONS automatically. But for meson, we\n> have to extract them into the --test-args option ourselves. I tried\n> making the logic in run-test-slice.sh conditional, but there ended up\n> being hardly any common code at all (and there are some tricky ordering\n> constraints). So I added up with a new meson-specific test-slice runner.\n> \n> Signed-off-by: Jeff King <peff@peff.net>\n> ---\n\nThank you for fixing this. The patch looks good to me.\n\nI cannot help but wonder whether switching to Meson was worth it, as we're\nnot only deviating from the mainstream (if MSYS2 is any indication, Meson\nusage is negligible: 16 packages use it in MSYS2, 294 use CMake, and 975\nuse GNU make), but also are forced to repeat the very same steps we\nalready took for `make`-based builds and then for CMake builds. This very\nmuch makes me think of some saying I vaguely remember that involves\nhistory and something about repetitions.\n\n> BTW, one curiosity. I tried swapping out \"pwsh\" as the shell for \"bash\",\n> to match what the non-meson test does. And it _mostly_ works, but\n> curiously it causes a handful of mergetool tests to fail (it looks like\n> maybe \"c:\\foo\" Windows-style paths get used where we expect \"/c/foo\"\n> paths). I didn't dig further, and just added it to my \"things that\n> confuse and terrify me about Windows\" list.\n\nIndeed, the path conversion kicks in, where `/mingw64` gets converted to\n`D:\\git-for-windows-minimal\\mingw64` or something like that so that\nPowerShell isn't losing its mind over paths that simply don't exist. When\nyou then call Bash (implicitly, as you know all too well Git's test suite\ndepends on it in a major way, which is still a shame), this conversion is\nnot reverted, at least not fully.\n\nCiao,\nJohannes\n\n> \n>  .github/workflows/main.yml | 12 +++++++++++-\n>  ci/run-test-slice-meson.sh | 13 +++++++++++++\n>  2 files changed, 24 insertions(+), 1 deletion(-)\n>  create mode 100755 ci/run-test-slice-meson.sh\n> \n> diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\n> index 816d5a34c4..27ebf2c8cc 100644\n> --- a/.github/workflows/main.yml\n> +++ b/.github/workflows/main.yml\n> @@ -298,7 +298,17 @@ jobs:\n>          path: build\n>      - name: Test\n>        shell: pwsh\n> -      run: meson test -C build --no-rebuild --print-errorlogs --slice \"$(1+${{ matrix.nr }})/10\"\n> +      run: ci/run-test-slice-meson.sh build ${{matrix.nr}} 10\n> +    - name: print test failures\n> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n> +      shell: bash\n> +      run: ci/print-test-failures.sh\n> +    - name: Upload failed tests' directories\n> +      if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n> +      uses: actions/upload-artifact@v4\n> +      with:\n> +        name: failed-tests-windows-meson-${{ matrix.nr }}\n> +        path: ${{env.FAILED_TEST_ARTIFACTS}}\n>  \n>    regular:\n>      name: ${{matrix.vector.jobname}} (${{matrix.vector.pool}})\n> diff --git a/ci/run-test-slice-meson.sh b/ci/run-test-slice-meson.sh\n> new file mode 100755\n> index 0000000000..961c94fba0\n> --- /dev/null\n> +++ b/ci/run-test-slice-meson.sh\n> @@ -0,0 +1,13 @@\n> +#!/bin/sh\n> +\n> +# We must load the build options so we know where to find\n> +# things like TEST_OUTPUT_DIRECTORY. This has to come before\n> +# loading lib.sh, though, because it may clobber some CI lib\n> +# variables like our custom GIT_TEST_OPTS.\n> +. \"$1\"/GIT-BUILD-OPTIONS\n> +. ${0%/*}/lib.sh\n> +\n> +group \"Run tests\" \\\n> +\tmeson test -C \"$1\" --no-rebuild --print-errorlogs \\\n> +\t\t--test-args=\"$GIT_TEST_OPTS\" --slice \"$((1+$2))/$3\" ||\n> +handle_failed_tests\n> -- \n> 2.52.0.278.gadc6434dc3\n> \n> \n"}]}