)]}'
{
  "commit": "aea7c185beedb0be3437d9de9f7c894b0da6c547",
  "tree": "43f08f5eb34abad40522ec7198fe825d42fe58f1",
  "parents": [
    "7304bd2bc390aa6cf27f7a2527d7806dd3fad53e"
  ],
  "author": {
    "name": "Patrick Steinhardt",
    "email": "ps@pks.im",
    "time": "Thu Feb 27 14:39:22 2025 +0100"
  },
  "committer": {
    "name": "Junio C Hamano",
    "email": "gitster@pobox.com",
    "time": "Thu Feb 27 10:42:31 2025 -0800"
  },
  "message": "gitlab-ci: fix \"msvc-meson\" test job succeeding despite test failures\n\nWe have recently noticed that the \"msvc-meson\" test job in GitLab CI\nsucceeds even if there are failures. This is somewhat puzzling because\nwe use exactly the same command as we do on GitHub Actions, and there\nthe jobs fail as exected.\n\nAs it turns out, this is another weirdness of the GitLab CI hosted\nrunner for Windows [1]: by default, even successful commands will not\nmake the job fail. Interestingly though, this depends on what exactly\nthe command is that you\u0027re running -- the MinGW-based job for example\nworks alright and does fail as expected.\n\nThe root cause here seems to be specific behaviour of PowerShell. The\ninvocation of `ForEach-Object` does not bubble up any errors in case the\ninvocation of `meson test` fails, and thus we don\u0027t notice the error.\nThis is specific to executing the command in a loop: other build steps\nwhere we execute commands directly fail as expected.\n\nThis is because the specific version of PowerShell that we use in the\nrunner does not know about `PSNativeCommandUseErrorActionPreference`\nyet, which controls whether native commands like \"meson.exe\" honor the\n`ErrorActionPreference` variable. The preference has been introduced\nwith PowerShell 7.3 and is default-enabled since PowerShell 7.4, but\nGitLab\u0027s hosted runners still seem to use PowerShell 5.1. Consequently,\nwhen tests fail, we won\u0027t bubble up the error at all from the loop and\nthus the job doesn\u0027t fail. This isn\u0027t an issue in other cases though\nwhere we execute native commands directly, as the GitLab runner knows to\ncheck the last error code after every command.\n\nThe same thing doesn\u0027t seem to be an issue on GitHub Actions, most\nlikely because it uses PowerShell 7.4. Curiously, the preference for\n`PSNativeCommandUseErrorActionPreference` is disabled there, but the\njobs fail as expected regardless of that. It\u0027s puzzling, but I do not\nhave enough PowerShell expertise to give a definitive answer as to why\nit works there.\n\nIn any case, Meson 1.8 will likely get support for slicing tests [1], so\nwe can eventually get rid of the whole PowerShell script. For now, work\naround the issue by explicitly exiting out of the loop with a non-zero\nerror code if we see that Meson has failed.\n\n[1]: https://github.com/mesonbuild/meson/pull/14092\n\nSigned-off-by: Patrick Steinhardt \u003cps@pks.im\u003e\nSigned-off-by: Junio C Hamano \u003cgitster@pobox.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "4976e18a0503298f38230f5ba7348675baf48664",
      "old_mode": 33188,
      "old_path": ".gitlab-ci.yml",
      "new_id": "590fb11c030b7550fdc26c65b5a851e1211fbe9c",
      "new_mode": 33188,
      "new_path": ".gitlab-ci.yml"
    }
  ]
}
