{"thread":{"id":"57451","subject":"[PATCH 01/25] CI: run \"set -ex\" early in ci/lib.sh","startedAt":"2022-02-21T14:46:53Z","lastAt":"2022-05-25T11:27:26Z","messageCount":260,"participants":["Ævar Arnfjörð Bjarmason","Johannes Schindelin","Phillip Wood","Junio C Hamano","SZEDER Gábor","Victoria Dye","Eric Sunshine","Carlo Arenas","Carlo Marcelo Arenas Belón"],"isPatch":true,"patchVersion":1,"patchTotal":25},"messages":[{"id":"448980","messageId":"patch-01.25-970849a227f-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 01/25] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:13Z","receivedAt":"2022-02-21T14:46:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cbc2f8f1caa..57141d38a85 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448981","messageId":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":null,"subject":"[PATCH 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:12Z","receivedAt":"2022-02-21T14:46:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"== Applying this\n\nMerging this has a trivial conflct with \"seen\"'s\njs/use-builtin-add-i. The\ns/GIT_TEST_ADD_I_USE_BUILTIN=1/GIT_TEST_ADD_I_USE_BUILTIN=0/g\" there\nneeds to be correspondingly changed (using \"setenv\", no \"export\") in\nci/lib.sh\n\n== Summary\n\nThis series makes the CI less of a special-case by getting rid of\nwrapper scripts like \"ci/run-build-and-tests.sh\" in favor of simply\nrunning \"make\" or \"make test\" directly.\n\nIt also has changes that make us do less special-ness in\nCI. E.g. there's now a \"make ci-static-analysis\" target that can be\nrun locally to do what \"ci/run-static-analysis.sh\" did before. The CI\njust invokes that new \"make\" target, and the\n\"ci/run-static-analysis.sh\" script has been \"git rm'd\".\n\nThe 12/25 here has a more detailed summary[1], but basically the\n\"ci/lib.sh\" is now a script run directly from an early CI step within\na given job. That script runs sets the environment variables needed in\n$GITHUB_ENV (what GitHub CI uses to carry forward the environment\nbetween steps).\n\n== Details\n\nThis series conflicts with and is a proposed alternative to Johannes's\nproposed changes to teach \"ci/lib.sh\" GitHub specific syntax to\n\"group\" certain parts of the output[2]. That series proposes to keep\nthe \"ci/run-build-and-tests.sh\" and similar scripts, but to teach them\nto emit markers indicating when the \"build\" part commences, then\n\"test\" etc.\n\nI think the approach offered here is better as elaborated on in\n12/25[1], especially because as Johannes notes[3] we only have one\nlevel of \"grouping\" within a \"step\" available to us. In his version\nusing it for \"build\" v.s. \"test\" precludes being able to group parts\nof that \"build\" or \"test\" output in the future.\n\nThe following compares CI output between the three with a\nchange-on-top which caused a compilation error (\"this\" is this series,\n\"js\" is Johannes's) when clicking on the \"linux-gcc\" failure:\n\n  master: https://github.com/avar/git/runs/5274251909?check_suite_focus=true\n  this: https://github.com/avar/git/runs/5274464670?check_suite_focus=true\n  js: https://github.com/avar/git/runs/5272239403?check_suite_focus=true\n\n  Here we went from 93 lines of output on \"master\" to 47 in \"this\"\n  (107 in \"js\"). Note also how in \"this\" we can:\n\n  - Expand the \"Run make\" to get the \"MAKEFLAGS\" and other variables\n    used in the step. That's now a 3-line summary instead of the\n    first 50 lines being the old \"ci/lib.sh\" \"set -x\" output.\n\n  - Because \"make\" failed, we have an elided \"make test\" step that's\n    not being run below. We can thus see what steps our failure caused\n    us to skip.\n\n  - Unlike the \"js\" version we'll show the compilation error by\n    default (the \"js\" version is grouped and needs to be expanded),\n    but our output is now brief enough that that's no longer\n    surrounded by other irrelevant output.\n\n  - Unlike the \"js\" version there is no \"CI setup\" group within each\n    step. That work is in the earlier \"ci/lib.sh --build\" step\n    instead, which sets the config for all subsequent steps.\n\nFor other output changes look at the difference between \"master\" and\n\"this\" at:\n\n  master: https://github.com/git/git/actions/runs/1866786595\n  this: https://github.com/avar/git/actions/runs/1876270588\n\nNot explicitly covered in the summary above is that various other\nparts of ci/* were doing the same sort of within-step setup, but now\ndo so via cross-step passing of variables via $GITHUB_ENV. E.g. on\n\"master\" the test slices for the Windows tests have a lot of verbosity\nbefore they get to running the test itself:\n\n    https://github.com/git/git/runs/5254267914?check_suite_focus=true#step:5:56\n\nIn the \"js\" version the test output is hidden (\"grouped\"), but we've\ngot the same amount of verbosity by default:\n\n    https://github.com/gitgitgadget/git/runs/4937491771?check_suite_focus=true#step:5:67\n\nWhereas in \"this\" version that verbosity is in the preceding \"select\ntests\" step, with the \"test\" step showing only the relevant end-state\nof the \"$T\" variable we'll use in the Makefile (hidden by default,\nexpanded in this link):\n\n    https://github.com/avar/git/runs/5274558869?check_suite_focus=true#step:7:13\n\nThis series does not attempt to replace the use of the \"group\" output\nused for the \"ok\" or \"not ok\" portion of tests in Johannes's\nseries. When a test fails the output in this series (sans config\ndiscovery not being repeated, and now summarized in the $GITHUB_ENV\ndrop-down) is substantially the same as on \"master\".\n\nMy summary at [4] goes into other overlap & non-overlap between the\ntwo. I think using the \"group\" output for those purposes might be\nuseful, although I left some feedback on [5] with problems in the\ncurrent \"js\" implementation.\n\nI do think any such changes should follow behind this series, as doing\nthat sort of grouping once we can effectively free up an extra \"group\"\nlevel (by peeling those off into \"steps\", as is done here) would be\nmuch more useful.\n\n1. https://lore.kernel.org/git/patch-12.25-dfd823f2e7d-20220221T122605Z-avarab@gmail.com\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n4. https://lore.kernel.org/git/220127.86ilu5cdnf.gmgdl@evledraar.gmail.com/\n5. https://lore.kernel.org/git/220126.86sftbfjl4.gmgdl@evledraar.gmail.com/\n\nÆvar Arnfjörð Bjarmason (25):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: make \"$jobname\" explicit, remove fallback\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: remove unused Azure ci/* code\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n  CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n  CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n  CI: invoke \"make artifacts-tar\" directly in windows-build\n  CI: split up and reduce \"ci/test-documentation.sh\"\n  CI: combine ci/install{,-docker}-dependencies.sh\n  CI: move \"env\" definitions into ci/lib.sh\n  ci/run-test-slice.sh: replace shelling out with \"echo\"\n  CI: pre-select test slice in Windows & VS tests\n  CI: only invoke ci/lib.sh as \"steps\" in main.yml\n  CI: narrow down variable definitions in --build and --test\n  CI: add more variables to MAKEFLAGS, except under vs-build\n  CI: stop over-setting the $CC variable\n  CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n  CI: don't use \"set -x\" in \"ci/lib.sh\" output\n\n .github/workflows/main.yml            | 100 +++++---\n Makefile                              |  32 ++-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  53 ++++-\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |  10 +\n ci/lib-tput.sh                        |   2 +\n ci/lib.sh                             | 315 ++++++++++++--------------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  16 +-\n ci/run-build-and-tests.sh             |  54 -----\n ci/run-docker-build.sh                |  66 ------\n ci/run-docker.sh                      |  47 ----\n ci/run-static-analysis.sh             |  32 ---\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  10 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ----\n 20 files changed, 345 insertions(+), 577 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448982","messageId":"patch-02.25-eda7fb18064-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 02/25] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:14Z","receivedAt":"2022-02-21T14:46:58Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57141d38a85..d2a7c33f536 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"must set a CI jobname\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448983","messageId":"patch-03.25-3ee32815cf3-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 03/25] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:15Z","receivedAt":"2022-02-21T14:47:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the -\"-state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     |  3 --\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 184 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d2a7c33f536..c3c06d66862 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..00fcf27b1b2 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -77,9 +77,6 @@ do\n \t\t\tfi\n \t\t\tcombined_trash_size=$new_combined_trash_size\n \n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n \t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n \t\t\tcat \"$trash_tgz_b64\"\n \t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448984","messageId":"patch-04.25-c81c1b3f504-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 04/25] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:16Z","receivedAt":"2022-02-21T14:47:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c3c06d66862..5a8938d4b3c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448985","messageId":"patch-08.25-95cd496868e-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 08/25] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:20Z","receivedAt":"2022-02-21T14:47:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 02cd563e216..0c117d32f48 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3424,7 +3424,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3514,5 +3514,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448986","messageId":"patch-06.25-59e4f41e86c-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 06/25] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:18Z","receivedAt":"2022-02-21T14:47:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448987","messageId":"patch-07.25-836ef20fdcc-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 07/25] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:19Z","receivedAt":"2022-02-21T14:47:27Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 29 +++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n 3 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex 6f0b4b775fe..02cd563e216 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2005,6 +2005,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \tQUIET_SUBDIR0  = +@subdir=\n \tQUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \\\n \t\t\t $(MAKE) $(PRINT_DIR) -C $$subdir\n@@ -3052,6 +3053,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3487,3 +3502,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448988","messageId":"patch-05.25-4738a22a36d-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 05/25] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:17Z","receivedAt":"2022-02-21T14:47:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  7 +------\n 4 files changed, 2 insertions(+), 46 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex dbcebad2fb2..e7ea8799411 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tbrew install --cask --no-quarantine perforce || {\n \t\t# Update the definitions and try again\n@@ -69,7 +67,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5a8938d4b3c..ad1aa59a384 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 00fcf27b1b2..0c63b6f7962 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -38,14 +38,9 @@ do\n \t\ttest_name=\"${TEST_EXIT%.exit}\"\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n+\t\tmkdir -p failed-test-artifacts\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n-\t\t\t;;\n \t\tgithub-actions)\n-\t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448989","messageId":"patch-10.25-b6a61a786c5-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 10/25] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:22Z","receivedAt":"2022-02-21T14:47:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 6b37b10d750..31fe3a476a9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -27,7 +27,7 @@ check_unignored_build_artifacts ()\n export TERM=${TERM:-dumb}\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+MAKEFLAGS=\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -35,10 +35,12 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -92,4 +94,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448990","messageId":"patch-09.25-a1d0796259e-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 09/25] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:21Z","receivedAt":"2022-02-21T14:47:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex e7ea8799411..34b4400f38b 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ad1aa59a384..6b37b10d750 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -65,18 +65,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448991","messageId":"patch-11.25-f2fcee5d6e4-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 11/25] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:23Z","receivedAt":"2022-02-21T14:47:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore this parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 39 ++++++++++++++++++++++++++++-----------\n ci/run-build-and-tests.sh | 34 +++++++++++++++++-----------------\n 2 files changed, 45 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 31fe3a476a9..1a1fa0e4bb2 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,23 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\tvarmode=\n+\tcase \"$1\" in\n+\t--*)\n+\t\tvarmode=$1\n+\t\tshift\n+\t\t;;\n+\tesac\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +41,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n@@ -34,23 +51,23 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -66,7 +83,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -89,9 +106,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448992","messageId":"patch-19.25-e9c6c4dd293-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 19/25] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:31Z","receivedAt":"2022-02-21T14:47:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  4 ++--\n 2 files changed, 10 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (57%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex fe37e0f1b36..1e13718b989 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 57%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..ec602f8a053 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,10 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+echo T=\"$tests\" >>$GITHUB_ENV\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448993","messageId":"patch-16.25-868613a5b06-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 16/25] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:28Z","receivedAt":"2022-02-21T14:47:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, and because the\n\"ci/install-dependencies.sh\" used \"ci/lib.sh\", which requires\n\"bash\". At least one of the docker containers doesn't have \"bash\". To\nmake the existing code POSIX-compatible we need to replace pushd/popd\nwith a sub-shell, but no other changes were needed.\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 27 ++++++++++++++++++++++-----\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 23 insertions(+), 28 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 92b914f16fd..3fd3e4f873c 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 01006379fd0..9388289d0ed 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -34,18 +34,20 @@ ubuntu-latest)\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n \tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n+\t)\n \tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n@@ -90,6 +92,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null && type p4 >/dev/null\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448994","messageId":"patch-18.25-a6106525b7f-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 18/25] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:30Z","receivedAt":"2022-02-21T14:47:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448995","messageId":"patch-17.25-5d854e8ff36-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 17/25] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:29Z","receivedAt":"2022-02-21T14:47:51Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 3fd3e4f873c..fe37e0f1b36 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex fc6ce4d3e04..b882849ed5d 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -95,6 +95,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448996","messageId":"patch-14.25-aecd3ebaafe-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 14/25] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:26Z","receivedAt":"2022-02-21T14:47:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 05c5771e7f6..2c23a19eac2 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448997","messageId":"patch-13.25-46459fff296-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 13/25] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:25Z","receivedAt":"2022-02-21T14:48:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c83f6a21ca3..05c5771e7f6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448998","messageId":"patch-12.25-dfd823f2e7d-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 12/25] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:24Z","receivedAt":"2022-02-21T14:48:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant output non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 40 ++++++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 62 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..c83f6a21ca3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: no\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 34b4400f38b..01006379fd0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 1a1fa0e4bb2..05f3dd15e27 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -27,7 +29,14 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telse\n+\t\t# For local debugging. Not used by the GitHub CI\n+\t\t# itself.\n+\t\teval \"export $key=\\\"$val\\\"\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -96,6 +105,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"448999","messageId":"patch-15.25-4f1564af70f-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 15/25] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:27Z","receivedAt":"2022-02-21T14:48:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 2c23a19eac2..92b914f16fd 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 05f3dd15e27..fc6ce4d3e04 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -39,16 +39,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449000","messageId":"patch-20.25-40d86e8c1dc-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 20/25] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:32Z","receivedAt":"2022-02-21T14:48:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  8 ++++++++\n ci/lib-tput.sh                        |  2 ++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 29 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 9388289d0ed..ee9af62fc92 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..bd6e093c8f4\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,8 @@\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\tenv >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..baed1892f69\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,2 @@\n+# GitHub Action doesn't set TERM, which is required by tput\n+export TERM=${TERM:-dumb}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex b882849ed5d..5eadc96de29 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -39,15 +35,11 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC:-gcc}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n@@ -57,11 +49,12 @@ then\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 0c63b6f7962..452aff35d74 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex ec602f8a053..a0332095bb3 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449001","messageId":"patch-21.25-abf9c504740-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 21/25] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:33Z","receivedAt":"2022-02-21T14:48:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 20 +++++++++++---------\n ci/lib.sh                  | 17 +++++++++++++++++\n 2 files changed, 28 insertions(+), 9 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 1e13718b989..0787cadc76b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +333,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +354,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +366,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5eadc96de29..367d1ee05d5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -5,6 +5,13 @@ set -ex\n . ${0%/*}/lib-ci-type.sh\n \n # Starting assertions\n+mode=$1\n+if test -z \"$mode\"\n+then\n+\techo \"need a $0 mode, e.g. --build or --test\"\n+\texit 1\n+fi\n+\n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname\" >&2\n@@ -13,9 +20,14 @@ fi\n \n # Helper functions\n setenv () {\n+\tskip=\n \tvarmode=\n \tcase \"$1\" in\n \t--*)\n+\t\tif test \"$1\" != \"$mode\" && test \"$1\" != \"--all\"\n+\t\tthen\n+\t\t\tskip=t\n+\t\tfi\n \t\tvarmode=$1\n \t\tshift\n \t\t;;\n@@ -25,6 +37,11 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449002","messageId":"patch-22.25-9f4c2798a82-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 22/25] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:34Z","receivedAt":"2022-02-21T14:48:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 367d1ee05d5..475e9f63a74 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -55,6 +55,13 @@ setenv () {\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n \n+# Common make and cmake build options\n+DEVELOPER=1\n+SKIP_DASHED_BUILT_INS=YesPlease\n+\n+# Use common options for \"make\" (cmake in \"vs-build\" below)\n+MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC:-gcc}\"\n@@ -73,10 +80,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -110,6 +115,9 @@ windows-build)\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449003","messageId":"patch-25.25-08a9776c259-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 25/25] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:37Z","receivedAt":"2022-02-21T14:48:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh | 2 ++\n ci/lib.sh         | 9 ++++++++-\n 2 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex bd6e093c8f4..6cfe58596d2 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -6,3 +6,5 @@ else\n \tenv >&2\n \texit 1\n fi\n+\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 36f79eb6a65..f4323a3dd36 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -11,12 +11,16 @@ then\n \techo \"need a $0 mode, e.g. --build or --test\"\n \texit 1\n fi\n+echo \"CONFIG: mode=$mode\" >&2\n \n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname\" >&2\n \texit 1\n fi\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n \n # Helper functions\n setenv () {\n@@ -39,6 +43,7 @@ setenv () {\n \n \tif test -n \"$skip\"\n \tthen\n+\t\techo \"SKIP '$key=$val'\" >&2\n \t\treturn 0\n \tfi\n \n@@ -50,6 +55,8 @@ setenv () {\n \t\t# itself.\n \t\teval \"export $key=\\\"$val\\\"\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449004","messageId":"patch-23.25-8a8b7ecf16b-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 23/25] CI: stop over-setting the $CC variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:35Z","receivedAt":"2022-02-21T14:48:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\nto setting it in the environment was due to Travis CI clobbering $CC\nin the environment.\n\nWe don't need to set it unconditionally to accomplish that, but rather\njust have it set for those jobs that need them. E.g. the \"win+VS\nbuild\" job confusingly has CC=gcc set, even though it builds with\nMSVC.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/lib.sh                  | 26 ++++++++++++++++++++++----\n 2 files changed, 22 insertions(+), 17 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 0787cadc76b..6d25ec4ae3b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 475e9f63a74..7064a17cfeb 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -52,7 +52,9 @@ setenv () {\n \tfi\n }\n \n-# Clear MAKEFLAGS that may come from the outside world.\n+# Clear variables that may come from the outside world.\n+CC=\n+CC_PACKAGE=\n MAKEFLAGS=\n \n # Common make and cmake build options\n@@ -64,8 +66,6 @@ MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC:-gcc}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -135,9 +135,16 @@ vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n \t;;\n linux-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -152,10 +159,19 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-9\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n@@ -173,9 +189,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449005","messageId":"patch-24.25-d7b472b4a52-20220221T143936Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH 24/25] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-21T14:46:36Z","receivedAt":"2022-02-21T14:48:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 7064a17cfeb..36f79eb6a65 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -99,14 +99,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -160,10 +152,12 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \tCC_PACKAGE=gcc-9\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.35.1.1132.ga1fe46f8690\n\n"},{"id":"449097","messageId":"nycvar.QRO.7.76.6.2202221115590.4418@tvgsbejvaqbjf.bet","threadId":"57451","inReplyTo":"patch-05.25-4738a22a36d-20220221T143936Z-avarab@gmail.com","subject":"Re: [PATCH 05/25] CI: remove unused Azure ci/* code","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-02-22T10:21:57Z","receivedAt":"2022-02-22T10:22:12Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n\nOn Mon, 21 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n\n> Remove Azure-specific code that's been unused since 6081d3898fe (ci:\n> retire the Azure Pipelines definition, 2020-04-11). As noted in a\n> larger removal of all of the Azure-supporting code in [1] (although\n> that missed some of this) there is more of it in-tree, but let's focus\n> on only the ci/* code for now.\n>\n> This is needed because in subsequent commits this unused code would\n> either need to be changed to accommodate changes in ci/*, or be\n> removed.\n>\n> As we'll see in those subsequent commits the end-state we're heading\n> towards will actually make it easier to add new CI types in the\n> future, even though the only one we're left with now is the GitHub\n> CI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\n> be offloading more of what it does to our generic build and test\n> system.\n>\n> While I'm at it (since the line needs to be touched anyway) change an\n> odd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\n> in other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n>\n> 1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nThis has been discussed before, and I already gave my NAK.\n\nIt is sad that I have to repeat myself: it is a good thing to have the\nAzure Pipelines definition as a fall-back. In the past, this has served us\nvery well especially when we had to run a barrage of security fixes, for a\nslew of backports to previous release trains.\n\nYou seem to have fun to just remove this code, under some assumption that\nit is not needed, despite me pointing out that it is needed.\n\nCiao,\nJohannes\n"},{"id":"449105","messageId":"220222.86k0dn89bm.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"nycvar.QRO.7.76.6.2202221115590.4418@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 05/25] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-22T10:27:38Z","receivedAt":"2022-02-22T10:49:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Feb 22 2022, Johannes Schindelin wrote:\n\n> Hi,\n>\n>\n> On Mon, 21 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n>\n>> Remove Azure-specific code that's been unused since 6081d3898fe (ci:\n>> retire the Azure Pipelines definition, 2020-04-11). As noted in a\n>> larger removal of all of the Azure-supporting code in [1] (although\n>> that missed some of this) there is more of it in-tree, but let's focus\n>> on only the ci/* code for now.\n>>\n>> This is needed because in subsequent commits this unused code would\n>> either need to be changed to accommodate changes in ci/*, or be\n>> removed.\n>>\n>> As we'll see in those subsequent commits the end-state we're heading\n>> towards will actually make it easier to add new CI types in the\n>> future, even though the only one we're left with now is the GitHub\n>> CI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\n>> be offloading more of what it does to our generic build and test\n>> system.\n>>\n>> While I'm at it (since the line needs to be touched anyway) change an\n>> odd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\n>> in other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n>>\n>> 1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n>\n> This has been discussed before, and I already gave my NAK.\n>\n> It is sad that I have to repeat myself: it is a good thing to have the\n> Azure Pipelines definition as a fall-back. In the past, this has served us\n> very well especially when we had to run a barrage of security fixes, for a\n> slew of backports to previous release trains.\n>\n> You seem to have fun to just remove this code, under some assumption that\n> it is not needed, despite me pointing out that it is needed.\n\nI previously submitted a stand-alone patch to remove it[1] after the\nremoval of (most of) the Travis CI was merged in f9b889dd67b (Merge\nbranch 'ab/ci-updates', 2021-12-15).\n\nI submitted that not for \"fun\", but because I had other CI/test-lib.sh\nchanges depending on that.\n\nI.e. I needed to either patch code unused in-tree I couldn't test\nwithout reverting your 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11) (and presumably set up some Azure CI account\netc.), or remove it.\n\nIt's still unclear to me how Azure CI is being used as a \"fall-back\",\ncan you explain that? I.e. we don't have the azure-pipelines.yml anymore\n(and neither does git-for-windows/git). Is this in-tree code being used\nby some out-of-tree fork of git.git, or do you mean you'd like to keep\nit in case we find a reason to revert your 6081d3898fe?\n\nIn this case (and as I think this series makes clear), we can't easily\nkeep certain Travis + Azure assumptions around *and* simplify how\nci/lib.sh works in the same way. At the tip of this series it's turned\ninto a very dumb variable setting helper with the CI recipe itself\ndriving the test.\n\nWhereas Travis and Azure were using a feature where a \"job\" once running\nwould attempt to skip the rest of the CI run.\n\nAnd in your [1] you mentioned the reasons for keeping it around being:\n    \n    The reason is that there are still some things that Azure Pipelines can do\n    that GitHub workflows cannot, for example:\n    \n    - present the logs of failed tests in an intuitive manner,\n    \n    - re-run _only_ failed jobs.\n\nIt seems to me that in your parallel series you're working on 1/2 of\nthose, and with/without those changes we could otherwise improve the\npresentation of the failed test runs enough with the \"grouping\"\netc. feature.\n\nAnd as for 2/2 that any such support would be mostly orthogonal to\nkeeping Azure code that's currently unused around. I.e. a goal of this\nseries is also to make the CI less of a special snowflake, because I'm\nnot only interested in running the CI code on GitHub CI, but also\nlocally.\n\nWhich means that for any future port to Azure, GitLab CI etc. we'd\npresumably just have a thin recipe that ran \"make\" followed by \"make\ntest\", and for a re-run of only that job it would just use the CI itself\nto do that, without us needing to carry any special-cases in ci/*.\n\nI'm not at all opposed to keeping Azure support in-tree. I specifically\nhave a problem with unused code holding other improvements\nhostage.\n\nI.e. neither I nor anyone else can easily change anything surrounding it\nwhile being assured that we haven't broken that unused code. As noted in\n04/25 I think you've also had that issue, i.e. your recent 0e7696c64db\n(it seems to me) introduced what would have been a bug if it were\ncombined with the azure-pipelines.yml code removed in your 6081d3898fe.\n\n1. https://lore.kernel.org/git/nycvar.QRO.7.76.6.2112201834050.347@tvgsbejvaqbjf.bet/\n"},{"id":"449115","messageId":"nycvar.QRO.7.76.6.2202221306190.11118@tvgsbejvaqbjf.bet","threadId":"57451","inReplyTo":"220222.86k0dn89bm.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH 05/25] CI: remove unused Azure ci/* code","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-02-22T12:07:47Z","receivedAt":"2022-02-22T12:08:00Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ævar,\n\nOn Tue, 22 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n\n> It's still unclear to me how Azure CI is being used as a \"fall-back\",\n> can you explain that?\n\nBy reinstating the `azure-pipelines.yml` file from the last known-good\nversion.\n\nCiao,\nJohannes\n"},{"id":"449126","messageId":"220222.86y2236ndp.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"nycvar.QRO.7.76.6.2202221306190.11118@tvgsbejvaqbjf.bet","subject":"Re: [PATCH 05/25] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-22T13:05:08Z","receivedAt":"2022-02-22T13:29:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Feb 22 2022, Johannes Schindelin wrote:\n\n> Hi Ævar,\n>\n> On Tue, 22 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n>\n>> It's still unclear to me how Azure CI is being used as a \"fall-back\",\n>> can you explain that?\n>\n> By reinstating the `azure-pipelines.yml` file from the last known-good\n> version.\n\nOkey, despite what you might thing I'm not on the war path to remove all\nof this at all costs.\n\nIn particular I don't mind much keeping the 05/25 parts around, but the\n04/25 would be a hassle, depending on how you reply to the below.\n\nSo what do you expect me or someone who overtly touches code related to\nthis & the similar (and related) in-tree JUnit support to do? Presumably\none of:\n\n 1. Don't work on any such code at all, in case you'd one day like to\n    resurrect Azure support.\n\n 2. Test my patches locally by reverting azure-pipelines.yml and make\n    sure any overt changes to Azure-related code still work with that\n    reverted commit.\n\n 3. Just \"YOLO hack it\" but leave it in place-as is. E.g. for 04/25 and\n    05/25 in combination with 11/25 (the later s/export/setenv/g change)\n    leave a known-bad-but-looking-like-it-was-before Azure branch in-place.\n\n 4. A variant of #2 where I attempt to patch the Azure code branches, but\n    the \"testing\" is just eyeballing that they look reasonable, but I haven't\n    *really* tested them even once (and I'd note as much in a commit message).\n\nI'm not willing to go for #1 and #2. I could do #3 or #4 if Junio/others\nchime and agree with you, but I really don't think those are worth it\neither.\n\nI could understand your view in your reply back in December when I sent\nthe stand-alone Azure removal patch[1]. Even though I noted that it was\nneeded for subsequent changes it was a stand-alone patch, so it wasn't\neasy to evaluate the trade-off of whether removing it was worth it.\n\nI think here it is quite easy. The end-state of this series\nsignificantly improves the UX for the CI we actually use, and I think\nactually makes it easier to get Azure support back up & running should\nyou ever want that, since the whole structure of it is making CI less\ncomplex and less of a special-case.\n\nIt's been almost 2 years (just around 2 months short of it..) since\nazure-pipelines.yml was removed from \"master\". It would really be quite\neasy to get it or any other new CI target off the ground, particularly\nafter this series.\n\nInsisting that any effort to fix actual CI issues in the actual CI we do\nuse needs to be hamstrung by any change in the area needing to carefully\neyeball:\n\n    git show 6081d3898fe^:azure-pipelines.yml\n\nAnd for each change carefully consider them *if* we still ran that just\nseems unreasonably obstructionist.\n\nSure, Azure CI had some neat features, so did Travis CI. If we ever want\nto run either of them again let's just consider that if and when that\nhappens.\n\nMaybe you have relevant feedback queued up, but so far you haven't had\nany meaningful comments on the goals end end-state of this series as\ncompared to yours[2] (to the extent that their approaches differ).\n\nCan we try to focus on that instead? I.e. the actual visible CI changes\nthat'll either make the CI workflow we actually use better or worse?\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n"},{"id":"449248","messageId":"4d3fecbf-23f9-f6b6-414e-8eaca620aced@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"Re: [PATCH 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2022-02-23T13:55:39Z","receivedAt":"2022-02-23T13:55:48Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Ævar\n\nOn 21/02/2022 14:46, Ævar Arnfjörð Bjarmason wrote:\n > [...]\n> == Details\n> \n> This series conflicts with and is a proposed alternative to Johannes's\n> proposed changes to teach \"ci/lib.sh\" GitHub specific syntax to\n> \"group\" certain parts of the output[2]. That series proposes to keep\n> the \"ci/run-build-and-tests.sh\" and similar scripts, but to teach them\n> to emit markers indicating when the \"build\" part commences, then\n> \"test\" etc.\n> \n> I think the approach offered here is better as elaborated on in\n> 12/25[1], especially because as Johannes notes[3] we only have one\n> level of \"grouping\" within a \"step\" available to us. In his version\n> using it for \"build\" v.s. \"test\" precludes being able to group parts\n> of that \"build\" or \"test\" output in the future.\n> \n> The following compares CI output between the three with a\n> change-on-top which caused a compilation error (\"this\" is this series,\n> \"js\" is Johannes's) when clicking on the \"linux-gcc\" failure:\n> \n>    master: https://github.com/avar/git/runs/5274251909?check_suite_focus=true\n>    this: https://github.com/avar/git/runs/5274464670?check_suite_focus=true\n>    js: https://github.com/avar/git/runs/5272239403?check_suite_focus=true\n> \n>    Here we went from 93 lines of output on \"master\" to 47 in \"this\"\n>    (107 in \"js\"). Note also how in \"this\" we can:\n> \n>    - Expand the \"Run make\" to get the \"MAKEFLAGS\" and other variables\n>      used in the step. That's now a 3-line summary instead of the\n>      first 50 lines being the old \"ci/lib.sh\" \"set -x\" output.\n> \n>    - Because \"make\" failed, we have an elided \"make test\" step that's\n>      not being run below. We can thus see what steps our failure caused\n>      us to skip.\n> \n>    - Unlike the \"js\" version we'll show the compilation error by\n>      default (the \"js\" version is grouped and needs to be expanded),\n>      but our output is now brief enough that that's no longer\n>      surrounded by other irrelevant output.\n> \n>    - Unlike the \"js\" version there is no \"CI setup\" group within each\n>      step. That work is in the earlier \"ci/lib.sh --build\" step\n>      instead, which sets the config for all subsequent steps.\n\nI can see that showing compilation errors without having to expand \nanything is useful but in my experience they are relatively rare \ncompared to test failures. If I understand the rest of the message \ncorrectly we're left with having to expand print-test-failures and \nsearching for \"not ok\" to find out what went wrong with this series.\n\n> For other output changes look at the difference between \"master\" and\n> \"this\" at:\n> \n>    master: https://github.com/git/git/actions/runs/1866786595\n>    this: https://github.com/avar/git/actions/runs/1876270588\n> \n> Not explicitly covered in the summary above is that various other\n> parts of ci/* were doing the same sort of within-step setup, but now\n> do so via cross-step passing of variables via $GITHUB_ENV. E.g. on\n> \"master\" the test slices for the Windows tests have a lot of verbosity\n> before they get to running the test itself:\n> \n>      https://github.com/git/git/runs/5254267914?check_suite_focus=true#step:5:56\n> \n> In the \"js\" version the test output is hidden (\"grouped\"), but we've\n> got the same amount of verbosity by default:\n> \n>      https://github.com/gitgitgadget/git/runs/4937491771?check_suite_focus=true#step:5:67\n> \n> Whereas in \"this\" version that verbosity is in the preceding \"select\n> tests\" step, with the \"test\" step showing only the relevant end-state\n> of the \"$T\" variable we'll use in the Makefile (hidden by default,\n> expanded in this link):\n> \n>      https://github.com/avar/git/runs/5274558869?check_suite_focus=true#step:7:13\n\nAll I can see in the \"$T\" variable I have to scroll to get the prove \noutput on screen\n\n\n> This series does not attempt to replace the use of the \"group\" output\n> used for the \"ok\" or \"not ok\" portion of tests in Johannes's\n> series. When a test fails the output in this series (sans config\n> discovery not being repeated, and now summarized in the $GITHUB_ENV\n> drop-down) is substantially the same as on \"master\".\n> \n> My summary at [4] goes into other overlap & non-overlap between the\n> two. I think using the \"group\" output for those purposes might be\n> useful, although I left some feedback on [5] with problems in the\n> current \"js\" implementation.\n> \n> I do think any such changes should follow behind this series, as doing\n> that sort of grouping once we can effectively free up an extra \"group\"\n> level (by peeling those off into \"steps\", as is done here) would be\n> much more useful.\n\nI can see the attraction of being able to use make directly in the ci \nfrom an implementation point of view but from the point of view of \nsomeone trying to investigate a test failure then unless I've \nmisunderstood I don't think this series improves the current situation. \nWhy can't you build on top of Dscho's series that makes it easier to see \nthe output of the failed tests?\n\nBest Wishes\n\nPhillip\n\n> 1. https://lore.kernel.org/git/patch-12.25-dfd823f2e7d-20220221T122605Z-avarab@gmail.com\n> 2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n> 3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n> 4. https://lore.kernel.org/git/220127.86ilu5cdnf.gmgdl@evledraar.gmail.com/\n> 5. https://lore.kernel.org/git/220126.86sftbfjl4.gmgdl@evledraar.gmail.com/\n> \n> Ævar Arnfjörð Bjarmason (25):\n>    CI: run \"set -ex\" early in ci/lib.sh\n>    CI: make \"$jobname\" explicit, remove fallback\n>    CI: remove more dead Travis CI support\n>    CI: remove dead \"tree skipping\" code\n>    CI: remove unused Azure ci/* code\n>    CI: don't have \"git grep\" invoke a pager in tree content check\n>    CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>    CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>    CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n>    CI: consistently use \"export\" in ci/lib.sh\n>    CI: export variables via a wrapper\n>    CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n>    CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n>    CI: invoke \"make artifacts-tar\" directly in windows-build\n>    CI: split up and reduce \"ci/test-documentation.sh\"\n>    CI: combine ci/install{,-docker}-dependencies.sh\n>    CI: move \"env\" definitions into ci/lib.sh\n>    ci/run-test-slice.sh: replace shelling out with \"echo\"\n>    CI: pre-select test slice in Windows & VS tests\n>    CI: only invoke ci/lib.sh as \"steps\" in main.yml\n>    CI: narrow down variable definitions in --build and --test\n>    CI: add more variables to MAKEFLAGS, except under vs-build\n>    CI: stop over-setting the $CC variable\n>    CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n>    CI: don't use \"set -x\" in \"ci/lib.sh\" output\n> \n>   .github/workflows/main.yml            | 100 +++++---\n>   Makefile                              |  32 ++-\n>   ci/check-directional-formatting.bash  |   2 +-\n>   ci/check-unignored-build-artifacts.sh |  20 ++\n>   ci/install-dependencies.sh            |  53 ++++-\n>   ci/install-docker-dependencies.sh     |  22 --\n>   ci/lib-ci-type.sh                     |  10 +\n>   ci/lib-tput.sh                        |   2 +\n>   ci/lib.sh                             | 315 ++++++++++++--------------\n>   ci/make-test-artifacts.sh             |  12 -\n>   ci/mount-fileshare.sh                 |  25 --\n>   ci/print-test-failures.sh             |  16 +-\n>   ci/run-build-and-tests.sh             |  54 -----\n>   ci/run-docker-build.sh                |  66 ------\n>   ci/run-docker.sh                      |  47 ----\n>   ci/run-static-analysis.sh             |  32 ---\n>   ci/run-test-slice.sh                  |  17 --\n>   ci/select-test-slice.sh               |  10 +\n>   ci/test-documentation.sh              |  37 +--\n>   ci/util/extract-trash-dirs.sh         |  50 ----\n>   20 files changed, 345 insertions(+), 577 deletions(-)\n>   create mode 100755 ci/check-unignored-build-artifacts.sh\n>   delete mode 100755 ci/install-docker-dependencies.sh\n>   create mode 100644 ci/lib-ci-type.sh\n>   create mode 100644 ci/lib-tput.sh\n>   delete mode 100755 ci/make-test-artifacts.sh\n>   delete mode 100755 ci/mount-fileshare.sh\n>   delete mode 100755 ci/run-build-and-tests.sh\n>   delete mode 100755 ci/run-docker-build.sh\n>   delete mode 100755 ci/run-docker.sh\n>   delete mode 100755 ci/run-static-analysis.sh\n>   delete mode 100755 ci/run-test-slice.sh\n>   create mode 100755 ci/select-test-slice.sh\n>   delete mode 100755 ci/util/extract-trash-dirs.sh\n> \n\n"},{"id":"449336","messageId":"xmqq8ru1uyty.fsf@gitster.g","threadId":"57451","inReplyTo":"4d3fecbf-23f9-f6b6-414e-8eaca620aced@gmail.com","subject":"Re: [PATCH 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-02-23T20:12:25Z","receivedAt":"2022-02-23T20:12:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> I can see that showing compilation errors without having to expand\n> anything is useful but in my experience they are relatively rare \n> compared to test failures. If I understand the rest of the message\n> correctly we're left with having to expand print-test-failures and \n> searching for \"not ok\" to find out what went wrong with this series.\n\nIt matches my experience that most of the time I have to look for\ntest errors, not compilation errors.  Having to expand the other\ngroup and looking for \"not ok\" is something I've got accustomed to,\nso if that part improves, that would be great, but if that part does\nnot become worse, then that is OK, at least to me ;-)\n"},{"id":"449349","messageId":"220223.86pmndb6lj.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"4d3fecbf-23f9-f6b6-414e-8eaca620aced@gmail.com","subject":"Re: [PATCH 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-02-23T21:18:21Z","receivedAt":"2022-02-23T21:45:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Feb 23 2022, Phillip Wood wrote:\n\n> On 21/02/2022 14:46, Ævar Arnfjörð Bjarmason wrote:\n>> [...]\n>> == Details\n>> This series conflicts with and is a proposed alternative to\n>> Johannes's\n>> proposed changes to teach \"ci/lib.sh\" GitHub specific syntax to\n>> \"group\" certain parts of the output[2]. That series proposes to keep\n>> the \"ci/run-build-and-tests.sh\" and similar scripts, but to teach them\n>> to emit markers indicating when the \"build\" part commences, then\n>> \"test\" etc.\n>> I think the approach offered here is better as elaborated on in\n>> 12/25[1], especially because as Johannes notes[3] we only have one\n>> level of \"grouping\" within a \"step\" available to us. In his version\n>> using it for \"build\" v.s. \"test\" precludes being able to group parts\n>> of that \"build\" or \"test\" output in the future.\n>> The following compares CI output between the three with a\n>> change-on-top which caused a compilation error (\"this\" is this series,\n>> \"js\" is Johannes's) when clicking on the \"linux-gcc\" failure:\n>>    master:\n>> https://github.com/avar/git/runs/5274251909?check_suite_focus=true\n>>    this: https://github.com/avar/git/runs/5274464670?check_suite_focus=true\n>>    js: https://github.com/avar/git/runs/5272239403?check_suite_focus=true\n>>    Here we went from 93 lines of output on \"master\" to 47 in \"this\"\n>>    (107 in \"js\"). Note also how in \"this\" we can:\n>>    - Expand the \"Run make\" to get the \"MAKEFLAGS\" and other\n>> variables\n>>      used in the step. That's now a 3-line summary instead of the\n>>      first 50 lines being the old \"ci/lib.sh\" \"set -x\" output.\n>>    - Because \"make\" failed, we have an elided \"make test\" step\n>> that's\n>>      not being run below. We can thus see what steps our failure caused\n>>      us to skip.\n>>    - Unlike the \"js\" version we'll show the compilation error by\n>>      default (the \"js\" version is grouped and needs to be expanded),\n>>      but our output is now brief enough that that's no longer\n>>      surrounded by other irrelevant output.\n>>    - Unlike the \"js\" version there is no \"CI setup\" group within\n>> each\n>>      step. That work is in the earlier \"ci/lib.sh --build\" step\n>>      instead, which sets the config for all subsequent steps.\n>\n> I can see that showing compilation errors without having to expand\n> anything is useful but in my experience they are relatively rare \n> compared to test failures. If I understand the rest of the message\n> correctly we're left with having to expand print-test-failures and \n> searching for \"not ok\" to find out what went wrong with this series.\n\nYes, it's a non-goal of this series to directly improve or change the\n\"prove\" output, or to replace or change the functioning of\nci/print-test-failures.sh.\n\nI think that's also a thing worth doing, it's just not what I'm aiming\nfor here. I.e. the goals of this & Johannes's series is only partial.\n\nThe above summary is comparing the parts of the two where those goals do\noverlap, i.e. it's rougly comparable to patches 1-4/9 of Johannes's\nseries. His 5-9/9 are (mostly) orthagonal modifications to t/test-lib.sh\netc.\n\n>> For other output changes look at the difference between \"master\" and\n>> \"this\" at:\n>>    master: https://github.com/git/git/actions/runs/1866786595\n>>    this: https://github.com/avar/git/actions/runs/1876270588\n>> Not explicitly covered in the summary above is that various other\n>> parts of ci/* were doing the same sort of within-step setup, but now\n>> do so via cross-step passing of variables via $GITHUB_ENV. E.g. on\n>> \"master\" the test slices for the Windows tests have a lot of verbosity\n>> before they get to running the test itself:\n>>      https://github.com/git/git/runs/5254267914?check_suite_focus=true#step:5:56\n>> In the \"js\" version the test output is hidden (\"grouped\"), but we've\n>> got the same amount of verbosity by default:\n>>      https://github.com/gitgitgadget/git/runs/4937491771?check_suite_focus=true#step:5:67\n>> Whereas in \"this\" version that verbosity is in the preceding \"select\n>> tests\" step, with the \"test\" step showing only the relevant end-state\n>> of the \"$T\" variable we'll use in the Makefile (hidden by default,\n>> expanded in this link):\n>>      https://github.com/avar/git/runs/5274558869?check_suite_focus=true#step:7:13\n>\n> All I can see in the \"$T\" variable I have to scroll to get the prove\n> output on screen\n\nYes, what that link is showing you is that for the test run the\nvariables that control the full set of variables that control the test\nrun are now prominently displayed.\n\nAll of the output etc. after that isn't changed.\n\nThe point of those comparisons is to draw your eyes to the part that\n*is* changed v.s. master, and how using that variable passing mechanism\nis making things related to that simpler & less verbose.\n\n>> This series does not attempt to replace the use of the \"group\" output\n>> used for the \"ok\" or \"not ok\" portion of tests in Johannes's\n>> series. When a test fails the output in this series (sans config\n>> discovery not being repeated, and now summarized in the $GITHUB_ENV\n>> drop-down) is substantially the same as on \"master\".\n>> My summary at [4] goes into other overlap & non-overlap between the\n>> two. I think using the \"group\" output for those purposes might be\n>> useful, although I left some feedback on [5] with problems in the\n>> current \"js\" implementation.\n>> I do think any such changes should follow behind this series, as\n>> doing\n>> that sort of grouping once we can effectively free up an extra \"group\"\n>> level (by peeling those off into \"steps\", as is done here) would be\n>> much more useful.\n>\n> I can see the attraction of being able to use make directly in the ci\n> from an implementation point of view but from the point of view of \n> someone trying to investigate a test failure then unless I've\n> misunderstood I don't think this series improves the current\n> situation.\n\nJohannes's series is making use of GitHub's group output with changes to\nci/lib.sh to e.g. distinguish the \"make\" phase from \"make test\".\n\nThis series shows that's not something that's needed to \"group\" those\ntwo.\n\nInstead we can set set the variables and other context that ci/lib.sh\ncurrently sets at the start of every \"step\" in an earlier \"step\" in a\nway that spans later steps.\n\nThose later steps are then a light \"make\" or \"make test\", and because\nsteps are their own \"group\" it accomplishes the same goals for grouping\nthat part of the output, without needing any CI-specific syntax in ci/*.\n\nFurther, if we ever wanted to make use of such syntax for the\n\"ci/lib.sh\" part we could do that on top of this series for\ne.g. \"grouping\" individual errors that \"make\" emits.\n\nDoing that wouldn't be possible with Johannes's approach, since there's\nonly one \"group\" level, you can't nest them. So using it for \"build\" and\n\"test\" means you've already used up your one-level.\n\nIt's also a lot simpler, the resulting code size for the two in terms of\n*.sh code in ci/ is:\n\n    $ git grep . avar/ci-unroll-make-commands-to-ci-recipe 'ci/**.sh'|wc -l\n    422\n    $ git grep . pr-1117/dscho/use-grouping-in-ci-v1 'ci/**.sh'|wc -l\n    721\n\n> Why can't you build on top of Dscho's series that makes it\n> easier to see the output of the failed tests?\n\nBecause building on top of it would mean adding a bunch of code and\ncomplexity to ci/* to accomplish a goal that this series shows that we\ncan equally get without that complexity and added code, as the diffstat\netc. shows.\n\nWhat we do about t/test-lib.sh, \"prove\" etc. emitting summary output\nabout tests is then a mostly orthagonal change on top of that.\n\n\"Mostly\" except insofar that Johannes's series notes that he's left with\nthe limitation[3] that \"sadly, workflow output currently cannot contain\nany nested groups\".\n\nOf course that's also true after this series (that GitHub CI feature\nwill be the same).\n\nBut the difference is that since we won't have used the \"group\" for\n\"make\" and \"make test\" (as it's \"kicked up\" to the \"step\" level) a\nseries to add \"group\"-ing to the test output wouldn't have the group for\nan individual test failure at the same level as \"make test\".\n\n>> 1. https://lore.kernel.org/git/patch-12.25-dfd823f2e7d-20220221T122605Z-avarab@gmail.com\n>> 2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n>> 3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n>> 4. https://lore.kernel.org/git/220127.86ilu5cdnf.gmgdl@evledraar.gmail.com/\n>> 5. https://lore.kernel.org/git/220126.86sftbfjl4.gmgdl@evledraar.gmail.com/\n>> Ævar Arnfjörð Bjarmason (25):\n>>    CI: run \"set -ex\" early in ci/lib.sh\n>>    CI: make \"$jobname\" explicit, remove fallback\n>>    CI: remove more dead Travis CI support\n>>    CI: remove dead \"tree skipping\" code\n>>    CI: remove unused Azure ci/* code\n>>    CI: don't have \"git grep\" invoke a pager in tree content check\n>>    CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>>    CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>>    CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n>>    CI: consistently use \"export\" in ci/lib.sh\n>>    CI: export variables via a wrapper\n>>    CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n>>    CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n>>    CI: invoke \"make artifacts-tar\" directly in windows-build\n>>    CI: split up and reduce \"ci/test-documentation.sh\"\n>>    CI: combine ci/install{,-docker}-dependencies.sh\n>>    CI: move \"env\" definitions into ci/lib.sh\n>>    ci/run-test-slice.sh: replace shelling out with \"echo\"\n>>    CI: pre-select test slice in Windows & VS tests\n>>    CI: only invoke ci/lib.sh as \"steps\" in main.yml\n>>    CI: narrow down variable definitions in --build and --test\n>>    CI: add more variables to MAKEFLAGS, except under vs-build\n>>    CI: stop over-setting the $CC variable\n>>    CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n>>    CI: don't use \"set -x\" in \"ci/lib.sh\" output\n>>   .github/workflows/main.yml            | 100 +++++---\n>>   Makefile                              |  32 ++-\n>>   ci/check-directional-formatting.bash  |   2 +-\n>>   ci/check-unignored-build-artifacts.sh |  20 ++\n>>   ci/install-dependencies.sh            |  53 ++++-\n>>   ci/install-docker-dependencies.sh     |  22 --\n>>   ci/lib-ci-type.sh                     |  10 +\n>>   ci/lib-tput.sh                        |   2 +\n>>   ci/lib.sh                             | 315 ++++++++++++--------------\n>>   ci/make-test-artifacts.sh             |  12 -\n>>   ci/mount-fileshare.sh                 |  25 --\n>>   ci/print-test-failures.sh             |  16 +-\n>>   ci/run-build-and-tests.sh             |  54 -----\n>>   ci/run-docker-build.sh                |  66 ------\n>>   ci/run-docker.sh                      |  47 ----\n>>   ci/run-static-analysis.sh             |  32 ---\n>>   ci/run-test-slice.sh                  |  17 --\n>>   ci/select-test-slice.sh               |  10 +\n>>   ci/test-documentation.sh              |  37 +--\n>>   ci/util/extract-trash-dirs.sh         |  50 ----\n>>   20 files changed, 345 insertions(+), 577 deletions(-)\n>>   create mode 100755 ci/check-unignored-build-artifacts.sh\n>>   delete mode 100755 ci/install-docker-dependencies.sh\n>>   create mode 100644 ci/lib-ci-type.sh\n>>   create mode 100644 ci/lib-tput.sh\n>>   delete mode 100755 ci/make-test-artifacts.sh\n>>   delete mode 100755 ci/mount-fileshare.sh\n>>   delete mode 100755 ci/run-build-and-tests.sh\n>>   delete mode 100755 ci/run-docker-build.sh\n>>   delete mode 100755 ci/run-docker.sh\n>>   delete mode 100755 ci/run-static-analysis.sh\n>>   delete mode 100755 ci/run-test-slice.sh\n>>   create mode 100755 ci/select-test-slice.sh\n>>   delete mode 100755 ci/util/extract-trash-dirs.sh\n>> \n\n"},{"id":"450486","messageId":"20220305081746.GA1655@szeder.dev","threadId":"57451","inReplyTo":"patch-23.25-8a8b7ecf16b-20220221T143936Z-avarab@gmail.com","subject":"Re: [PATCH 23/25] CI: stop over-setting the $CC variable","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2022-03-05T08:17:46Z","receivedAt":"2022-03-05T08:18:00Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Mon, Feb 21, 2022 at 03:46:35PM +0100, Ævar Arnfjörð Bjarmason wrote:\n> As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n> 2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\n> to setting it in the environment was due to Travis CI clobbering $CC\n> in the environment.\n\nThis is not what 2c8921db2b8 detailed; in fact 2c8921db2b8 detailed\nthe exact opposite.  Travis CI did not clobber $CC, it set $CC to what\nwe asked it to.  We started using $CC in $MAKEFLAGS as opposed to\nsetting it in the environment, because our Makefile _ignores_ $CC in\nthe environment.\n\n"},{"id":"450493","messageId":"220305.8635jw4h78.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"20220305081746.GA1655@szeder.dev","subject":"Re: [PATCH 23/25] CI: stop over-setting the $CC variable","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-05T14:15:01Z","receivedAt":"2022-03-05T14:17:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Mar 05 2022, SZEDER Gábor wrote:\n\n> On Mon, Feb 21, 2022 at 03:46:35PM +0100, Ævar Arnfjörð Bjarmason wrote:\n>> As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n>> 2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\n>> to setting it in the environment was due to Travis CI clobbering $CC\n>> in the environment.\n>\n> This is not what 2c8921db2b8 detailed; in fact 2c8921db2b8 detailed\n> the exact opposite.  Travis CI did not clobber $CC, it set $CC to what\n> we asked it to.  We started using $CC in $MAKEFLAGS as opposed to\n> setting it in the environment, because our Makefile _ignores_ $CC in\n> the environment.\n\nThanks. You're completely right, I don't know how I got that wrong when\nwriting this summary.\n\nI'll fix it.\n\nBut as for the body of the change I believe it looks good & is\nconsistent with avoiding that issue. I.e. we'll set it in MAKEFLAGS both\nbefore and after this change.\n\nWe just won't have a separate \"CC\" variable in the environment as far as\nGitHub's environment variable dump is concerned, which IMO makes this a\nlot easier to follow, i.e. we only need CC as a \"make\" argument, so\nlet's add it and other such things to MAKEFLAGS only.\n"},{"id":"450941","messageId":"nycvar.QRO.7.76.6.2203092304320.357@tvgsbejvaqbjf.bet","threadId":"57451","inReplyTo":"220223.86pmndb6lj.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-03-09T22:10:15Z","receivedAt":"2022-03-09T22:10:31Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ævar,\n\nOn Wed, 23 Feb 2022, Ævar Arnfjörð Bjarmason wrote:\n\n> On Wed, Feb 23 2022, Phillip Wood wrote:\n>\n> > If I understand the rest of the message correctly we're left with\n> > having to expand print-test-failures and searching for \"not ok\" to\n> > find out what went wrong with this series.\n>\n> Yes, it's a non-goal of this series to directly improve or change the\n> \"prove\" output, or to replace or change the functioning of\n> ci/print-test-failures.sh.\n\nSince it is explicitly _not_ the goal of this series, but of the series I\noffered for review in\nhttps://lore.kernel.org/git/pull.1117.v2.git.1646130289.gitgitgadget@gmail.com/\n(with which this here patch series conflicts rather intentionally), I\nsuggest that your patch series can wait a little longer and build on top\nof mine.\n\nWe do have the rule in the Git project to try to avoid conflicting with\npatch series that are already in flight. It just makes the lives of all\ninvolved parties so much easier.\n\nThanks,\nJohannes\n"},{"id":"452318","messageId":"patch-v2-15.25-dfa91ac8938-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 15/25] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:06Z","receivedAt":"2022-03-25T19:28:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 2c23a19eac2..92b914f16fd 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 05f3dd15e27..fc6ce4d3e04 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -39,16 +39,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452321","messageId":"patch-v2-19.25-2edea06ee4d-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 19/25] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:10Z","receivedAt":"2022-03-25T19:28:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  4 ++--\n 2 files changed, 10 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (57%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex fe37e0f1b36..1e13718b989 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 57%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..ec602f8a053 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,10 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+echo T=\"$tests\" >>$GITHUB_ENV\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452322","messageId":"patch-v2-16.25-ba4ed216769-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 16/25] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:07Z","receivedAt":"2022-03-25T19:29:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, and because the\n\"ci/install-dependencies.sh\" used \"ci/lib.sh\", which requires\n\"bash\". At least one of the docker containers doesn't have \"bash\". To\nmake the existing code POSIX-compatible we need to replace pushd/popd\nwith a sub-shell, but no other changes were needed.\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 27 ++++++++++++++++++++++-----\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 23 insertions(+), 28 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 92b914f16fd..3fd3e4f873c 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 01006379fd0..9388289d0ed 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -34,18 +34,20 @@ ubuntu-latest)\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n \tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n+\t)\n \tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n@@ -90,6 +92,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null && type p4 >/dev/null\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452324","messageId":"patch-v2-08.25-81e06f13d84-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 08/25] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:59Z","receivedAt":"2022-03-25T19:29:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d30862a23a2..82f4206188a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3378,7 +3378,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3468,5 +3468,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452325","messageId":"patch-v2-02.25-b23aa99fd37-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 02/25] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:53Z","receivedAt":"2022-03-25T19:29:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57141d38a85..d2a7c33f536 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"must set a CI jobname\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452327","messageId":"patch-v2-13.25-649ad1ae249-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 13/25] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:04Z","receivedAt":"2022-03-25T19:29:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c83f6a21ca3..05c5771e7f6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452329","messageId":"patch-v2-17.25-b5e89a33340-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 17/25] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:08Z","receivedAt":"2022-03-25T19:30:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 3fd3e4f873c..fe37e0f1b36 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex fc6ce4d3e04..b882849ed5d 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -95,6 +95,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452330","messageId":"patch-v2-24.25-06bf8d9f61b-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 24/25] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:15Z","receivedAt":"2022-03-25T19:30:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57c9117a35a..663cbdef9d1 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -99,14 +99,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -160,10 +152,12 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \tCC_PACKAGE=gcc-9\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452333","messageId":"patch-v2-05.25-b5e6d538554-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 05/25] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:56Z","receivedAt":"2022-03-25T19:32:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  7 +------\n 4 files changed, 2 insertions(+), 46 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex dbcebad2fb2..e7ea8799411 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tbrew install --cask --no-quarantine perforce || {\n \t\t# Update the definitions and try again\n@@ -69,7 +67,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5a8938d4b3c..ad1aa59a384 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 00fcf27b1b2..0c63b6f7962 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -38,14 +38,9 @@ do\n \t\ttest_name=\"${TEST_EXIT%.exit}\"\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n+\t\tmkdir -p failed-test-artifacts\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n-\t\t\t;;\n \t\tgithub-actions)\n-\t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452335","messageId":"patch-v2-25.25-6dc96ba8b82-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 25/25] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:16Z","receivedAt":"2022-03-25T19:32:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh | 2 ++\n ci/lib.sh         | 9 ++++++++-\n 2 files changed, 10 insertions(+), 1 deletion(-)\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex bd6e093c8f4..6cfe58596d2 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -6,3 +6,5 @@ else\n \tenv >&2\n \texit 1\n fi\n+\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 663cbdef9d1..304380958bd 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -11,12 +11,16 @@ then\n \techo \"need a $0 mode, e.g. --build or --test\"\n \texit 1\n fi\n+echo \"CONFIG: mode=$mode\" >&2\n \n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname\" >&2\n \texit 1\n fi\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n \n # Helper functions\n setenv () {\n@@ -39,6 +43,7 @@ setenv () {\n \n \tif test -n \"$skip\"\n \tthen\n+\t\techo \"SKIP '$key=$val'\" >&2\n \t\treturn 0\n \tfi\n \n@@ -50,6 +55,8 @@ setenv () {\n \t\t# itself.\n \t\teval \"export $key=\\\"$val\\\"\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452341","messageId":"patch-v2-12.25-86d5a48d59a-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 12/25] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:03Z","receivedAt":"2022-03-25T19:32:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant output non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 40 ++++++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 62 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..c83f6a21ca3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: no\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 34b4400f38b..01006379fd0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 1a1fa0e4bb2..05f3dd15e27 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -27,7 +29,14 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telse\n+\t\t# For local debugging. Not used by the GitHub CI\n+\t\t# itself.\n+\t\teval \"export $key=\\\"$val\\\"\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -96,6 +105,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452343","messageId":"patch-v2-07.25-5d46d5b34c9-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 07/25] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:58Z","receivedAt":"2022-03-25T19:33:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 28 ++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n shared.mak                 |  1 +\n 4 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex 70f0a004e75..d30862a23a2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3007,6 +3007,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3442,3 +3456,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\ndiff --git a/shared.mak b/shared.mak\nindex 4e1b62ee99e..0593b3c98be 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -68,6 +68,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \n ## Used in \"Documentation/Makefile\"\n \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452344","messageId":"RFC-patch-v3-4.6-429c256ac62-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 4/6] ci: optionally mark up output in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:13Z","receivedAt":"2022-03-25T19:33:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA couple of commands exist to spruce up the output in GitHub workflows:\nhttps://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions\n\nIn addition to the `::group::<label>`/`::endgroup::` commands (which we\nalready use to structure the output of the build step better), we also\nuse `::error::`/`::notice::` to draw the attention to test failures and\nto test cases that were expected to fail but didn't.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh              |  4 +--\n t/test-lib-github-workflow-markup.sh | 50 ++++++++++++++++++++++++++++\n t/test-lib.sh                        |  5 ++-\n 3 files changed, 56 insertions(+), 3 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 0f439c99d61..4e86f7d9d0e 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -719,7 +719,7 @@ test_verify_prereq () {\n }\n \n test_expect_failure () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-failure\"\n@@ -739,7 +739,7 @@ test_expect_failure () {\n }\n \n test_expect_success () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-success\"\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nnew file mode 100644\nindex 00000000000..d8dc969df4a\n--- /dev/null\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -0,0 +1,50 @@\n+# Library of functions to mark up test scripts' output suitable for\n+# pretty-printing it in GitHub workflows.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when run in GitHub\n+# workflows; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\ttest -n \"$GIT_TEST_TEE_OUTPUT_FILE\" ||\n+\tdie \"--github-workflow-markup requires --verbose-log\"\n+\tgithub_markup_output=\"${GIT_TEST_TEE_OUTPUT_FILE%.out}.markup\"\n+\t>$github_markup_output\n+\tGIT_TEST_TEE_OFFSET=0\n+}\n+\n+# No need to override start_test_case_output\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tfailure)\n+\t\techo >>$github_markup_output \"::error::failed: $this_test.$test_count $1\"\n+\t\t;;\n+\tfixed)\n+\t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n+\t\t;;\n+\tesac\n+\techo >>$github_markup_output \"::group::$test_case_result: $this_test.$test_count $*\"\n+\ttest-tool >>$github_markup_output path-utils skip-n-bytes \\\n+\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\techo >>$github_markup_output \"::endgroup::\"\n+}\n+\n+# No need to override finalize_test_output\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 65b63359ddb..5ba4051d588 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -204,6 +204,9 @@ parse_option () {\n \t--write-junit-xml)\n \t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n+\t--github-workflow-markup)\n+\t\t. \"$TEST_DIRECTORY/test-lib-github-workflow-markup.sh\"\n+\t\t;;\n \t--stress)\n \t\tstress=t ;;\n \t--stress=*)\n@@ -1077,7 +1080,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tstart_test_case_output\n+\tstart_test_case_output \"$@\"\n }\n \n test_finish_ () {\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452345","messageId":"RFC-patch-v3-6.6-1d2b94436fc-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 6/6] ci: call `finalize_test_case_output` a little later","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:15Z","receivedAt":"2022-03-25T19:33:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe used to call that function already before printing the final verdict.\nHowever, now that we added grouping to the GitHub workflow output, we\nwill want to include even that part in the collapsible group for that\ntest case.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 5ba4051d588..b3ee37988e2 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -782,30 +782,31 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n+\tfinalize_test_case_output ok \"$@\"\n }\n \n test_failure_ () {\n-\tfinalize_test_case_output failure \"$@\"\n+\tfailure_label=$1\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n \tprintf '%s\\n' \"$*\" | sed -e 's/^/#\t/'\n \ttest \"$immediate\" = \"\" || _error_exit\n+\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n }\n \n test_known_broken_ok_ () {\n-\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n+\tfinalize_test_case_output fixed \"$@\"\n }\n \n test_known_broken_failure_ () {\n-\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n+\tfinalize_test_case_output broken \"$@\"\n }\n \n test_debug () {\n@@ -1131,10 +1132,10 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n+\t\tfinalize_test_case_output skip \"$@\"\n \t\t;;\n \t*)\n \t\tfalse\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452346","messageId":"RFC-patch-v3-1.6-d88749c60c9-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 1/6] ci: make it easier to find failed tests' logs in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:10Z","receivedAt":"2022-03-25T19:33:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhen investigating a test failure, the time that matters most is the\ntime it takes from getting aware of the failure to displaying the output\nof the failing test case.\n\nYou currently have to know a lot of implementation details when\ninvestigating test failures in the CI runs. The first step is easy: the\nfailed job is marked quite clearly, but when opening it, the failed step\nis expanded, which in our case is the one running\n`ci/run-build-and-tests.sh`. This step, most notably, only offers a\nhigh-level view of what went wrong: it prints the output of `prove`\nwhich merely tells the reader which test script failed.\n\nThe actually interesting part is in the detailed log of said failed\ntest script. But that log is shown in the CI run's step that runs\n`ci/print-test-failures.sh`. And that step is _not_ expanded in the web\nUI by default. It is even marked as \"successful\", which makes it very\neasy to miss that there is useful information hidden in there.\n\nLet's help the reader by showing the failed tests' detailed logs in the\nstep that is expanded automatically, i.e. directly after the test suite\nfailed.\n\nThis also helps the situation where the _build_ failed and the\n`print-test-failures` step was executed under the assumption that the\n_test suite_ failed, and consequently failed to find any failed tests.\n\nAn alternative way to implement this patch would be to source\n`ci/print-test-failures.sh` in the `handle_test_failures` function to\nshow these logs. However, over the course of the next few commits, we\nwant to introduce some grouping which would be harder to achieve that\nway (for example, we do want a leaner, and colored, preamble for each\nfailed test script, and it would be trickier to accommodate the lack of\nnested groupings in GitHub workflows' output).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml       | 20 ++++--------------\n ci/print-test-failures-github.sh | 35 ++++++++++++++++++++++++++++++++\n 2 files changed, 39 insertions(+), 16 deletions(-)\n create mode 100755 ci/print-test-failures-github.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 6d25ec4ae3b..e55dda807f0 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -129,11 +129,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -218,11 +214,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -265,10 +257,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success()\n-    - run: ci/print-test-failures.sh\n-      if: failure()\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -301,10 +291,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success() && matrix.vector.skip-tests != 'no'\n-    - run: ci/print-test-failures.sh\n-      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\ndiff --git a/ci/print-test-failures-github.sh b/ci/print-test-failures-github.sh\nnew file mode 100755\nindex 00000000000..218aaf19763\n--- /dev/null\n+++ b/ci/print-test-failures-github.sh\n@@ -0,0 +1,35 @@\n+#!/bin/sh\n+\n+. ${0%/*}/lib-ci-type.sh\n+\n+set -e\n+\n+case \"$CI_TYPE\" in\n+github-actions)\n+\thandle_failed_tests () {\n+\t\tmkdir -p t/failed-test-artifacts\n+\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n+\n+\t\tfor test_exit in t/test-results/*.exit\n+\t\tdo\n+\t\t\ttest 0 != \"$(cat \"$test_exit\")\" || continue\n+\n+\t\t\ttest_name=\"${test_exit%.exit}\"\n+\t\t\ttest_name=\"${test_name##*/}\"\n+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n+\t\t\tcat \"t/test-results/$test_name.out\"\n+\n+\t\t\ttrash_dir=\"t/trash directory.$test_name\"\n+\t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n+\t\t\ttar czf t/failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n+\t\tdone\n+\t\treturn 1\n+\t}\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n+\texit 1\n+\t;;\n+esac\n+\n+handle_failed_tests\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452347","messageId":"RFC-patch-v3-2.6-ad1e1465a81-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 2/6] tests: refactor --write-junit-xml code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:11Z","receivedAt":"2022-03-25T19:33:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe code writing JUnit XML is interspersed directly with all the code in\n`t/test-lib.sh`, and it is therefore not only ill-separated, but\nintroducing yet another output format would make the situation even\nworse.\n\nLet's introduce an abstraction layer by hiding the JUnit XML code behind\nfour new functions that are supposed to be called before and after each\ntest and test case.\n\nThis is not just an academic exercise, refactoring for refactoring's\nsake. We _actually_ want to introduce such a new output format, to\nmake it substantially easier to diagnose test failures in our GitHub\nworkflow, therefore we do need this refactoring.\n\nThis commit is best viewed with `git show --color-moved\n--color-moved-ws=allow-indentation-change <commit>`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++\n t/test-lib.sh       | 124 ++++++-------------------------------------\n 2 files changed, 142 insertions(+), 108 deletions(-)\n create mode 100644 t/test-lib-junit.sh\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nnew file mode 100644\nindex 00000000000..9d55d74d764\n--- /dev/null\n+++ b/t/test-lib-junit.sh\n@@ -0,0 +1,126 @@\n+# Library of functions to format test scripts' output in JUnit XML\n+# format, to support Git's test suite result to be presented in an\n+# easily digestible way on Azure Pipelines.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when the user asks\n+# for JUnit XML; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n+\tmkdir -p \"$junit_xml_dir\"\n+\tjunit_xml_base=${1##*/}\n+\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n+\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n+\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n+\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n+\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n+\tjunit_suite_start=$(test-tool date getnanos)\n+\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\tthen\n+\t\tGIT_TEST_TEE_OFFSET=0\n+\tfi\n+}\n+\n+start_test_case_output () {\n+\tjunit_start=$(test-tool date getnanos)\n+}\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tok)\n+\t\tset \"$*\"\n+\t\t;;\n+\tfailure)\n+\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n+\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\t\t   then\n+\t\t\t\ttest-tool path-utils skip-n-bytes \\\n+\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\t\t\t   else\n+\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n+\t\t\t   fi)\")\"\n+\t\tjunit_insert=\"$junit_insert</failure>\"\n+\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\tthen\n+\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n+\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n+\t\tfi\n+\t\tset \"$1\" \"      $junit_insert\"\n+\t\t;;\n+\tfixed)\n+\t\tset \"$* (breakage fixed)\"\n+\t\t;;\n+\tbroken)\n+\t\tset \"$* (known breakage)\"\n+\t\t;;\n+\tskip)\n+\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n+\t\t;;\n+\tesac\n+\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tshift\n+\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n+\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n+\t\tdate getnanos $junit_start)\\\"\"\n+\twrite_junit_xml \"$(printf '%s\\n' \\\n+\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n+\tjunit_have_testcase=t\n+}\n+\n+finalize_test_output () {\n+\tif test -n \"$junit_xml_path\"\n+\tthen\n+\t\ttest -n \"$junit_have_testcase\" || {\n+\t\t\tjunit_start=$(test-tool date getnanos)\n+\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n+\t\t}\n+\n+\t\t# adjust the overall time\n+\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n+\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n+\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n+\t\t\t-e '/^ *<\\/testsuite/d' \\\n+\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n+\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n+\n+\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n+\t\twrite_junit_xml=\n+\tfi\n+}\n+\n+write_junit_xml () {\n+\tcase \"$1\" in\n+\t--truncate)\n+\t\t>\"$junit_xml_path\"\n+\t\tjunit_have_testcase=\n+\t\tshift\n+\t\t;;\n+\tesac\n+\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n+}\n+\n+xml_attr_encode () {\n+\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+}\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 515b1af7ed4..65b63359ddb 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -137,6 +137,12 @@ mark_option_requires_arg () {\n \tstore_arg_to=$2\n }\n \n+# These functions can be overridden e.g. to output JUnit XML\n+start_test_output () { :; }\n+start_test_case_output () { :; }\n+finalize_test_case_output () { :; }\n+finalize_test_output () { :; }\n+\n parse_option () {\n \tlocal opt=\"$1\"\n \n@@ -196,7 +202,7 @@ parse_option () {\n \t\ttee=t\n \t\t;;\n \t--write-junit-xml)\n-\t\twrite_junit_xml=t\n+\t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n \t--stress)\n \t\tstress=t ;;\n@@ -663,7 +669,7 @@ exec 6<&0\n exec 7>&2\n \n _error_exit () {\n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \tGIT_EXIT_OK=t\n \texit 1\n }\n@@ -773,35 +779,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$*\"\n-\tfi\n+\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n }\n \n test_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n-\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\t\t   then\n-\t\t\t\ttest-tool path-utils skip-n-bytes \\\n-\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n-\t\t\t   else\n-\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n-\t\t\t   fi)\")\"\n-\t\tjunit_insert=\"$junit_insert</failure>\"\n-\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\tthen\n-\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n-\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n-\t\tfi\n-\t\twrite_junit_xml_testcase \"$1\" \"      $junit_insert\"\n-\tfi\n+\tfinalize_test_case_output failure \"$@\"\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -810,19 +794,13 @@ test_failure_ () {\n }\n \n test_known_broken_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (breakage fixed)\"\n-\tfi\n+\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n }\n \n test_known_broken_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (known breakage)\"\n-\tfi\n+\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n }\n@@ -1099,10 +1077,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_start=$(test-tool date getnanos)\n-\tfi\n+\tstart_test_case_output\n }\n \n test_finish_ () {\n@@ -1153,12 +1128,7 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tif test -n \"$write_junit_xml\"\n-\t\tthen\n-\t\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n-\t\t\twrite_junit_xml_testcase \"$1\" \\\n-\t\t\t\t\"      <skipped message=\\\"$message\\\" />\"\n-\t\tfi\n+\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n@@ -1174,53 +1144,6 @@ test_at_end_hook_ () {\n \t:\n }\n \n-write_junit_xml () {\n-\tcase \"$1\" in\n-\t--truncate)\n-\t\t>\"$junit_xml_path\"\n-\t\tjunit_have_testcase=\n-\t\tshift\n-\t\t;;\n-\tesac\n-\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n-}\n-\n-xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n-}\n-\n-write_junit_xml_testcase () {\n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n-\tshift\n-\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n-\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n-\t\tdate getnanos $junit_start)\\\"\"\n-\twrite_junit_xml \"$(printf '%s\\n' \\\n-\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n-\tjunit_have_testcase=t\n-}\n-\n-finalize_junit_xml () {\n-\tif test -n \"$write_junit_xml\" && test -n \"$junit_xml_path\"\n-\tthen\n-\t\ttest -n \"$junit_have_testcase\" || {\n-\t\t\tjunit_start=$(test-tool date getnanos)\n-\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n-\t\t}\n-\n-\t\t# adjust the overall time\n-\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n-\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n-\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n-\t\t\t-e '/^ *<\\/testsuite/d' \\\n-\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n-\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n-\n-\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n-\t\twrite_junit_xml=\n-\tfi\n-}\n-\n test_atexit_cleanup=:\n test_atexit_handler () {\n \t# In a succeeding test script 'test_atexit_handler' is invoked\n@@ -1243,7 +1166,7 @@ test_done () {\n \t# removed, so the commands can access pidfiles and socket files.\n \ttest_atexit_handler\n \n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \n \tif test -z \"$HARNESS_ACTIVE\"\n \tthen\n@@ -1534,22 +1457,7 @@ fi\n # in subprocesses like git equals our $PWD (for pathname comparisons).\n cd -P \"$TRASH_DIRECTORY\" || exit 1\n \n-if test -n \"$write_junit_xml\"\n-then\n-\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n-\tmkdir -p \"$junit_xml_dir\"\n-\tjunit_xml_base=${0##*/}\n-\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n-\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n-\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n-\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n-\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n-\tjunit_suite_start=$(test-tool date getnanos)\n-\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\tthen\n-\t\tGIT_TEST_TEE_OFFSET=0\n-\tfi\n-fi\n+start_test_output \"$0\"\n \n # Convenience\n # A regexp to match 5 and 35 hexdigits\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452348","messageId":"patch-v2-01.25-4addbd70213-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 01/25] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:52Z","receivedAt":"2022-03-25T19:33:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cbc2f8f1caa..57141d38a85 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452349","messageId":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[RFC PATCH v3 0/6] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:09Z","receivedAt":"2022-03-25T19:33:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This is a rebasing of v2 of js/ci-github-workflow-markup[1] on top of\nmy just-submitted v2 of my own CI changes[2] which make most of that\nseries's changes to ci/ unnecessary, as it'll get the split of \"build\"\nand \"test\" output for free without the need for any special GitHub\nworkflow syntax.\n\nThat's because that series eliminates the monolithic:\n\n    - ci/run-build-and-tests.sh\n\nIn favor of:\n\n    - make\n    - make test\n\nSo what it did with markup to delineate those two is now done\nautomatically by focusing on the relevant \"step\" within a job that\nfailed.\n\nA demo of a failing run for this series (with an intentionally broken\npatch on top) can be seen at\nhttps://github.com/avar/git/actions/runs/2041259003\n\nAs it shows the GitHub workflow syntax for test failures is retained,\ne.g.:\nhttps://github.com/avar/git/runs/5695803104?check_suite_focus=true\n\nBut for build failures the GitHub workflow syntax isn't needed\nanymore, e.g. this job where we focus on the failing \"make\":\nhttps://github.com/avar/git/runs/5695557199?check_suite_focus=true\n\nNote that the UI of the latter is also better because we can see in\nthe \"skipped\" portion that we didn't run the \"make test\", since we're\nnow piggy-backing on the CI flow to show that, as opposed to in\njs/ci-github-workflow-markup:\nhttps://github.com/git-for-windows/git/runs/4822802185?check_suite_focus=true\n\nThe 5/6 change here (as seen in the range diff) the gets rid of a\nlimitation that js/ci-github-workflow-markup commented on being\nunfortunate, i.e. we can now do more with the GitHub workflow syntax\nas a result of not usign it for the \"top-level\" of \"make\" and \"make\ntest\".\n\n1. https://lore.kernel.org/git/pull.1117.v2.git.1646130289.gitgitgadget@gmail.com/\n2. https://lore.kernel.org/git/cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com\n\nJohannes Schindelin (6):\n  ci: make it easier to find failed tests' logs in the GitHub workflow\n  tests: refactor --write-junit-xml code\n  test(junit): avoid line feeds in XML attributes\n  ci: optionally mark up output in the GitHub workflow\n  ci: use `--github-workflow-markup` in the GitHub workflow\n  ci: call `finalize_test_case_output` a little later\n\n .github/workflows/main.yml           |  20 +---\n ci/lib.sh                            |   2 +-\n ci/print-test-failures-github.sh     |  35 +++++++\n t/test-lib-functions.sh              |   4 +-\n t/test-lib-github-workflow-markup.sh |  50 ++++++++++\n t/test-lib-junit.sh                  | 132 +++++++++++++++++++++++++++\n t/test-lib.sh                        | 128 ++++----------------------\n 7 files changed, 244 insertions(+), 127 deletions(-)\n create mode 100755 ci/print-test-failures-github.sh\n create mode 100644 t/test-lib-github-workflow-markup.sh\n create mode 100644 t/test-lib-junit.sh\n\nRange-diff against v2:\n 1:  db08b07c37a <  -:  ----------- ci: fix code style\n 2:  42ff3e170bf <  -:  ----------- ci/run-build-and-tests: take a more high-level view\n 3:  bbbe1623257 !  1:  d88749c60c9 ci: make it easier to find failed tests' logs in the GitHub workflow\n    @@ Commit message\n         nested groupings in GitHub workflows' output).\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## .github/workflows/main.yml ##\n     @@ .github/workflows/main.yml: jobs:\n    +       shell: bash\n          - name: test\n            shell: bash\n    -       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n    +-      run: . /etc/profile && make -C t -e\n     -    - name: ci/print-test-failures.sh\n     -      if: failure()\n     -      shell: bash\n     -      run: ci/print-test-failures.sh\n    ++      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n    -       env:\n    -         NO_SVN_TESTS: 1\n    -       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n    +       shell: bash\n    +     - name: test\n    +       shell: bash\n    +-      run: . /etc/profile && make -C t -e\n     -    - name: ci/print-test-failures.sh\n     -      if: failure()\n     -      shell: bash\n     -      run: ci/print-test-failures.sh\n    ++      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n    -     - uses: actions/checkout@v2\n    -     - run: ci/install-dependencies.sh\n    -     - run: ci/run-build-and-tests.sh\n    +     - run: ci/lib.sh --build\n    +     - run: make\n    +     - run: ci/lib.sh --test\n    +-    - run: make test\n    ++    - run: make test || ci/print-test-failures-github.sh\n    +       if: success()\n     -    - run: ci/print-test-failures.sh\n     -      if: failure()\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n    -     - uses: actions/checkout@v1\n    -     - run: ci/install-docker-dependencies.sh\n    -     - run: ci/run-build-and-tests.sh\n    +     - run: ci/lib.sh --build\n    +     - run: make\n    +     - run: ci/lib.sh --test\n    +-    - run: make test\n    ++    - run: make test || ci/print-test-failures-github.sh\n    +       if: success() && matrix.vector.skip-tests != 'no'\n     -    - run: ci/print-test-failures.sh\n    --      if: failure()\n    +-      if: failure() && matrix.vector.skip-tests != 'no'\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v1\n     \n    - ## ci/lib.sh ##\n    -@@ ci/lib.sh: check_unignored_build_artifacts () {\n    - \t}\n    - }\n    - \n    -+handle_failed_tests () {\n    -+\treturn 1\n    -+}\n    + ## ci/print-test-failures-github.sh (new) ##\n    +@@\n    ++#!/bin/sh\n     +\n    - # GitHub Action doesn't set TERM, which is required by tput\n    - export TERM=${TERM:-dumb}\n    - \n    -@@ ci/lib.sh: then\n    - \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n    - \tCC=\"${CC:-gcc}\"\n    - \tDONT_SKIP_TAGS=t\n    ++. ${0%/*}/lib-ci-type.sh\n    ++\n    ++set -e\n    ++\n    ++case \"$CI_TYPE\" in\n    ++github-actions)\n     +\thandle_failed_tests () {\n     +\t\tmkdir -p t/failed-test-artifacts\n     +\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n    @@ ci/lib.sh: then\n     +\t\tdone\n     +\t\treturn 1\n     +\t}\n    - \n    - \tcache_dir=\"$HOME/none\"\n    - \n    -\n    - ## ci/run-build-and-tests.sh ##\n    -@@ ci/run-build-and-tests.sh: esac\n    - make\n    - if test -n \"$run_tests\"\n    - then\n    --\tmake test\n    -+\tmake test ||\n    -+\thandle_failed_tests\n    - fi\n    - check_unignored_build_artifacts\n    - \n    -\n    - ## ci/run-test-slice.sh ##\n    -@@ ci/run-test-slice.sh: esac\n    - \n    - make --quiet -C t T=\"$(cd t &&\n    - \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n    --\ttr '\\n' ' ')\"\n    -+\ttr '\\n' ' ')\" ||\n    ++\t;;\n    ++*)\n    ++\techo \"Unhandled CI type: $CI_TYPE\" >&2\n    ++\texit 1\n    ++\t;;\n    ++esac\n    ++\n     +handle_failed_tests\n    - \n    - check_unignored_build_artifacts\n 4:  f72254a9ac6 <  -:  ----------- ci/run-build-and-tests: add some structure to the GitHub workflow output\n 5:  9eda6574313 !  2:  ad1e1465a81 tests: refactor --write-junit-xml code\n    @@ Commit message\n         --color-moved-ws=allow-indentation-change <commit>`.\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## t/test-lib-junit.sh (new) ##\n     @@\n 6:  c8b240af749 !  3:  fc96e5b7296 test(junit): avoid line feeds in XML attributes\n    @@ Commit message\n         incorrect, so let's fix it.\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## t/test-lib-junit.sh ##\n     @@ t/test-lib-junit.sh: finalize_test_case_output () {\n 7:  15f199e810e !  4:  429c256ac62 ci: optionally mark up output in the GitHub workflow\n    @@ Commit message\n         to test cases that were expected to fail but didn't.\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## t/test-lib-functions.sh ##\n     @@ t/test-lib-functions.sh: test_verify_prereq () {\n 8:  91ea54f36c5 !  5:  72058db67b0 ci: use `--github-workflow-markup` in the GitHub workflow\n    @@ Metadata\n      ## Commit message ##\n         ci: use `--github-workflow-markup` in the GitHub workflow\n     \n    -    This makes the output easier to digest.\n    +    [Ævar: due to re-structuring on top of my series the {begin,end}_group\n    +    in CI isn't needed at all to get \"group\" output for the test\n    +    suite. This commit includes the now-squashed \"ci/run-build-and-tests:\n    +    add some structure to the GitHub workflow output\":]\n     \n    -    Note: since workflow output currently cannot contain any nested groups\n    -    (see https://github.com/actions/runner/issues/802 for details), we need\n    -    to remove the explicit grouping that would span the entirety of each\n    -    failed test script.\n    +    The current output of Git's GitHub workflow can be quite confusing,\n    +    especially for contributors new to the project.\n    +\n    +    To make it more helpful, let's introduce some collapsible grouping.\n    +    Initially, readers will see the high-level view of what actually\n    +    happened (did the build fail, or the test suite?). To drill down, the\n    +    respective group can be expanded.\n    +\n    +    Note: sadly, workflow output currently cannot contain any nested groups\n    +    (see https://github.com/actions/runner/issues/802 for details),\n    +    therefore we take pains to ensure to end any previous group before\n    +    starting a new one.\n    +\n    +    [Ævar: The above comment isn't true anymore, as that limitation has\n    +    been removed by basing this on my patches to run \"make\" and \"make\n    +    test\" directly from the top-level of main.yml.\n    +\n    +    Those are now effectively their own \"group\", effectively giving this\n    +    stage another group \"level\" to use. This means that the equivalent of\n    +    \"make test\" won't be on the same level as an individual test failure.\n    +\n    +    We no longer take any pains to ensure balanced group output as a\n    +    result (which was a caveat the previous ci/lib.sh implementation had\n    +    to deal with., We just need to \"cat\" the generated *.markup]\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: then\n    +@@ ci/lib.sh: MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    + case \"$CI_TYPE\" in\n    + github-actions)\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n    +-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    ++\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    + \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n    + \ttest Windows != \"$RUNNER_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    +\n    + ## ci/print-test-failures-github.sh ##\n    +@@ ci/print-test-failures-github.sh: github-actions)\n      \t\t\ttest_name=\"${test_exit%.exit}\"\n      \t\t\ttest_name=\"${test_name##*/}\"\n      \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n    --\t\t\tgroup \"Failed test: $test_name\" cat \"t/test-results/$test_name.out\"\n    +-\t\t\tcat \"t/test-results/$test_name.out\"\n     +\t\t\tcat \"t/test-results/$test_name.markup\"\n      \n      \t\t\ttrash_dir=\"t/trash directory.$test_name\"\n      \t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n    -@@ ci/lib.sh: then\n    - \tcache_dir=\"$HOME/none\"\n    - \n    - \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n    --\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n    -+\texport GIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    - \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n    - \ttest windows != \"$CI_OS_NAME\" ||\n    - \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n 9:  be2a83f5da3 !  6:  1d2b94436fc ci: call `finalize_test_case_output` a little later\n    @@ Commit message\n         test case.\n     \n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## t/test-lib.sh ##\n     @@ t/test-lib.sh: trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452350","messageId":"RFC-patch-v3-3.6-fc96e5b7296-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 3/6] test(junit): avoid line feeds in XML attributes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:12Z","receivedAt":"2022-03-25T19:33:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn the test case's output, we do want newline characters, but in the XML\nattributes we do not want them.\n\nHowever, the `xml_attr_encode` function always adds a Line Feed at the\nend (which are then encoded as `&#x0a;`, even for XML attributes.\n\nThis seems not to faze Azure Pipelines' XML parser, but it still is\nincorrect, so let's fix it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nindex 9d55d74d764..c959183c7e2 100644\n--- a/t/test-lib-junit.sh\n+++ b/t/test-lib-junit.sh\n@@ -50,7 +50,7 @@ finalize_test_case_output () {\n \t\t;;\n \tfailure)\n \t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode --no-lf \"$1\")\\\">\"\n \t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n \t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n \t\t\t   then\n@@ -74,12 +74,12 @@ finalize_test_case_output () {\n \t\tset \"$* (known breakage)\"\n \t\t;;\n \tskip)\n-\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tmessage=\"$(xml_attr_encode --no-lf \"$skipped_reason\")\"\n \t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n \t\t;;\n \tesac\n \n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode --no-lf \"$this_test.$test_count $1\")\\\"\"\n \tshift\n \tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n \tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n@@ -122,5 +122,11 @@ write_junit_xml () {\n }\n \n xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tif test \"x$1\" = \"x--no-lf\"\n+\tthen\n+\t\tshift\n+\t\tprintf '%s' \"$*\" | test-tool xml-encode\n+\telse\n+\t\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tfi\n }\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452351","messageId":"RFC-patch-v3-5.6-72058db67b0-20220325T183946Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v3 5/6] ci: use `--github-workflow-markup` in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T19:24:14Z","receivedAt":"2022-03-25T19:33:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n[Ævar: due to re-structuring on top of my series the {begin,end}_group\nin CI isn't needed at all to get \"group\" output for the test\nsuite. This commit includes the now-squashed \"ci/run-build-and-tests:\nadd some structure to the GitHub workflow output\":]\n\nThe current output of Git's GitHub workflow can be quite confusing,\nespecially for contributors new to the project.\n\nTo make it more helpful, let's introduce some collapsible grouping.\nInitially, readers will see the high-level view of what actually\nhappened (did the build fail, or the test suite?). To drill down, the\nrespective group can be expanded.\n\nNote: sadly, workflow output currently cannot contain any nested groups\n(see https://github.com/actions/runner/issues/802 for details),\ntherefore we take pains to ensure to end any previous group before\nstarting a new one.\n\n[Ævar: The above comment isn't true anymore, as that limitation has\nbeen removed by basing this on my patches to run \"make\" and \"make\ntest\" directly from the top-level of main.yml.\n\nThose are now effectively their own \"group\", effectively giving this\nstage another group \"level\" to use. This means that the equivalent of\n\"make test\" won't be on the same level as an individual test failure.\n\nWe no longer take any pains to ensure balanced group output as a\nresult (which was a caveat the previous ci/lib.sh implementation had\nto deal with., We just need to \"cat\" the generated *.markup]\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                        | 2 +-\n ci/print-test-failures-github.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 304380958bd..f84bac0fd36 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -74,7 +74,7 @@ MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n case \"$CI_TYPE\" in\n github-actions)\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\ndiff --git a/ci/print-test-failures-github.sh b/ci/print-test-failures-github.sh\nindex 218aaf19763..e432a601621 100755\n--- a/ci/print-test-failures-github.sh\n+++ b/ci/print-test-failures-github.sh\n@@ -17,7 +17,7 @@ github-actions)\n \t\t\ttest_name=\"${test_exit%.exit}\"\n \t\t\ttest_name=\"${test_name##*/}\"\n \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n-\t\t\tcat \"t/test-results/$test_name.out\"\n+\t\t\tcat \"t/test-results/$test_name.markup\"\n \n \t\t\ttrash_dir=\"t/trash directory.$test_name\"\n \t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452353","messageId":"patch-v2-11.25-e9c7ba492e8-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 11/25] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:02Z","receivedAt":"2022-03-25T19:34:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore this parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 39 ++++++++++++++++++++++++++++-----------\n ci/run-build-and-tests.sh | 34 +++++++++++++++++-----------------\n 2 files changed, 45 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 31fe3a476a9..1a1fa0e4bb2 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,23 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\tvarmode=\n+\tcase \"$1\" in\n+\t--*)\n+\t\tvarmode=$1\n+\t\tshift\n+\t\t;;\n+\tesac\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +41,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n@@ -34,23 +51,23 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -66,7 +83,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -89,9 +106,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452354","messageId":"patch-v2-14.25-b1b5b083389-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 14/25] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:05Z","receivedAt":"2022-03-25T19:35:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 05c5771e7f6..2c23a19eac2 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452356","messageId":"patch-v2-10.25-9dc148341ba-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 10/25] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:01Z","receivedAt":"2022-03-25T19:36:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 6b37b10d750..31fe3a476a9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -27,7 +27,7 @@ check_unignored_build_artifacts ()\n export TERM=${TERM:-dumb}\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+MAKEFLAGS=\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -35,10 +35,12 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -92,4 +94,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452358","messageId":"patch-v2-09.25-3be91c26d44-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 09/25] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:00Z","receivedAt":"2022-03-25T19:38:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex e7ea8799411..34b4400f38b 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ad1aa59a384..6b37b10d750 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -65,18 +65,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452360","messageId":"patch-v2-21.25-44e3ace5fbe-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 21/25] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:12Z","receivedAt":"2022-03-25T19:39:00Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 20 +++++++++++---------\n ci/lib.sh                  | 17 +++++++++++++++++\n 2 files changed, 28 insertions(+), 9 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 1e13718b989..0787cadc76b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +333,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +354,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +366,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5eadc96de29..367d1ee05d5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -5,6 +5,13 @@ set -ex\n . ${0%/*}/lib-ci-type.sh\n \n # Starting assertions\n+mode=$1\n+if test -z \"$mode\"\n+then\n+\techo \"need a $0 mode, e.g. --build or --test\"\n+\texit 1\n+fi\n+\n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname\" >&2\n@@ -13,9 +20,14 @@ fi\n \n # Helper functions\n setenv () {\n+\tskip=\n \tvarmode=\n \tcase \"$1\" in\n \t--*)\n+\t\tif test \"$1\" != \"$mode\" && test \"$1\" != \"--all\"\n+\t\tthen\n+\t\t\tskip=t\n+\t\tfi\n \t\tvarmode=$1\n \t\tshift\n \t\t;;\n@@ -25,6 +37,11 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452362","messageId":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com","subject":"[PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:51Z","receivedAt":"2022-03-25T19:39:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"A re-roll of my improvements my series to simplify the CI setup a lot\n(see diffstat), much of it was dealing with constraints that went away\nwith Travis et al. CI for this series (OSX runners failing for\nunrelated reasons):\n\n    https://github.com/avar/git/actions/runs/2040223909\n\nFor a much more detailed summary of how the output looks before/after\nsee v1[].\n\nThis series heavily conflicts with Johannes's\njs/ci-github-workflow-markup in \"seen\", but in the v1 I suggested\nbasing that series on top of this one, because it can benefit a lot\nfrom these simplifications.\n\nI'll reply to this series with a proposed rebasing of that series on\ntop of this one, which allows for removing almost all of its changes\nto \"ci/\" with no harm to its end-goals, i.e. the splitting up of\n\"make\" and \"make test\" output is something it'll get for free from\nthis series.\n\nJunio: Since that series has been stalled on still-outstanding\nperformance issues for a couple of months I was hoping we could queue\nthis instead, and perhaps in addition if Johannes approves of the\nproposed re-roll on top of his.\n\nThere's some forward progress on the performance issues (this[2] reply\nof Victoria Dye's from yesterday), but fully resolving those will\nprobably take a bit...\n\nWhereas even though this one is relatively large I don't think there's\nanything controversial here. The one concern that's been raised has\nbeen Johannes's objection to removing some of the dead Azure code\n(which was needed to move forward here). I asked how he'd prefer to\nmove forward with that in [3], but there hasn't been a reply to that\nin >1 month.\n\nI think just removing it is OK, we can always bring it back if needed,\nand doing so is actually going to be simpler on top of this since the\nCI is now less special, and leans more heavily on the logic of our\nnormal build process.\n\n1. https://lore.kernel.org/git/cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com\n2. https://lore.kernel.org/git/6b83bb83-32b9-20c9-fa02-c1c3170351c3@github.com/\n3. https://lore.kernel.org/git/220222.86y2236ndp.gmgdl@evledraar.gmail.com/\n\nÆvar Arnfjörð Bjarmason (25):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: make \"$jobname\" explicit, remove fallback\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: remove unused Azure ci/* code\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n  CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n  CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n  CI: invoke \"make artifacts-tar\" directly in windows-build\n  CI: split up and reduce \"ci/test-documentation.sh\"\n  CI: combine ci/install{,-docker}-dependencies.sh\n  CI: move \"env\" definitions into ci/lib.sh\n  ci/run-test-slice.sh: replace shelling out with \"echo\"\n  CI: pre-select test slice in Windows & VS tests\n  CI: only invoke ci/lib.sh as \"steps\" in main.yml\n  CI: narrow down variable definitions in --build and --test\n  CI: add more variables to MAKEFLAGS, except under vs-build\n  CI: set CC in MAKEFLAGS directly, don't add it to the environment\n  CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n  CI: don't use \"set -x\" in \"ci/lib.sh\" output\n\n .github/workflows/main.yml            | 100 +++++---\n Makefile                              |  31 ++-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  53 ++++-\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |  10 +\n ci/lib-tput.sh                        |   2 +\n ci/lib.sh                             | 316 +++++++++++++-------------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  16 +-\n ci/run-build-and-tests.sh             |  54 -----\n ci/run-docker-build.sh                |  66 ------\n ci/run-docker.sh                      |  47 ----\n ci/run-static-analysis.sh             |  32 ---\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  10 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ----\n shared.mak                            |   1 +\n 21 files changed, 346 insertions(+), 577 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff against v1:\n 1:  970849a227f =  1:  4addbd70213 CI: run \"set -ex\" early in ci/lib.sh\n 2:  eda7fb18064 =  2:  b23aa99fd37 CI: make \"$jobname\" explicit, remove fallback\n 3:  3ee32815cf3 =  3:  eec15a95879 CI: remove more dead Travis CI support\n 4:  c81c1b3f504 =  4:  73c894f1665 CI: remove dead \"tree skipping\" code\n 5:  4738a22a36d =  5:  b5e6d538554 CI: remove unused Azure ci/* code\n 6:  59e4f41e86c =  6:  a4b9febbdca CI: don't have \"git grep\" invoke a pager in tree content check\n 7:  836ef20fdcc !  7:  5d46d5b34c9 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n    @@ .github/workflows/main.yml: jobs:\n          if: needs.ci-config.outputs.enabled == 'yes'\n     \n      ## Makefile ##\n    -@@ Makefile: ifndef V\n    - \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n    - \tQUIET_RC       = @echo '   ' RC $@;\n    - \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n    -+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n    - \tQUIET_SUBDIR0  = +@subdir=\n    - \tQUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \\\n    - \t\t\t $(MAKE) $(PRINT_DIR) -C $$subdir\n     @@ Makefile: coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n      # See contrib/coccinelle/README\n      coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n    @@ ci/run-static-analysis.sh (deleted)\n     -\n     -make hdr-check ||\n     -exit 1\n    +\n    + ## shared.mak ##\n    +@@ shared.mak: ifndef V\n    + \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n    + \tQUIET_RC       = @echo '   ' RC $@;\n    + \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n    ++\tQUIET_CHECK    = @echo '   ' CHECK $@;\n    + \n    + ## Used in \"Documentation/Makefile\"\n    + \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n 8:  95cd496868e =  8:  81e06f13d84 CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n 9:  a1d0796259e =  9:  3be91c26d44 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n10:  b6a61a786c5 = 10:  9dc148341ba CI: consistently use \"export\" in ci/lib.sh\n11:  f2fcee5d6e4 = 11:  e9c7ba492e8 CI: export variables via a wrapper\n12:  dfd823f2e7d = 12:  86d5a48d59a CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n13:  46459fff296 = 13:  649ad1ae249 CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n14:  aecd3ebaafe = 14:  b1b5b083389 CI: invoke \"make artifacts-tar\" directly in windows-build\n15:  4f1564af70f = 15:  dfa91ac8938 CI: split up and reduce \"ci/test-documentation.sh\"\n16:  868613a5b06 = 16:  ba4ed216769 CI: combine ci/install{,-docker}-dependencies.sh\n17:  5d854e8ff36 = 17:  b5e89a33340 CI: move \"env\" definitions into ci/lib.sh\n18:  a6106525b7f = 18:  571f4d0f441 ci/run-test-slice.sh: replace shelling out with \"echo\"\n19:  e9c6c4dd293 = 19:  2edea06ee4d CI: pre-select test slice in Windows & VS tests\n20:  40d86e8c1dc = 20:  ef9daa6882f CI: only invoke ci/lib.sh as \"steps\" in main.yml\n21:  abf9c504740 = 21:  44e3ace5fbe CI: narrow down variable definitions in --build and --test\n22:  9f4c2798a82 = 22:  5f56b922e08 CI: add more variables to MAKEFLAGS, except under vs-build\n23:  8a8b7ecf16b ! 23:  b45b7cec94e CI: stop over-setting the $CC variable\n    @@ Metadata\n     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## Commit message ##\n    -    CI: stop over-setting the $CC variable\n    +    CI: set CC in MAKEFLAGS directly, don't add it to the environment\n     \n    -    As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n    -    2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\n    -    to setting it in the environment was due to Travis CI clobbering $CC\n    -    in the environment.\n    +    Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\n    +    picked up in ci/lib.sh let's instead have ci/lib.sh itself add it\n    +    directly to MAKEFLAGS.\n     \n    -    We don't need to set it unconditionally to accomplish that, but rather\n    -    just have it set for those jobs that need them. E.g. the \"win+VS\n    -    build\" job confusingly has CC=gcc set, even though it builds with\n    -    MSVC.\n    +    Setting CC=gcc by default made for confusing trace output, and since a\n    +    preceding change to carry it and others over across \"steps\" in the\n    +    GitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\n    +    confusingly has CC=gcc set, even though it builds with MSVC.\n    +\n    +    Let's instead reply on the Makefile default of CC=cc, and only\n    +    override it for those jobs where it's needed. This does mean that\n    +    we'll need to set it for the \"pedantic\" job, which previously relied\n    +    on the default CC=gcc in case \"clang\" become the default on that\n    +    platform.\n     \n         This partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n         \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n    @@ ci/lib.sh: linux-TEST-vars)\n      \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n      \t;;\n      pedantic)\n    ++\tCC=gcc\n    + \t# Don't run the tests; we only care about whether Git can be\n    + \t# built.\n    + \tsetenv --build DEVOPTS pedantic\n     @@ ci/lib.sh: linux-musl)\n      \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n      \t;;\n24:  d7b472b4a52 = 24:  06bf8d9f61b CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n25:  08a9776c259 = 25:  6dc96ba8b82 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452363","messageId":"patch-v2-23.25-b45b7cec94e-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 23/25] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:14Z","receivedAt":"2022-03-25T19:39:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\npicked up in ci/lib.sh let's instead have ci/lib.sh itself add it\ndirectly to MAKEFLAGS.\n\nSetting CC=gcc by default made for confusing trace output, and since a\npreceding change to carry it and others over across \"steps\" in the\nGitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\nconfusingly has CC=gcc set, even though it builds with MSVC.\n\nLet's instead reply on the Makefile default of CC=cc, and only\noverride it for those jobs where it's needed. This does mean that\nwe'll need to set it for the \"pedantic\" job, which previously relied\non the default CC=gcc in case \"clang\" become the default on that\nplatform.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/lib.sh                  | 27 +++++++++++++++++++++++----\n 2 files changed, 23 insertions(+), 17 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 0787cadc76b..6d25ec4ae3b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 475e9f63a74..57c9117a35a 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -52,7 +52,9 @@ setenv () {\n \tfi\n }\n \n-# Clear MAKEFLAGS that may come from the outside world.\n+# Clear variables that may come from the outside world.\n+CC=\n+CC_PACKAGE=\n MAKEFLAGS=\n \n # Common make and cmake build options\n@@ -64,8 +66,6 @@ MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC:-gcc}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -135,9 +135,16 @@ vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n \t;;\n linux-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -152,13 +159,23 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-9\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n+\tCC=gcc\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n \tsetenv --build DEVOPTS pedantic\n@@ -173,9 +190,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452367","messageId":"patch-v2-22.25-5f56b922e08-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 22/25] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:13Z","receivedAt":"2022-03-25T19:39:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 367d1ee05d5..475e9f63a74 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -55,6 +55,13 @@ setenv () {\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n \n+# Common make and cmake build options\n+DEVELOPER=1\n+SKIP_DASHED_BUILT_INS=YesPlease\n+\n+# Use common options for \"make\" (cmake in \"vs-build\" below)\n+MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC:-gcc}\"\n@@ -73,10 +80,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -110,6 +115,9 @@ windows-build)\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452369","messageId":"patch-v2-20.25-ef9daa6882f-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 20/25] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:11Z","receivedAt":"2022-03-25T19:39:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  8 ++++++++\n ci/lib-tput.sh                        |  2 ++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 29 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 9388289d0ed..ee9af62fc92 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..bd6e093c8f4\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,8 @@\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\tenv >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..baed1892f69\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,2 @@\n+# GitHub Action doesn't set TERM, which is required by tput\n+export TERM=${TERM:-dumb}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex b882849ed5d..5eadc96de29 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -39,15 +35,11 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC:-gcc}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n@@ -57,11 +49,12 @@ then\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 0c63b6f7962..452aff35d74 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex ec602f8a053..a0332095bb3 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452373","messageId":"patch-v2-04.25-73c894f1665-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 04/25] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:55Z","receivedAt":"2022-03-25T19:39:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c3c06d66862..5a8938d4b3c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452376","messageId":"patch-v2-03.25-eec15a95879-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 03/25] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:54Z","receivedAt":"2022-03-25T19:39:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the -\"-state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     |  3 --\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 184 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d2a7c33f536..c3c06d66862 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..00fcf27b1b2 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -77,9 +77,6 @@ do\n \t\t\tfi\n \t\t\tcombined_trash_size=$new_combined_trash_size\n \n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n \t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n \t\t\tcat \"$trash_tgz_b64\"\n \t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452378","messageId":"patch-v2-18.25-571f4d0f441-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 18/25] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:38:09Z","receivedAt":"2022-03-25T19:42:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452380","messageId":"patch-v2-06.25-a4b9febbdca-20220325T182534Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v2 06/25] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-25T18:37:57Z","receivedAt":"2022-03-25T19:42:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.35.1.1517.g20a06c426a7\n\n"},{"id":"452389","messageId":"320b3dde-a84e-0074-bed8-57061293b2b0@github.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2022-03-25T20:43:54Z","receivedAt":"2022-03-25T20:44:01Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> A re-roll of my improvements my series to simplify the CI setup a lot\n> (see diffstat), much of it was dealing with constraints that went away\n> with Travis et al. CI for this series (OSX runners failing for\n> unrelated reasons):\n> \n>     https://github.com/avar/git/actions/runs/2040223909\n> \n> For a much more detailed summary of how the output looks before/after\n> see v1[].\n> \n> This series heavily conflicts with Johannes's\n> js/ci-github-workflow-markup in \"seen\", but in the v1 I suggested\n> basing that series on top of this one, because it can benefit a lot\n> from these simplifications.\n> \n> I'll reply to this series with a proposed rebasing of that series on\n> top of this one, which allows for removing almost all of its changes\n> to \"ci/\" with no harm to its end-goals, i.e. the splitting up of\n> \"make\" and \"make test\" output is something it'll get for free from\n> this series.\n> \n> Junio: Since that series has been stalled on still-outstanding\n> performance issues for a couple of months I was hoping we could queue\n> this instead, and perhaps in addition if Johannes approves of the\n> proposed re-roll on top of his.\n> \n> There's some forward progress on the performance issues (this[2] reply\n> of Victoria Dye's from yesterday), but fully resolving those will\n> probably take a bit...\n> \n> Whereas even though this one is relatively large I don't think there's\n> anything controversial here. The one concern that's been raised has\n> been Johannes's objection to removing some of the dead Azure code\n> (which was needed to move forward here). I asked how he'd prefer to\n> move forward with that in [3], but there hasn't been a reply to that\n> in >1 month.\n> \n\nWhile the largeness of a series shouldn't necessarily block it, the lack of\noverarching structure or purpose in this one makes it really difficult for\nme to review with much confidence (I can't speak for everyone, but it may be\none of the reasons for the general lack of feedback). If you believe all of\nthese patches as thematically-related enough to warrant being in a single\nseries, then it would help a lot if you could:\n\n1. Clearly describe the purpose of the series (yes they're all CI\n   improvements, but *why* these particular improvements, and why do they\n   all need to go together?) \n2. Outline the \"path\" these commits take to accomplishing that purpose (\"The\n   first 3 commits do X because Y. Then, the next 4 commits do A because B.\"\n   etc. or whatever format fits your writing style, as long as the\n   information is there).\n3. Reorganize commits as necessary to keep the above outline from jumping\n   back and forth between topics. \n\nPersonally, I think this could (should?) be split into at least two series:\none that breaks up 'run-build-and-tests.sh' (and is more directly relevant\nto dscho's series), and one that does the cleanup/flag change/other work.\nThe two appear to be independent, and the resulting two series would be a\nmuch more manageable 10-15 commits each. \n\n> I think just removing it is OK, we can always bring it back if needed,\n> and doing so is actually going to be simpler on top of this since the\n> CI is now less special, and leans more heavily on the logic of our\n> normal build process.\n> \n> 1. https://lore.kernel.org/git/cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com\n> 2. https://lore.kernel.org/git/6b83bb83-32b9-20c9-fa02-c1c3170351c3@github.com/\n> 3. https://lore.kernel.org/git/220222.86y2236ndp.gmgdl@evledraar.gmail.com/\n> \n> Ævar Arnfjörð Bjarmason (25):\n>   CI: run \"set -ex\" early in ci/lib.sh\n>   CI: make \"$jobname\" explicit, remove fallback\n>   CI: remove more dead Travis CI support\n>   CI: remove dead \"tree skipping\" code\n>   CI: remove unused Azure ci/* code\n>   CI: don't have \"git grep\" invoke a pager in tree content check\n>   CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>   CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>   CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n>   CI: consistently use \"export\" in ci/lib.sh\n>   CI: export variables via a wrapper\n>   CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n>   CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n>   CI: invoke \"make artifacts-tar\" directly in windows-build\n>   CI: split up and reduce \"ci/test-documentation.sh\"\n>   CI: combine ci/install{,-docker}-dependencies.sh\n>   CI: move \"env\" definitions into ci/lib.sh\n>   ci/run-test-slice.sh: replace shelling out with \"echo\"\n>   CI: pre-select test slice in Windows & VS tests\n>   CI: only invoke ci/lib.sh as \"steps\" in main.yml\n>   CI: narrow down variable definitions in --build and --test\n>   CI: add more variables to MAKEFLAGS, except under vs-build\n>   CI: set CC in MAKEFLAGS directly, don't add it to the environment\n>   CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n>   CI: don't use \"set -x\" in \"ci/lib.sh\" output\n> \n>  .github/workflows/main.yml            | 100 +++++---\n>  Makefile                              |  31 ++-\n>  ci/check-directional-formatting.bash  |   2 +-\n>  ci/check-unignored-build-artifacts.sh |  20 ++\n>  ci/install-dependencies.sh            |  53 ++++-\n>  ci/install-docker-dependencies.sh     |  22 --\n>  ci/lib-ci-type.sh                     |  10 +\n>  ci/lib-tput.sh                        |   2 +\n>  ci/lib.sh                             | 316 +++++++++++++-------------\n>  ci/make-test-artifacts.sh             |  12 -\n>  ci/mount-fileshare.sh                 |  25 --\n>  ci/print-test-failures.sh             |  16 +-\n>  ci/run-build-and-tests.sh             |  54 -----\n>  ci/run-docker-build.sh                |  66 ------\n>  ci/run-docker.sh                      |  47 ----\n>  ci/run-static-analysis.sh             |  32 ---\n>  ci/run-test-slice.sh                  |  17 --\n>  ci/select-test-slice.sh               |  10 +\n>  ci/test-documentation.sh              |  37 +--\n>  ci/util/extract-trash-dirs.sh         |  50 ----\n>  shared.mak                            |   1 +\n>  21 files changed, 346 insertions(+), 577 deletions(-)\n>  create mode 100755 ci/check-unignored-build-artifacts.sh\n>  delete mode 100755 ci/install-docker-dependencies.sh\n>  create mode 100644 ci/lib-ci-type.sh\n>  create mode 100644 ci/lib-tput.sh\n>  delete mode 100755 ci/make-test-artifacts.sh\n>  delete mode 100755 ci/mount-fileshare.sh\n>  delete mode 100755 ci/run-build-and-tests.sh\n>  delete mode 100755 ci/run-docker-build.sh\n>  delete mode 100755 ci/run-docker.sh\n>  delete mode 100755 ci/run-static-analysis.sh\n>  delete mode 100755 ci/run-test-slice.sh\n>  create mode 100755 ci/select-test-slice.sh\n>  delete mode 100755 ci/util/extract-trash-dirs.sh\n> \n> Range-diff against v1:\n>  1:  970849a227f =  1:  4addbd70213 CI: run \"set -ex\" early in ci/lib.sh\n>  2:  eda7fb18064 =  2:  b23aa99fd37 CI: make \"$jobname\" explicit, remove fallback\n>  3:  3ee32815cf3 =  3:  eec15a95879 CI: remove more dead Travis CI support\n>  4:  c81c1b3f504 =  4:  73c894f1665 CI: remove dead \"tree skipping\" code\n>  5:  4738a22a36d =  5:  b5e6d538554 CI: remove unused Azure ci/* code\n>  6:  59e4f41e86c =  6:  a4b9febbdca CI: don't have \"git grep\" invoke a pager in tree content check\n>  7:  836ef20fdcc !  7:  5d46d5b34c9 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>     @@ .github/workflows/main.yml: jobs:\n>           if: needs.ci-config.outputs.enabled == 'yes'\n>      \n>       ## Makefile ##\n>     -@@ Makefile: ifndef V\n>     - \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n>     - \tQUIET_RC       = @echo '   ' RC $@;\n>     - \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n>     -+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n>     - \tQUIET_SUBDIR0  = +@subdir=\n>     - \tQUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \\\n>     - \t\t\t $(MAKE) $(PRINT_DIR) -C $$subdir\n>      @@ Makefile: coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n>       # See contrib/coccinelle/README\n>       coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n>     @@ ci/run-static-analysis.sh (deleted)\n>      -\n>      -make hdr-check ||\n>      -exit 1\n>     +\n>     + ## shared.mak ##\n>     +@@ shared.mak: ifndef V\n>     + \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n>     + \tQUIET_RC       = @echo '   ' RC $@;\n>     + \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n>     ++\tQUIET_CHECK    = @echo '   ' CHECK $@;\n>     + \n>     + ## Used in \"Documentation/Makefile\"\n>     + \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n>  8:  95cd496868e =  8:  81e06f13d84 CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>  9:  a1d0796259e =  9:  3be91c26d44 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n> 10:  b6a61a786c5 = 10:  9dc148341ba CI: consistently use \"export\" in ci/lib.sh\n> 11:  f2fcee5d6e4 = 11:  e9c7ba492e8 CI: export variables via a wrapper\n> 12:  dfd823f2e7d = 12:  86d5a48d59a CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n> 13:  46459fff296 = 13:  649ad1ae249 CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n> 14:  aecd3ebaafe = 14:  b1b5b083389 CI: invoke \"make artifacts-tar\" directly in windows-build\n> 15:  4f1564af70f = 15:  dfa91ac8938 CI: split up and reduce \"ci/test-documentation.sh\"\n> 16:  868613a5b06 = 16:  ba4ed216769 CI: combine ci/install{,-docker}-dependencies.sh\n> 17:  5d854e8ff36 = 17:  b5e89a33340 CI: move \"env\" definitions into ci/lib.sh\n> 18:  a6106525b7f = 18:  571f4d0f441 ci/run-test-slice.sh: replace shelling out with \"echo\"\n> 19:  e9c6c4dd293 = 19:  2edea06ee4d CI: pre-select test slice in Windows & VS tests\n> 20:  40d86e8c1dc = 20:  ef9daa6882f CI: only invoke ci/lib.sh as \"steps\" in main.yml\n> 21:  abf9c504740 = 21:  44e3ace5fbe CI: narrow down variable definitions in --build and --test\n> 22:  9f4c2798a82 = 22:  5f56b922e08 CI: add more variables to MAKEFLAGS, except under vs-build\n> 23:  8a8b7ecf16b ! 23:  b45b7cec94e CI: stop over-setting the $CC variable\n>     @@ Metadata\n>      Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>      \n>       ## Commit message ##\n>     -    CI: stop over-setting the $CC variable\n>     +    CI: set CC in MAKEFLAGS directly, don't add it to the environment\n>      \n>     -    As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n>     -    2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\n>     -    to setting it in the environment was due to Travis CI clobbering $CC\n>     -    in the environment.\n>     +    Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\n>     +    picked up in ci/lib.sh let's instead have ci/lib.sh itself add it\n>     +    directly to MAKEFLAGS.\n>      \n>     -    We don't need to set it unconditionally to accomplish that, but rather\n>     -    just have it set for those jobs that need them. E.g. the \"win+VS\n>     -    build\" job confusingly has CC=gcc set, even though it builds with\n>     -    MSVC.\n>     +    Setting CC=gcc by default made for confusing trace output, and since a\n>     +    preceding change to carry it and others over across \"steps\" in the\n>     +    GitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\n>     +    confusingly has CC=gcc set, even though it builds with MSVC.\n>     +\n>     +    Let's instead reply on the Makefile default of CC=cc, and only\n>     +    override it for those jobs where it's needed. This does mean that\n>     +    we'll need to set it for the \"pedantic\" job, which previously relied\n>     +    on the default CC=gcc in case \"clang\" become the default on that\n>     +    platform.\n>      \n>          This partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n>          \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n>     @@ ci/lib.sh: linux-TEST-vars)\n>       \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n>       \t;;\n>       pedantic)\n>     ++\tCC=gcc\n>     + \t# Don't run the tests; we only care about whether Git can be\n>     + \t# built.\n>     + \tsetenv --build DEVOPTS pedantic\n>      @@ ci/lib.sh: linux-musl)\n>       \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n>       \t;;\n> 24:  d7b472b4a52 = 24:  06bf8d9f61b CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n> 25:  08a9776c259 = 25:  6dc96ba8b82 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n\n"},{"id":"452400","messageId":"220326.861qypldwn.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"320b3dde-a84e-0074-bed8-57061293b2b0@github.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-03-26T00:59:49Z","receivedAt":"2022-03-26T01:07:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Mar 25 2022, Victoria Dye wrote:\n\n> Ævar Arnfjörð Bjarmason wrote:\n>> A re-roll of my improvements my series to simplify the CI setup a lot\n>> (see diffstat), much of it was dealing with constraints that went away\n>> with Travis et al. CI for this series (OSX runners failing for\n>> unrelated reasons):\n>> \n>>     https://github.com/avar/git/actions/runs/2040223909\n>> \n>> For a much more detailed summary of how the output looks before/after\n>> see v1[].\n>> \n>> This series heavily conflicts with Johannes's\n>> js/ci-github-workflow-markup in \"seen\", but in the v1 I suggested\n>> basing that series on top of this one, because it can benefit a lot\n>> from these simplifications.\n>> \n>> I'll reply to this series with a proposed rebasing of that series on\n>> top of this one, which allows for removing almost all of its changes\n>> to \"ci/\" with no harm to its end-goals, i.e. the splitting up of\n>> \"make\" and \"make test\" output is something it'll get for free from\n>> this series.\n>> \n>> Junio: Since that series has been stalled on still-outstanding\n>> performance issues for a couple of months I was hoping we could queue\n>> this instead, and perhaps in addition if Johannes approves of the\n>> proposed re-roll on top of his.\n>> \n>> There's some forward progress on the performance issues (this[2] reply\n>> of Victoria Dye's from yesterday), but fully resolving those will\n>> probably take a bit...\n>> \n>> Whereas even though this one is relatively large I don't think there's\n>> anything controversial here. The one concern that's been raised has\n>> been Johannes's objection to removing some of the dead Azure code\n>> (which was needed to move forward here). I asked how he'd prefer to\n>> move forward with that in [3], but there hasn't been a reply to that\n>> in >1 month.\n>> \n>\n> While the largeness of a series shouldn't necessarily block it, the lack of\n> overarching structure or purpose in this one makes it really difficult for\n> me to review with much confidence (I can't speak for everyone, but it may be\n> one of the reasons for the general lack of feedback). If you believe all of\n> these patches as thematically-related enough to warrant being in a single\n> series, then it would help a lot if you could:\n>\n> 1. Clearly describe the purpose of the series (yes they're all CI\n>    improvements, but *why* these particular improvements, and why do they\n>    all need to go together?) \n> 2. Outline the \"path\" these commits take to accomplishing that purpose (\"The\n>    first 3 commits do X because Y. Then, the next 4 commits do A because B.\"\n>    etc. or whatever format fits your writing style, as long as the\n>    information is there).\n> 3. Reorganize commits as necessary to keep the above outline from jumping\n>    back and forth between topics. \n\nThe v1 summary described it about as clearly as I was able to:\nhttps://lore.kernel.org/git/cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com/\n\n> Personally, I think this could (should?) be split into at least two series:\n> one that breaks up 'run-build-and-tests.sh' (and is more directly relevant\n> to dscho's series), and one that does the cleanup/flag change/other work.\n> The two appear to be independent, and the resulting two series would be a\n> much more manageable 10-15 commits each. \n\nTo rephrase that a bit, every commit here passes CI and is atomic, so it\ncould be split up into 25 parts (at least).\n\nBut it's really not doing different things, it's a single-topic series:\nIt's changing CI \"step\" targets that are shellscripts that do N things\nto instead be single command invocations at the \"step\" level, driven by\nthe CI recipe itself.\n\nTo do that we need to pass state that we previously re-setup for every\n\"step\" via $GITHUB_ENV, whose state we then helpfully show (this is just\na standard GitHub CI feature) in a drop-down at the start of every\n\"step\".\n\nSo yes, it could be split up in the sense that we could get partway\nthere and continue with the rest some other time, but I really think the\nUX experience is *much better* if it's not a partial conversion.\n\nI.e. at the tip of this series you can reliably look at that $GITHUB_ENV\nview to see what the full and relevant environment was for that \"make\",\n\"make test\" or whatever.\n\nIf we just do that partially you might get that for \"make\" if it failed,\nbut if your tests failed we'd have a failure in the proverbial\nci/load-lib.sh-do-setup-stuff-and-run-make-test-at-some-point.sh.\n\nWhich I think makes the UX much less useful, i.e. you really want to\n*always* find this information in the same place.\n"},{"id":"452484","messageId":"xmqqsfr22fz4.fsf@gitster.g","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-03-28T16:34:39Z","receivedAt":"2022-03-28T16:34:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> A re-roll of my improvements my series to simplify the CI setup a lot\n> (see diffstat), much of it was dealing with constraints that went away\n> with Travis et al. CI for this series (OSX runners failing for\n> unrelated reasons):\n>\n>     https://github.com/avar/git/actions/runs/2040223909\n>\n> For a much more detailed summary of how the output looks before/after\n> see v1[].\n>\n> This series heavily conflicts with Johannes's\n> js/ci-github-workflow-markup in \"seen\", but in the v1 I suggested\n> basing that series on top of this one, because it can benefit a lot\n> from these simplifications.\n>\n> I'll reply to this series with a proposed rebasing of that series on\n> top of this one, which allows for removing almost all of its changes\n> to \"ci/\" with no harm to its end-goals, i.e. the splitting up of\n> \"make\" and \"make test\" output is something it'll get for free from\n> this series.\n\nA sample run for this can be seen at\n\n  https://github.com/git/git/runs/5715128999?check_suite_focus=true\n\nWith the output, I can point at a specific line, e.g.\n\n  https://github.com/git/git/runs/5715128999?check_suite_focus=true#step:7:1150\n\nThe URLs with Dscho's one that correspond to the above two are\n\n  https://github.com/git/git/runs/5699946885?check_suite_focus=true\n  https://github.com/git/git/runs/5699946885?check_suite_focus=true#step:4:1826\n\nThe specific breakage (which has little to do with the comparison\nbetween CI error pages) is that diff_setup() is called and populate\ndiff_options.parseopts member but diff_setup_done() does not seem to\nbe called and ends up leaking it.\n\nI wonder why options->parseopts is not freed immediately after\ndiff_opt_parse() calls parse_options(), but need to be kept until\ndiff_setup_done().\n"},{"id":"453131","messageId":"nycvar.QRO.7.76.6.2203301430540.379@tvgsbejvaqbjf.bet","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-04-05T14:36:11Z","receivedAt":"2022-04-05T21:50:08Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Ævar,\n\nOn Fri, 25 Mar 2022, Ævar Arnfjörð Bjarmason wrote:\n\n> A re-roll of my improvements my series to simplify the CI setup a lot\n> (see diffstat), much of it was dealing with constraints that went away\n> with Travis et al.\n\nThis type of work causes me a lot of follow-up work e.g. many merge\nconflicts in the latest Git for Windows rebases.\n\nPerhaps it is worth taking a step back and evaluating the return on this\ninvestment in the CI setup. While this can be characterized as a\nsimplification taking the diffstat as proof, one could challenge that the\ndiffstat does not actually measure whether the code is simple or not, it\njust measures whether there are less lines in the end.\n\nIf the diffstat was a good measure, then the optimum would be one 0-byte\n`.c` file (which some C compilers compile without error). Another obvious\nway to optimize the diffstat would be to remove all code comments. Would I\nsuggest to do either? Of course not.\n\nThe reduction in code size of this patch series also comes at quite a\nsteep cost: After all, the way Lars and Gábor set things up was already\neasy to reuse with Azure Pipeline and GitHub Actions.\n\nRemoving this type of generic, easily-to-adapt code can remove a lot of\nlines at the expense of making the code less generic and harder to adapt,\nand leads us directly to CI lock-in.\n\nA better approach would be to use the already-generic code and adapt it\ne.g. to extend to the CirrusCI definition we have.\n\nEven if you do not care about extending our FreeBSD coverage, I would like\nto ask to slow down on refactoring as it is done in this patch series. As\nindicated in my comment above, these types of refactorings lead to a lot\nof complications in Git for Windows's processes, which are time-consuming\nto resolve. I understand your motivation, but if you wouldn't mind taking\nsome time to weigh the criticality of these changes against the overhead\nincurred for maintainers, it would be appreciated.\n\n> I think just removing it is OK, we can always bring it back if needed,\n> and doing so is actually going to be simpler on top of this since the CI\n> is now less special, and leans more heavily on the logic of our normal\n> build process.\n\nRemoving and re-adding things does take time, though. Again, I think it\nwould be helpful to step back and try to understand the value of this\nremoval versus the projected time it would take (from all involved) to\nre-add.\n\nBesides, given how much is shuffled around in this patch series (e.g. some\nfiles in ci/ are removed altogether and their equivalent code is moved\ninto various other places), doubt must be cast on the idea that it would\nbe simple to bring back anything here.\n\nCiao,\nJohannes\n"},{"id":"453170","messageId":"220406.86bkxeecoi.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"nycvar.QRO.7.76.6.2203301430540.379@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-06T09:29:18Z","receivedAt":"2022-04-06T13:23:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Apr 05 2022, Johannes Schindelin wrote:\n\n> Hi Ævar,\n>\n> On Fri, 25 Mar 2022, Ævar Arnfjörð Bjarmason wrote:\n>\n>> A re-roll of my improvements my series to simplify the CI setup a lot\n>> (see diffstat), much of it was dealing with constraints that went away\n>> with Travis et al.\n>\n> This type of work causes me a lot of follow-up work e.g. many merge\n> conflicts in the latest Git for Windows rebases.\n\nCan you elaborate a bit on why? These patches are currently in \"seen\"\nand not \"next\", and I thought GFW merged git.git's \"master\" for new\nreleases, and e.g. in:\n\n    git diff --stat -p v2.36.0-rc0..v2.36.0-rc0.windows.1 -- ci t\n\nI don't see anything related to those sorts of CI changes.\n\nI.e. I understand that you may have something out-of-git.git that may\nconflict with this, I'm confused about the GFW reference in particular.\n\n> Perhaps it is worth taking a step back and evaluating the return on this\n> investment in the CI setup. While this can be characterized as a\n> simplification taking the diffstat as proof, one could challenge that the\n> diffstat does not actually measure whether the code is simple or not, it\n> just measures whether there are less lines in the end.\n>\n> If the diffstat was a good measure, then the optimum would be one 0-byte\n> `.c` file (which some C compilers compile without error). Another obvious\n> way to optimize the diffstat would be to remove all code comments. Would I\n> suggest to do either? Of course not.\n\nThis is a misunderstanding I really didn't expect, but no. I'm not\nsuggesting that the diffstat being shorter is a value in and of itself.\n\nClearly that's ridiculous, as we could make the code \"better\" by\nremoving subsequent newlines or whatever.\n\nI thought it was clear in context that the v2 CL's reference to this is\na shorthand for us being able to generally \"do more with less\"\nsummarized in the v1:\nhttps://lore.kernel.org/git/cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com\n\n> The reduction in code size of this patch series also comes at quite a\n> steep cost: After all, the way Lars and Gábor set things up was already\n> easy to reuse with Azure Pipeline and GitHub Actions.\n>\n> Removing this type of generic, easily-to-adapt code can remove a lot of\n> lines at the expense of making the code less generic and harder to adapt,\n> and leads us directly to CI lock-in.\n\nIt's really hard to try to come to some sort of landing with changes in\nci/ when it looks as though you haven't read my side of the patches or\nwhy these changes were made.\n\nSo in liue of some long summary of that I'll just say briefly that the\nreason for why I made those changes is covered in detail in commits you\nhaven't replied to, and which argue the opposite of what you do here.\n\nBriefly: The entire reason I changed those bits is exactly to avoid the\nsort of CI lock-in you're talking about, to th point where this series\neffectively adds another CI target: You can run everything it's doing\nwith a normal \"make\" invocation.\n\n> A better approach would be to use the already-generic code and adapt it\n> e.g. to extend to the CirrusCI definition we have.\n\nThis series doesn't change .cirrus.yml or how it functions, but it just\ndoes:\n\n  build_script:\n    - su git -c gmake\n  test_script:\n    - su git -c 'gmake test'\n\nWhich, after this series is exactly what your \"main\" CI does. So we're\nset up to make it easier to unify the two.\n\n> Even if you do not care about extending our FreeBSD coverage,\n\nFWIW I do care, and I've sent in various portability patches for\nFreeBSD, but I haven't used that CI in particular.\n\n> I would like\n> to ask to slow down on refactoring as it is done in this patch series. As\n> indicated in my comment above, these types of refactorings lead to a lot\n> of complications in Git for Windows's processes, which are time-consuming\n> to resolve. I understand your motivation, but if you wouldn't mind taking\n> some time to weigh the criticality of these changes against the overhead\n> incurred for maintainers, it would be appreciated.\n\nSure, I'm happy to accommodate that.\n\nAs this v2 CL notes I'd asked you a month before submitting it in [1]\nwhat I could do to make the parts of it you seemed to find most\nobjectionable easier or different for you.\n\n>> I think just removing it is OK, we can always bring it back if needed,\n>> and doing so is actually going to be simpler on top of this since the CI\n>> is now less special, and leans more heavily on the logic of our normal\n>> build process.\n>\n> Removing and re-adding things does take time, though. Again, I think it\n> would be helpful to step back and try to understand the value of this\n> removal versus the projected time it would take (from all involved) to\n> re-add.\n\nHaving prepped this v2 + the RFC of your (then smaller) patches on top\nI'm pretty sure it would be trivial for either of us compared to\ncontinuing this verbal back & forth.\n\nSo, to that end I re-rolled the two in combination, I think it would be\nmuch more helpful to comment on the substance of the changes here.\n\nE.g. we can now see the sum of my patches and yours in \"seen\", they both\nchange the CI UI in what I think are complimentary ways (issues of\ne.g. added slowness in your patches aside, which has been discussed).\n\nFor easy comparison I prepared this the other day, and committed the\nsame \"make CI fail\" commit on top to all of them:\n\n * Your original patches, just rebased on master:\n   https://github.com/avar/git/tree/avar-pr-1117/dscho/use-grouping-in-ci-v2-FAIL-TEST\n * Just my v2 series here:\n   https://github.com/avar/git/tree/avar/ci-unroll-make-commands-to-ci-recipe-FAIL-TEST\n * The sum of the two, i.e. the v2 + your \"RFC\" (the RFC label being mine) on top:\n   https://github.com/avar/git/tree/avar-dscho/use-grouping-in-ci-v2-FAIL-TEST\n\nIf you've got some conflicts or whatever with something out of tree\nyou'd like me to accommodate or even resolve for you I'd be happy to do\nso, just send me the specifics.\n\n> Besides, given how much is shuffled around in this patch series (e.g. some\n> files in ci/ are removed altogether and their equivalent code is moved\n> into various other places), doubt must be cast on the idea that it would\n> be simple to bring back anything here.\n\nI'm assuming you're talking about resurrecting Azure CI, i.e. (mostly)\nthis would semantically conflict:\n\n    git grep ci/ 6081d3898fe^ -- azure-pipelines.yml\n\nOne thing I can see right away that would need adjusting is that I \"git\nrm\" the \"ci/mount-fileshare.sh\" script as unused. It's part of what I\nasked about in [1], but I could just leave that in place, would you like\nme to do that for a re-roll & would that help?\n\nFor the rest \"ci/install-dependencies.sh\" is the same,\n\"ci/run-build-and-tests.sh\" would be an easy matter of making it run\n\"make test\" instead after invoking ci/lib.sh.\n\nWe're really just talking about a few lines of boilerplate here, I\nreally don't see what the big deal is.\n\nAs my patches also note there's things that the azure-pipelines.yml\nassumed that are no longer true (before any changes I made), so some of\nthis would need adjusting in any case.\n\nIt also does a test run followed by ci/print-test-failures.sh, which as\nI understand you've been maintaining quite adamantly insisting is pretty\nmuch useless compared to the new GitHub-specific output your series\nadds, and which is CI-specific. Presumably most of the work of getting\nAzure running again would be (in your version) to adjust that to\nsomething Azure-specific.\n\nWhereas on the CI portability front I noted in [2] and [3] that we could\ndo pretty much the same without adding CI-specific output targets.\n\nAnyway, I really hope we can find some way past what seems to be an\nimpasse with these various CI changes. All the best.\n\n1. https://lore.kernel.org/git/220222.86y2236ndp.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/220324.8635j7nyvw.gmgdl@evledraar.gmail.com/\n3. https://lore.kernel.org/git/220302.86mti87cj2.gmgdl@evledraar.gmail.com/\n"},{"id":"453196","messageId":"xmqq4k361a57.fsf@gitster.g","threadId":"57451","inReplyTo":"220406.86bkxeecoi.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-06T15:53:08Z","receivedAt":"2022-04-06T17:41:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> Briefly: The entire reason I changed those bits is exactly to avoid the\n> sort of CI lock-in you're talking about, to th point where this series\n> effectively adds another CI target: You can run everything it's doing\n> with a normal \"make\" invocation.\n\nI'll comment only on this part.  \n\nFWIW, the above matches my impression fromt he base part of the\nrewrite.  As long as a particular CI integration runs shell\nscriptlets that invoke \"make\", moving the code that is shared common\namong CI platforms from the shell scriptlets to the recipe in\nMakefile should not make it harder to support it, and ...\n\n>> A better approach would be to use the already-generic code and adapt it\n>> e.g. to extend to the CirrusCI definition we have.\n>\n> This series doesn't change .cirrus.yml or how it functions, but it just\n> does:\n>\n>   build_script:\n>     - su git -c gmake\n>   test_script:\n>     - su git -c 'gmake test'\n>\n> Which, after this series is exactly what your \"main\" CI does. So we're\n> set up to make it easier to unify the two.\n\n... BSDs or any POSIXy system I would expect to fall into the same\n\"shell scriptlets eventually driving make\" pattern.\n\nThe same argument may not apply if another CI platform uses shell\nscriptlets but does not want to use \"make\" at all.  The \"do more in\n'make'\" movement could be hurting such a user.  I do not know if\nWindows' preference to use cmake plays a role there, or if Dscho's\nresistance comes from there, though.\n\n> Anyway, I really hope we can find some way past what seems to be an\n> impasse with these various CI changes. All the best.\n\nYup.\n\nThanks.\n"},{"id":"453525","messageId":"patch-v3-01.29-3cb4749c5ea-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 01/29] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:14Z","receivedAt":"2022-04-13T19:52:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cbc2f8f1caa..57141d38a85 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453526","messageId":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v2-00.25-00000000000-20220325T182534Z-avarab@gmail.com","subject":"[PATCH v3 00/29] CI: run \"make\" in CI \"steps\", improve UX","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:13Z","receivedAt":"2022-04-13T19:52:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This series changes CI \"step\" targets that are shellscripts that do N\nthings to instead be single command invocations at the \"step\" level,\ndriven by the CI recipe itself.\n\nTo do that we need to pass state that we previously re-setup for every\n\"step\" via $GITHUB_ENV, whose state we then helpfully show (this is just\na standard GitHub CI feature) in a drop-down at the start of every\n\"step\".\n\nI.e. at the tip of this series you can reliably look at that\n$GITHUB_ENV view to see what the full and relevant environment was for\nthat \"make\", \"make test\" or whatever.\n\nChanges since v2:\n\n * A new CL summary, based on\n   https://lore.kernel.org/git/220326.861qypldwn.gmgdl@evledraar.gmail.com/\n\n * It's now 29 patches instead of 25, but 3/4 of those are trivial\n   (see range-diff), it just made sense to split them up for\n   readability.\n\n * The rather minor in code but rather big in UX terms is that I've\n   added 29/29, which explicitly documents and shows examples of using\n   the CI tooling in a way where you can locally run a CI target as if\n   though it were a given $jobname, e.g.:\n\n\t# run \"make all test\" like the \"linux-leaks\" job\n\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n\n\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n\n   The rest of the changes in this series are all here to make that\n   nicer, i.e. ci/lib.sh has been taught to not panic if it's not\n   under a known CI platform, but instead to fall back on doing as\n   well as it can, and suggesting that you provide it with a \"jobname\"\n   so it can be used as in the examples above.\n\n   Likewise the ci/print-test-failures.sh script can now be run\n   locally without any extra mock-ups, e.g.:\n\n\tmake test || ci/print-test-failures.sh\n\nThe CI run for this series can be seen at:\nhttps://github.com/avar/git/tree/avar/ci-unroll-make-commands-to-ci-recipe-3\n\n .github/workflows/main.yml            | 100 ++++---\n Makefile                              |  31 ++-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  53 +++-\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |   6 +\n ci/lib-tput.sh                        |   5 +\n ci/lib.sh                             | 387 +++++++++++++++-----------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  25 +-\n ci/run-build-and-tests.sh             |  54 ----\n ci/run-docker-build.sh                |  66 -----\n ci/run-docker.sh                      |  47 ----\n ci/run-static-analysis.sh             |  32 ---\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  10 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ----\n shared.mak                            |   1 +\n 21 files changed, 420 insertions(+), 582 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff against v2:\n 1:  4addbd70213 =  1:  3cb4749c5ea CI: run \"set -ex\" early in ci/lib.sh\n 2:  b23aa99fd37 !  2:  7de95ff437e CI: make \"$jobname\" explicit, remove fallback\n    @@ ci/lib.sh\n     +# Starting assertions\n     +if test -z \"$jobname\"\n     +then\n    -+\techo \"must set a CI jobname\" >&2\n    ++\techo \"must set a CI jobname in the environment\" >&2\n     +\texit 1\n     +fi\n     +\n 3:  eec15a95879 =  3:  820c4e551d9 CI: remove more dead Travis CI support\n 4:  73c894f1665 =  4:  914e81118b8 CI: remove dead \"tree skipping\" code\n 5:  b5e6d538554 !  5:  b2e456f9a9b CI: remove unused Azure ci/* code\n    @@ ci/mount-fileshare.sh (deleted)\n     \n      ## ci/print-test-failures.sh ##\n     @@ ci/print-test-failures.sh: do\n    - \t\ttest_name=\"${TEST_EXIT%.exit}\"\n      \t\ttest_name=\"${test_name##*/}\"\n      \t\ttrash_dir=\"trash directory.$test_name\"\n    -+\t\tmkdir -p failed-test-artifacts\n      \t\tcase \"$CI_TYPE\" in\n     -\t\tazure-pipelines)\n     -\t\t\tmkdir -p failed-test-artifacts\n    @@ ci/print-test-failures.sh: do\n     -\t\t\tcontinue\n     -\t\t\t;;\n      \t\tgithub-actions)\n    --\t\t\tmkdir -p failed-test-artifacts\n    + \t\t\tmkdir -p failed-test-artifacts\n      \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n    - \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n    - \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n -:  ----------- >  6:  30968e36bdd CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n 6:  a4b9febbdca =  7:  cc81b9fe37e CI: don't have \"git grep\" invoke a pager in tree content check\n 7:  5d46d5b34c9 =  8:  2387b0c5842 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n 8:  81e06f13d84 =  9:  54a4d79bf8d CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n 9:  3be91c26d44 = 10:  9a31b7d5011 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n10:  9dc148341ba ! 11:  8ab4e81e1ca CI: consistently use \"export\" in ci/lib.sh\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: check_unignored_build_artifacts ()\n    - export TERM=${TERM:-dumb}\n    +@@ ci/lib.sh: export TERM=${TERM:-dumb}\n    + NPROC=10\n      \n      # Clear MAKEFLAGS that may come from the outside world.\n    --export MAKEFLAGS=\n    -+MAKEFLAGS=\n    +-export MAKEFLAGS=--jobs=$NPROC\n    ++MAKEFLAGS=--jobs=$NPROC\n      \n      if test \"$GITHUB_ACTIONS\" = \"true\"\n      then\n     @@ ci/lib.sh: then\n      \tCC=\"${CC:-gcc}\"\n      \n    - \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n    + \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n     -\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n     +\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    - \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    -+\n     +\texport GIT_TEST_OPTS\n      else\n      \techo \"Could not identify CI type\" >&2\n11:  e9c7ba492e8 ! 12:  9fe00566767 CI: export variables via a wrapper\n    @@ Commit message\n         \"--test\" and \"--all\" parameters to indicate whether they're needed for\n         building, testing or both.\n     \n    -    We currently ignore this parameter, but will make use of it in a\n    +    We currently ignore the \"varname\" parameter, but will make use of it in a\n         subsequent commit. Adding it here reduces the needless churn, as we\n         won't need to change all these lines again for that subsequent change.\n     \n    @@ ci/lib.sh: then\n      \n     +# Helper functions\n     +setenv () {\n    -+\tvarmode=\n    -+\tcase \"$1\" in\n    -+\t--*)\n    -+\t\tvarmode=$1\n    ++\twhile test $# != 0\n    ++\tdo\n    ++\t\tcase \"$1\" in\n    ++\t\t--build)\n    ++\t\t\t;;\n    ++\t\t--test)\n    ++\t\t\t;;\n    ++\t\t--all)\n    ++\t\t\t;;\n    ++\t\t-*)\n    ++\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n    ++\t\t\texit 1\n    ++\t\t\t;;\n    ++\t\t*)\n    ++\t\t\tbreak\n    ++\t\t\t;;\n    ++\t\tesac\n     +\t\tshift\n    -+\t\t;;\n    -+\tesac\n    ++\tdone\n     +\n     +\tkey=$1\n     +\tval=$2\n    @@ ci/lib.sh: check_unignored_build_artifacts ()\n     -export TERM=${TERM:-dumb}\n     +setenv TERM ${TERM:-dumb}\n      \n    - # Clear MAKEFLAGS that may come from the outside world.\n    - MAKEFLAGS=\n    + # How many jobs to run in parallel?\n    + NPROC=10\n     @@ ci/lib.sh: then\n      \tCI_TYPE=github-actions\n      \tCC=\"${CC:-gcc}\"\n      \n    --\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n    -+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n    +-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n    ++\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n      \tGIT_TEST_OPTS=\"--verbose-log -x\"\n    - \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    - \n     -\texport GIT_TEST_OPTS\n     +\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n      else\n12:  86d5a48d59a ! 13:  13feda050c0 CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n    @@ ci/lib.sh: setenv () {\n     +\tif test -n \"$GITHUB_ENV\"\n     +\tthen\n     +\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n    -+\telse\n    -+\t\t# For local debugging. Not used by the GitHub CI\n    -+\t\t# itself.\n    -+\t\teval \"export $key=\\\"$val\\\"\"\n     +\tfi\n      }\n      \n -:  ----------- > 14:  d3909b8e896 ci/lib.sh: use \"test\" instead of \"[\"\n13:  649ad1ae249 = 15:  d63a689eae0 CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n14:  b1b5b083389 = 16:  ac1ffe9c642 CI: invoke \"make artifacts-tar\" directly in windows-build\n15:  dfa91ac8938 = 17:  8837bfa5433 CI: split up and reduce \"ci/test-documentation.sh\"\n16:  ba4ed216769 = 18:  aa491990c1a CI: combine ci/install{,-docker}-dependencies.sh\n17:  b5e89a33340 = 19:  39b13298425 CI: move \"env\" definitions into ci/lib.sh\n18:  571f4d0f441 = 20:  0a92c478d28 ci/run-test-slice.sh: replace shelling out with \"echo\"\n19:  2edea06ee4d = 21:  16ac7f5c210 CI: pre-select test slice in Windows & VS tests\n20:  ef9daa6882f ! 22:  939ef573b75 CI: only invoke ci/lib.sh as \"steps\" in main.yml\n    @@ ci/install-dependencies.sh\n     \n      ## ci/lib-ci-type.sh (new) ##\n     @@\n    ++#!/bin/sh\n    ++\n     +if test \"$GITHUB_ACTIONS\" = \"true\"\n     +then\n     +\tCI_TYPE=github-actions\n     +else\n     +\techo \"Could not identify CI type\" >&2\n    -+\tenv >&2\n     +\texit 1\n     +fi\n     \n      ## ci/lib-tput.sh (new) ##\n     @@\n    ++#!/bin/sh\n    ++\n     +# GitHub Action doesn't set TERM, which is required by tput\n    -+export TERM=${TERM:-dumb}\n    ++TERM=${TERM:-dumb}\n    ++export TERM\n     \n      ## ci/lib.sh ##\n     @@\n    @@ ci/lib.sh: setenv () {\n     -# GitHub Action doesn't set TERM, which is required by tput\n     -setenv TERM ${TERM:-dumb}\n     -\n    + # How many jobs to run in parallel?\n    + NPROC=10\n    + \n      # Clear MAKEFLAGS that may come from the outside world.\n    - MAKEFLAGS=\n    + MAKEFLAGS=--jobs=$NPROC\n      \n     -if test \"$GITHUB_ACTIONS\" = \"true\"\n     -then\n    @@ ci/lib.sh: setenv () {\n     +github-actions)\n      \tCC=\"${CC:-gcc}\"\n      \n    - \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n     @@ ci/lib.sh: then\n    + \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    - \n      \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n     -else\n     -\techo \"Could not identify CI type\" >&2\n21:  44e3ace5fbe ! 23:  8e79c3e39e0 CI: narrow down variable definitions in --build and --test\n    @@ Commit message\n         fewer, which makes diagnosing anything going on there easier, as we\n         won't have to look at a deluge of e.g. GIT_TEST_* variables.\n     \n    +    Since we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\n    +    test\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\n    +    steps, i.e. the one with PYTHON_PATH, CC etc. These will all be\n    +    carried over from the earlier --build step.\n    +\n    +    That won't be true in the case of the \"windows-test\" and \"vs-test\"\n    +    jobs, since they run separately from the corresponding \"build\"\n    +    step. So we'll need to make sure that we have the --jobs=N argument\n    +    for those.\n    +\n    +    This doesn't matter that much, as we'll still have --jobs=N in\n    +    GIT_PROVE_OPTS. So the only thing we'll use it for is parallelism in\n    +    the t/Makefile before we get to running \"prove\". Still, it's good to\n    +    be consistent for good measure, and to run the t/Makefile itself in\n    +    parallel.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## .github/workflows/main.yml ##\n    @@ ci/lib.sh: set -ex\n     +mode=$1\n     +if test -z \"$mode\"\n     +then\n    -+\techo \"need a $0 mode, e.g. --build or --test\"\n    ++\techo \"need a $0 mode, e.g. --build or --test\" >&2\n     +\texit 1\n     +fi\n     +\n      if test -z \"$jobname\"\n      then\n    - \techo \"must set a CI jobname\" >&2\n    -@@ ci/lib.sh: fi\n    - \n    - # Helper functions\n    - setenv () {\n    -+\tskip=\n    - \tvarmode=\n    - \tcase \"$1\" in\n    - \t--*)\n    -+\t\tif test \"$1\" != \"$mode\" && test \"$1\" != \"--all\"\n    -+\t\tthen\n    -+\t\t\tskip=t\n    -+\t\tfi\n    - \t\tvarmode=$1\n    - \t\tshift\n    - \t\t;;\n    + \techo \"must set a CI jobname in the environment\" >&2\n     @@ ci/lib.sh: setenv () {\n    - \tval=$2\n    - \tshift 2\n    + \twhile test $# != 0\n    + \tdo\n    + \t\tcase \"$1\" in\n    +-\t\t--build)\n    +-\t\t\t;;\n    +-\t\t--test)\n    +-\t\t\t;;\n    +-\t\t--all)\n    ++\t\t--build | --test)\n    ++\t\t\tif test \"$1\" != \"$mode\"\n    ++\t\t\tthen\n    ++\t\t\t\treturn 0\n    ++\t\t\tfi\n    ++\n    + \t\t\t;;\n    + \t\t-*)\n    + \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n    +@@ ci/lib.sh: setenv () {\n    + # How many jobs to run in parallel?\n    + NPROC=10\n      \n    -+\tif test -n \"$skip\"\n    -+\tthen\n    -+\t\treturn 0\n    -+\tfi\n    ++# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n    ++# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n    ++COMMON_MAKEFLAGS=--jobs=$NPROC\n     +\n    - \tif test -n \"$GITHUB_ENV\"\n    - \tthen\n    - \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n    + # Clear MAKEFLAGS that may come from the outside world.\n    +-MAKEFLAGS=--jobs=$NPROC\n    ++MAKEFLAGS=$COMMON_MAKEFLAGS\n    + \n    + case \"$CI_TYPE\" in\n    + github-actions)\n    +@@ ci/lib.sh: windows-build)\n    + \tsetenv --build NO_PERL NoThanks\n    + \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n    + \t;;\n    ++windows-test)\n    ++\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n    ++\t;;\n    + vs-build)\n    + \tsetenv --build NO_PERL NoThanks\n    + \tsetenv --build NO_GETTEXT NoThanks\n    +@@ ci/lib.sh: vs-build)\n    + \t;;\n    + vs-test)\n    + \tsetenv --test NO_SVN_TESTS YesPlease\n    ++\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n    + \t;;\n    + linux-gcc)\n    + \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n    +@@ ci/lib.sh: linux-leaks)\n    + \t;;\n    + esac\n    + \n    +-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n    ++setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n22:  5f56b922e08 ! 24:  d1d5c1e2f65 CI: add more variables to MAKEFLAGS, except under vs-build\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: setenv () {\n    +@@ ci/lib.sh: COMMON_MAKEFLAGS=--jobs=$NPROC\n      # Clear MAKEFLAGS that may come from the outside world.\n    - MAKEFLAGS=\n    + MAKEFLAGS=$COMMON_MAKEFLAGS\n      \n    -+# Common make and cmake build options\n    ++# Use common options for \"make\" (cmake in \"vs-build\" below uses the\n    ++# intermediate variables directly)\n     +DEVELOPER=1\n    ++MAKEFLAGS=\"$MAKEFLAGS DEVELOPER=$DEVELOPER\"\n     +SKIP_DASHED_BUILT_INS=YesPlease\n    -+\n    -+# Use common options for \"make\" (cmake in \"vs-build\" below)\n    -+MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    ++MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n     +\n      case \"$CI_TYPE\" in\n      github-actions)\n    @@ ci/lib.sh: github-actions)\n      \n      case \"$runs_on_pool\" in\n      ubuntu-latest)\n    -@@ ci/lib.sh: windows-build)\n    - \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n    +@@ ci/lib.sh: windows-test)\n    + \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n      \t;;\n      vs-build)\n     +\tsetenv --build DEVELOPER $DEVELOPER\n23:  b45b7cec94e ! 25:  1268792233f CI: set CC in MAKEFLAGS directly, don't add it to the environment\n    @@ ci/lib.sh: setenv () {\n      \tfi\n      }\n      \n    --# Clear MAKEFLAGS that may come from the outside world.\n     +# Clear variables that may come from the outside world.\n     +CC=\n     +CC_PACKAGE=\n    - MAKEFLAGS=\n    ++\n    + # How many jobs to run in parallel?\n    + NPROC=10\n      \n    - # Common make and cmake build options\n    -@@ ci/lib.sh: MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    +@@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n      \n      case \"$CI_TYPE\" in\n      github-actions)\n     -\tCC=\"${CC:-gcc}\"\n     -\n    - \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n      \tGIT_TEST_OPTS=\"--verbose-log -x\"\n    - \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n    + \ttest Windows != \"$RUNNER_OS\" ||\n     @@ ci/lib.sh: vs-test)\n    - \tsetenv --test NO_SVN_TESTS YesPlease\n    + \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n      \t;;\n      linux-gcc)\n     +\tCC=gcc\n    @@ ci/lib.sh: linux-musl)\n      \t;;\n      esac\n      \n    --setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n    +-setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n     +MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n    -+setenv --all MAKEFLAGS \"$MAKEFLAGS\"\n    ++setenv --build MAKEFLAGS \"$MAKEFLAGS\"\n -:  ----------- > 26:  83138dacd3e CI: set SANITIZE=leak in MAKEFLAGS directly\n24:  06bf8d9f61b ! 27:  0508777c68e CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n    @@ ci/lib.sh: ubuntu-latest)\n      \tsetenv --test GIT_TEST_HTTPD true\n      \t;;\n     -macos-latest)\n    --\tif [ \"$jobname\" = osx-gcc ]\n    +-\tif test \"$jobname\" = osx-gcc\n     -\tthen\n     -\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n     -\telse\n25:  6dc96ba8b82 ! 28:  c0ce0fd3a80 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n    @@ Commit message\n     \n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    - ## ci/lib-ci-type.sh ##\n    -@@ ci/lib-ci-type.sh: else\n    - \tenv >&2\n    - \texit 1\n    - fi\n    -+\n    -+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n    -\n      ## ci/lib.sh ##\n     @@\n      #!/bin/sh\n    @@ ci/lib.sh\n      # Helper libraries\n      . ${0%/*}/lib-ci-type.sh\n     @@ ci/lib.sh: then\n    - \techo \"need a $0 mode, e.g. --build or --test\"\n      \texit 1\n      fi\n    -+echo \"CONFIG: mode=$mode\" >&2\n      \n    - if test -z \"$jobname\"\n    - then\n    - \techo \"must set a CI jobname\" >&2\n    - \texit 1\n    - fi\n    ++# Show our configuration\n    ++echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n     +echo \"CONFIG: jobname=$jobname\" >&2\n     +echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n     +echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n    - \n    ++if test -n \"$GITHUB_ENV\"\n    ++then\n    ++\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n    ++fi\n    ++\n      # Helper functions\n      setenv () {\n    ++\tlocal skip=\n    + \twhile test $# != 0\n    + \tdo\n    + \t\tcase \"$1\" in\n    + \t\t--build | --test)\n    + \t\t\tif test \"$1\" != \"$mode\"\n    + \t\t\tthen\n    +-\t\t\t\treturn 0\n    ++\t\t\t\tskip=t\n    + \t\t\tfi\n    + \n    + \t\t\t;;\n     @@ ci/lib.sh: setenv () {\n    + \tval=$2\n    + \tshift 2\n      \n    - \tif test -n \"$skip\"\n    - \tthen\n    ++\tif test -n \"$skip\"\n    ++\tthen\n     +\t\techo \"SKIP '$key=$val'\" >&2\n    - \t\treturn 0\n    - \tfi\n    - \n    -@@ ci/lib.sh: setenv () {\n    - \t\t# itself.\n    - \t\teval \"export $key=\\\"$val\\\"\"\n    ++\t\treturn 0\n    ++\tfi\n    ++\n    + \tif test -n \"$GITHUB_ENV\"\n    + \tthen\n    + \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n      \tfi\n     +\n     +\techo \"SET: '$key=$val'\" >&2\n -:  ----------- > 29:  2e3c02fa0df CI: make it easy to use ci/*.sh outside of CI\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453527","messageId":"patch-v3-02.29-7de95ff437e-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 02/29] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:15Z","receivedAt":"2022-04-13T19:52:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57141d38a85..5fda166ad47 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"must set a CI jobname in the environment\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453528","messageId":"patch-v3-03.29-820c4e551d9-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 03/29] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:16Z","receivedAt":"2022-04-13T19:52:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the -\"-state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     |  3 --\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 184 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5fda166ad47..510b20726ab 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..00fcf27b1b2 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -77,9 +77,6 @@ do\n \t\t\tfi\n \t\t\tcombined_trash_size=$new_combined_trash_size\n \n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n \t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n \t\t\tcat \"$trash_tgz_b64\"\n \t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453529","messageId":"patch-v3-04.29-914e81118b8-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 04/29] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:17Z","receivedAt":"2022-04-13T19:52:07Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 510b20726ab..d12eaf338f9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453530","messageId":"patch-v3-05.29-b2e456f9a9b-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 05/29] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:18Z","receivedAt":"2022-04-13T19:52:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  5 -----\n 4 files changed, 1 insertion(+), 45 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex dbcebad2fb2..e7ea8799411 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tbrew install --cask --no-quarantine perforce || {\n \t\t# Update the definitions and try again\n@@ -69,7 +67,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d12eaf338f9..c4b829c1eed 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 00fcf27b1b2..a878cca67e4 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -39,11 +39,6 @@ do\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n-\t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453531","messageId":"patch-v3-06.29-30968e36bdd-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 06/29] CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:19Z","receivedAt":"2022-04-13T19:52:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a8c51f77d16 (ci: clear and mark MAKEFLAGS exported just once,\n2019-02-07) the assignment of MAKEFLAGS was done up-front to\nfuture-proof this code for the bug fixed in 406f93ae488 (ci: make sure\nwe build Git parallel, 2019-02-07).\n\nBut since 4a6e4b96026 (CI: remove Travis CI support, 2021-11-23) the\n--jobs=10 has been an invariant here, so let's assign --jobs=$NPROC to\nthe MAKEFLAGS right away, this gets rid of the leading whitespace from\nthe $MAKEFLAGS variable, as it would previously be empty on the first\nassignment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c4b829c1eed..21c009757f4 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -26,17 +26,19 @@ check_unignored_build_artifacts ()\n # GitHub Action doesn't set TERM, which is required by tput\n export TERM=${TERM:-dumb}\n \n+# How many jobs to run in parallel?\n+NPROC=10\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+export MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453532","messageId":"patch-v3-07.29-cc81b9fe37e-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 07/29] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:20Z","receivedAt":"2022-04-13T19:52:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453533","messageId":"patch-v3-08.29-2387b0c5842-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 08/29] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:21Z","receivedAt":"2022-04-13T19:52:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 28 ++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n shared.mak                 |  1 +\n 4 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex f8bccfab5e9..8717ea7e745 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3031,6 +3031,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3466,3 +3480,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\ndiff --git a/shared.mak b/shared.mak\nindex 50d4596f0d6..83e0aa16e7d 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -68,6 +68,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \n ## Used in \"Documentation/Makefile\"\n \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453534","messageId":"patch-v3-10.29-9a31b7d5011-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 10/29] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:23Z","receivedAt":"2022-04-13T19:52:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex e7ea8799411..34b4400f38b 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 21c009757f4..5736a4d2e04 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -67,18 +67,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453535","messageId":"patch-v3-11.29-8ab4e81e1ca-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 11/29] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:24Z","receivedAt":"2022-04-13T19:52:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5736a4d2e04..5783eed1b20 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -30,7 +30,7 @@ export TERM=${TERM:-dumb}\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -38,9 +38,10 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -94,4 +95,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453536","messageId":"patch-v3-09.29-54a4d79bf8d-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 09/29] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:22Z","receivedAt":"2022-04-13T19:52:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8717ea7e745..2e1ae6c6067 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3402,7 +3402,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3492,5 +3492,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453538","messageId":"patch-v3-12.29-9fe00566767-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 12/29] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:25Z","receivedAt":"2022-04-13T19:52:32Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore the \"varname\" parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 51 ++++++++++++++++++++++++++++++---------\n ci/run-build-and-tests.sh | 34 +++++++++++++-------------\n 2 files changed, 57 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5783eed1b20..3727e6ec2f9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,35 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--build)\n+\t\t\t;;\n+\t\t--test)\n+\t\t\t;;\n+\t\t--all)\n+\t\t\t;;\n+\t\t-*)\n+\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +53,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # How many jobs to run in parallel?\n NPROC=10\n@@ -37,21 +66,21 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -67,7 +96,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -90,9 +119,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453539","messageId":"patch-v3-14.29-d3909b8e896-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 14/29] ci/lib.sh: use \"test\" instead of \"[\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:27Z","receivedAt":"2022-04-13T19:52:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the ci/lib.sh script to use \"if test\" rather than \"if [\". Until\nthe preceding commit this script relied on the non-POSIX \"export X=Y\"\nsyntax, but now that it's POSIX portable let's use our usual style in\nit, and not the bash-specific style that was used in it historically.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cc9a368be42..ffc0e524aaa 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -94,7 +94,7 @@ ubuntu-latest)\n \t\tbreak\n \tfi\n \n-\tif [ \"$jobname\" = linux-gcc ]\n+\tif test \"$jobname\" = linux-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n \telse\n@@ -104,7 +104,7 @@ ubuntu-latest)\n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n+\tif test \"$jobname\" = osx-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \telse\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453540","messageId":"patch-v3-15.29-d63a689eae0-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 15/29] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:28Z","receivedAt":"2022-04-13T19:52:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c83f6a21ca3..05c5771e7f6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453541","messageId":"patch-v3-16.29-ac1ffe9c642-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 16/29] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:29Z","receivedAt":"2022-04-13T19:52:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 05c5771e7f6..2c23a19eac2 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453542","messageId":"patch-v3-13.29-13feda050c0-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 13/29] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:26Z","receivedAt":"2022-04-13T19:52:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant output non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 36 +++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 58 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..c83f6a21ca3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: no\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 34b4400f38b..01006379fd0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3727e6ec2f9..cc9a368be42 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -39,7 +41,10 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -109,6 +114,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453543","messageId":"patch-v3-17.29-8837bfa5433-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 17/29] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:30Z","receivedAt":"2022-04-13T19:52:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 2c23a19eac2..92b914f16fd 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ffc0e524aaa..35a972fa3f5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -47,16 +47,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453544","messageId":"patch-v3-18.29-aa491990c1a-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 18/29] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:31Z","receivedAt":"2022-04-13T19:52:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, and because the\n\"ci/install-dependencies.sh\" used \"ci/lib.sh\", which requires\n\"bash\". At least one of the docker containers doesn't have \"bash\". To\nmake the existing code POSIX-compatible we need to replace pushd/popd\nwith a sub-shell, but no other changes were needed.\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 27 ++++++++++++++++++++++-----\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 23 insertions(+), 28 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 92b914f16fd..3fd3e4f873c 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 01006379fd0..9388289d0ed 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -34,18 +34,20 @@ ubuntu-latest)\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n \tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n+\t)\n \tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n@@ -90,6 +92,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null && type p4 >/dev/null\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453545","messageId":"patch-v3-19.29-39b13298425-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 19/29] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:32Z","receivedAt":"2022-04-13T19:52:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 3fd3e4f873c..fe37e0f1b36 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 35a972fa3f5..8c574b21a67 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -104,6 +104,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453546","messageId":"patch-v3-20.29-0a92c478d28-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 20/29] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:33Z","receivedAt":"2022-04-13T19:52:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453547","messageId":"patch-v3-21.29-16ac7f5c210-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 21/29] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:34Z","receivedAt":"2022-04-13T19:52:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  4 ++--\n 2 files changed, 10 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (57%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex fe37e0f1b36..1e13718b989 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 57%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..ec602f8a053 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,10 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+echo T=\"$tests\" >>$GITHUB_ENV\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453548","messageId":"patch-v3-22.29-939ef573b75-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 22/29] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:35Z","receivedAt":"2022-04-13T19:52:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  9 +++++++++\n ci/lib-tput.sh                        |  5 +++++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 33 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 9388289d0ed..ee9af62fc92 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..6f01fd9e5d9\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..b62ef13c44c\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,5 @@\n+#!/bin/sh\n+\n+# GitHub Action doesn't set TERM, which is required by tput\n+TERM=${TERM:-dumb}\n+export TERM\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8c574b21a67..8f7e178f3ff 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -47,18 +43,14 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # How many jobs to run in parallel?\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=--jobs=$NPROC\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC:-gcc}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n@@ -66,11 +58,12 @@ then\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex a878cca67e4..2405f65650a 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex ec602f8a053..a0332095bb3 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453549","messageId":"patch-v3-23.29-8e79c3e39e0-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 23/29] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:36Z","receivedAt":"2022-04-13T19:52:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nSince we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\ntest\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\nsteps, i.e. the one with PYTHON_PATH, CC etc. These will all be\ncarried over from the earlier --build step.\n\nThat won't be true in the case of the \"windows-test\" and \"vs-test\"\njobs, since they run separately from the corresponding \"build\"\nstep. So we'll need to make sure that we have the --jobs=N argument\nfor those.\n\nThis doesn't matter that much, as we'll still have --jobs=N in\nGIT_PROVE_OPTS. So the only thing we'll use it for is parallelism in\nthe t/Makefile before we get to running \"prove\". Still, it's good to\nbe consistent for good measure, and to run the t/Makefile itself in\nparallel.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 20 +++++++++++---------\n ci/lib.sh                  | 30 +++++++++++++++++++++++-------\n 2 files changed, 34 insertions(+), 16 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 1e13718b989..0787cadc76b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +333,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +354,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +366,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8f7e178f3ff..50bc766254b 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -5,6 +5,13 @@ set -ex\n . ${0%/*}/lib-ci-type.sh\n \n # Starting assertions\n+mode=$1\n+if test -z \"$mode\"\n+then\n+\techo \"need a $0 mode, e.g. --build or --test\" >&2\n+\texit 1\n+fi\n+\n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname in the environment\" >&2\n@@ -16,11 +23,12 @@ setenv () {\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n-\t\t--build)\n-\t\t\t;;\n-\t\t--test)\n-\t\t\t;;\n-\t\t--all)\n+\t\t--build | --test)\n+\t\t\tif test \"$1\" != \"$mode\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n+\n \t\t\t;;\n \t\t-*)\n \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n@@ -46,8 +54,12 @@ setenv () {\n # How many jobs to run in parallel?\n NPROC=10\n \n+# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+COMMON_MAKEFLAGS=--jobs=$NPROC\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=$COMMON_MAKEFLAGS\n \n case \"$CI_TYPE\" in\n github-actions)\n@@ -101,6 +113,9 @@ windows-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n+windows-test)\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n+\t;;\n vs-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n@@ -117,6 +132,7 @@ vs-build)\n \t;;\n vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n@@ -162,4 +178,4 @@ linux-leaks)\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453550","messageId":"patch-v3-24.29-d1d5c1e2f65-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 24/29] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:37Z","receivedAt":"2022-04-13T19:52:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 50bc766254b..8fb0bfd43e1 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -61,6 +61,13 @@ COMMON_MAKEFLAGS=--jobs=$NPROC\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n \n+# Use common options for \"make\" (cmake in \"vs-build\" below uses the\n+# intermediate variables directly)\n+DEVELOPER=1\n+MAKEFLAGS=\"$MAKEFLAGS DEVELOPER=$DEVELOPER\"\n+SKIP_DASHED_BUILT_INS=YesPlease\n+MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC:-gcc}\"\n@@ -77,10 +84,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -117,6 +122,9 @@ windows-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453551","messageId":"patch-v3-26.29-83138dacd3e-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 26/29] CI: set SANITIZE=leak in MAKEFLAGS directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:39Z","receivedAt":"2022-04-13T19:53:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As in the preceding commit's change to do likewise for CC, let's not\nset SANITIZE in the environment. When I added the \"linux-leaks\" job in\nin 956d2e4639b (tests: add a test mode for SANITIZE=leak, run it in\nCI, 2021-09-23) I missed that I could do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c73b107d9c7..b439c1a4f82 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -201,7 +201,7 @@ linux-musl)\n \t;;\n linux-leaks)\n \tCC=gcc\n-\tsetenv --build SANITIZE leak\n+\tMAKEFLAGS=\"$MAKEFLAGS SANITIZE=leak\"\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453552","messageId":"patch-v3-25.29-1268792233f-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:38Z","receivedAt":"2022-04-13T19:53:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\npicked up in ci/lib.sh let's instead have ci/lib.sh itself add it\ndirectly to MAKEFLAGS.\n\nSetting CC=gcc by default made for confusing trace output, and since a\npreceding change to carry it and others over across \"steps\" in the\nGitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\nconfusingly has CC=gcc set, even though it builds with MSVC.\n\nLet's instead reply on the Makefile default of CC=cc, and only\noverride it for those jobs where it's needed. This does mean that\nwe'll need to set it for the \"pedantic\" job, which previously relied\non the default CC=gcc in case \"clang\" become the default on that\nplatform.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/lib.sh                  | 27 ++++++++++++++++++++++++---\n 2 files changed, 24 insertions(+), 16 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 0787cadc76b..6d25ec4ae3b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8fb0bfd43e1..c73b107d9c7 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -51,6 +51,10 @@ setenv () {\n \tfi\n }\n \n+# Clear variables that may come from the outside world.\n+CC=\n+CC_PACKAGE=\n+\n # How many jobs to run in parallel?\n NPROC=10\n \n@@ -70,8 +74,6 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC:-gcc}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n@@ -143,9 +145,16 @@ vs-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-8\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -160,13 +169,23 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\tCC_PACKAGE=gcc-9\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n+\tCC=gcc\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n \tsetenv --build DEVOPTS pedantic\n@@ -181,9 +200,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453553","messageId":"patch-v3-27.29-0508777c68e-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 27/29] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:40Z","receivedAt":"2022-04-13T19:53:07Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex b439c1a4f82..d62cd757ef4 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -105,14 +105,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif test \"$jobname\" = osx-gcc\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -170,10 +162,12 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \tCC_PACKAGE=gcc-9\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453554","messageId":"patch-v3-28.29-c0ce0fd3a80-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 28/29] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:41Z","receivedAt":"2022-04-13T19:53:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 23 +++++++++++++++++++++--\n 1 file changed, 21 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d62cd757ef4..94f83069884 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -18,15 +18,26 @@ then\n \texit 1\n fi\n \n+# Show our configuration\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+fi\n+\n # Helper functions\n setenv () {\n+\tlocal skip=\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build | --test)\n \t\t\tif test \"$1\" != \"$mode\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \n \t\t\t;;\n@@ -45,10 +56,18 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\techo \"SKIP '$key=$val'\" >&2\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453555","messageId":"patch-v3-29.29-2e3c02fa0df-20220413T194847Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v3 29/29] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:51:42Z","receivedAt":"2022-04-13T19:53:14Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the ci/.sh scripts have lost most of their\nCI-specific assumptions. Let's go even further and explicitly support\nrunning ci/lib.sh outside of CI.\n\nThis was possible before by faking up enough CI-specific variables,\nbut as shown in the new \"help\" output being added here using the\nci/lib.sh to provide \"CI-like\" has now become trivial.\n\nThe ci/print-test-failures.sh scripts can now be used outside of CI as\nwell, the only GitHub CI-specific part is now guarded by a check that\nwe'll pass if outside of GitHub CI.\n\nThere's also a special-case here to not clobber $MAKEFLAGS in the\nenvironment if we're outside of CI, in case the user has e.g. \"jN\" or\nother flags to \"make\" that they'd prefer configured already.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh         |  3 --\n ci/lib.sh                 | 61 ++++++++++++++++++++++++++++++++++++---\n ci/print-test-failures.sh | 11 ++-----\n 3 files changed, 60 insertions(+), 15 deletions(-)\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex 6f01fd9e5d9..09acab7aaec 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -3,7 +3,4 @@\n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n-else\n-\techo \"Could not identify CI type\" >&2\n-\texit 1\n fi\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 94f83069884..3fd5291bc80 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,6 +1,30 @@\n #!/bin/sh\n set -e\n \n+#  Usage\n+CI_TYPE_HELP_COMMANDS='\n+\t# run \"make all test\" like the \"linux-leaks\" job\n+\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n+\n+\t# run \"make all test\" like the \"linux-musl\" job\n+\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n+\n+\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n+\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n+\n+\t# run \"make test\" like the \"linux-sha256\" job\n+\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n+'\n+\n+CI_TYPE_HELP=\"\n+running $0 outside of CI? You can use ci/lib.sh to set up your\n+environment like a given CI job. E.g.:\n+$CI_TYPE_HELP_COMMANDS\n+\n+note that some of these (e.g. the linux-musl one) may not work as\n+expected due to the CI job configuring a platform that may not match\n+yours.\"\n+\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n@@ -9,6 +33,10 @@ mode=$1\n if test -z \"$mode\"\n then\n \techo \"need a $0 mode, e.g. --build or --test\" >&2\n+\tif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$CI_TYPE_HELP\" >&2\n+\tfi\n \texit 1\n fi\n \n@@ -35,7 +63,7 @@ setenv () {\n \tdo\n \t\tcase \"$1\" in\n \t\t--build | --test)\n-\t\t\tif test \"$1\" != \"$mode\"\n+\t\t\tif test \"$1\" != \"$mode\" && test \"$mode\" != \"--all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n@@ -65,6 +93,10 @@ setenv () {\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$key=\\\"$val\\\"\"\n+\t\techo \"export $key\"\n \tfi\n \n \techo \"SET: '$key=$val'\" >&2\n@@ -76,10 +108,29 @@ CC_PACKAGE=\n \n # How many jobs to run in parallel?\n NPROC=10\n+case \"$CI_TYPE\" in\n+'')\n+\tif command -v nproc >/dev/null\n+\tthen\n+\t\tNPROC=$(nproc)\n+\telse\n+\t\tNPROC=1\n+\tfi\n+\n+\tif test -n \"$MAKEFLAGS\"\n+\tthen\n+\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n+\telse\n+\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\tfi\n+\t;;\n+*)\n+\t# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+\t# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\t;;\n+esac\n \n-# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n-# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n-COMMON_MAKEFLAGS=--jobs=$NPROC\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n@@ -99,6 +150,8 @@ github-actions)\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n \t;;\n+'')\n+\t;;\n *)\n \techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 2405f65650a..ba8428ad484 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -38,19 +38,14 @@ do\n \t\ttest_name=\"${TEST_EXIT%.exit}\"\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n-\t\tcase \"$CI_TYPE\" in\n-\t\tgithub-actions)\n+\t\tif test \"$CI_TYPE\" = \"github-actions\"\n+\t\tthen\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n \t\t\tcontinue\n-\t\t\t;;\n-\t\t*)\n-\t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n-\t\t\texit 1\n-\t\t\t;;\n-\t\tesac\n+\t\tfi\n \t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n \t\tif [ -d \"$trash_dir\" ]\n \t\tthen\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453557","messageId":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com","subject":"[RFC PATCH v4 0/6] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:22Z","receivedAt":"2022-04-13T19:57:35Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"See the \"v3\" for the \"real\" cover-letter:\nhttps://lore.kernel.org/git/RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com/\n\nThe only change in this v4 is to rebase this series on the\njust-submitted v3 of the parent series at:\nhttps://lore.kernel.org/git/cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com/\n\nAlso seen in the range-diff is a rebasing on the --immediate behavior\nfor for t/test-lib.sh, which landed on master since tho \"v3\" was\nsubmitted.\n\nJohannes Schindelin (6):\n  ci: make it easier to find failed tests' logs in the GitHub workflow\n  tests: refactor --write-junit-xml code\n  test(junit): avoid line feeds in XML attributes\n  ci: optionally mark up output in the GitHub workflow\n  ci: use `--github-workflow-markup` in the GitHub workflow\n  ci: call `finalize_test_case_output` a little later\n\n .github/workflows/main.yml           |  20 +---\n ci/lib.sh                            |   3 +-\n ci/print-test-failures-github.sh     |  35 +++++++\n t/test-lib-functions.sh              |   4 +-\n t/test-lib-github-workflow-markup.sh |  50 ++++++++++\n t/test-lib-junit.sh                  | 132 +++++++++++++++++++++++++++\n t/test-lib.sh                        | 128 ++++----------------------\n 7 files changed, 245 insertions(+), 127 deletions(-)\n create mode 100755 ci/print-test-failures-github.sh\n create mode 100644 t/test-lib-github-workflow-markup.sh\n create mode 100644 t/test-lib-junit.sh\n\nRange-diff against v3:\n1:  d88749c60c9 = 1:  cc137c69ee1 ci: make it easier to find failed tests' logs in the GitHub workflow\n2:  ad1e1465a81 = 2:  91f96c4f210 tests: refactor --write-junit-xml code\n3:  fc96e5b7296 = 3:  84c722969d5 test(junit): avoid line feeds in XML attributes\n4:  429c256ac62 = 4:  8acaa800d3a ci: optionally mark up output in the GitHub workflow\n5:  72058db67b0 ! 5:  4499f743dd1 ci: use `--github-workflow-markup` in the GitHub workflow\n    @@ Commit message\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    -@@ ci/lib.sh: MAKEFLAGS=\"DEVELOPER=$DEVELOPER SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    +@@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n      case \"$CI_TYPE\" in\n      github-actions)\n    - \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs 10\"\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n     -\tGIT_TEST_OPTS=\"--verbose-log -x\"\n     +\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    - \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n    ++\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    + \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n     \n      ## ci/print-test-failures-github.sh ##\n     @@ ci/print-test-failures-github.sh: github-actions)\n6:  1d2b94436fc ! 6:  b291f64821c ci: call `finalize_test_case_output` a little later\n    @@ t/test-lib.sh: trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n      \ttest_failure=$(($test_failure + 1))\n      \tsay_color error \"not ok $test_count - $1\"\n      \tshift\n    - \tprintf '%s\\n' \"$*\" | sed -e 's/^/#\t/'\n    - \ttest \"$immediate\" = \"\" || _error_exit\n    +@@ t/test-lib.sh: test_failure_ () {\n    + \t\tsay_color error \"1..$test_count\"\n    + \t\t_error_exit\n    + \tfi\n     +\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n      }\n      \n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453558","messageId":"RFC-patch-v4-2.6-91f96c4f210-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 2/6] tests: refactor --write-junit-xml code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:24Z","receivedAt":"2022-04-13T19:57:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe code writing JUnit XML is interspersed directly with all the code in\n`t/test-lib.sh`, and it is therefore not only ill-separated, but\nintroducing yet another output format would make the situation even\nworse.\n\nLet's introduce an abstraction layer by hiding the JUnit XML code behind\nfour new functions that are supposed to be called before and after each\ntest and test case.\n\nThis is not just an academic exercise, refactoring for refactoring's\nsake. We _actually_ want to introduce such a new output format, to\nmake it substantially easier to diagnose test failures in our GitHub\nworkflow, therefore we do need this refactoring.\n\nThis commit is best viewed with `git show --color-moved\n--color-moved-ws=allow-indentation-change <commit>`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++\n t/test-lib.sh       | 124 ++++++-------------------------------------\n 2 files changed, 142 insertions(+), 108 deletions(-)\n create mode 100644 t/test-lib-junit.sh\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nnew file mode 100644\nindex 00000000000..9d55d74d764\n--- /dev/null\n+++ b/t/test-lib-junit.sh\n@@ -0,0 +1,126 @@\n+# Library of functions to format test scripts' output in JUnit XML\n+# format, to support Git's test suite result to be presented in an\n+# easily digestible way on Azure Pipelines.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when the user asks\n+# for JUnit XML; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n+\tmkdir -p \"$junit_xml_dir\"\n+\tjunit_xml_base=${1##*/}\n+\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n+\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n+\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n+\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n+\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n+\tjunit_suite_start=$(test-tool date getnanos)\n+\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\tthen\n+\t\tGIT_TEST_TEE_OFFSET=0\n+\tfi\n+}\n+\n+start_test_case_output () {\n+\tjunit_start=$(test-tool date getnanos)\n+}\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tok)\n+\t\tset \"$*\"\n+\t\t;;\n+\tfailure)\n+\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n+\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\t\t   then\n+\t\t\t\ttest-tool path-utils skip-n-bytes \\\n+\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\t\t\t   else\n+\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n+\t\t\t   fi)\")\"\n+\t\tjunit_insert=\"$junit_insert</failure>\"\n+\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\tthen\n+\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n+\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n+\t\tfi\n+\t\tset \"$1\" \"      $junit_insert\"\n+\t\t;;\n+\tfixed)\n+\t\tset \"$* (breakage fixed)\"\n+\t\t;;\n+\tbroken)\n+\t\tset \"$* (known breakage)\"\n+\t\t;;\n+\tskip)\n+\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n+\t\t;;\n+\tesac\n+\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tshift\n+\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n+\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n+\t\tdate getnanos $junit_start)\\\"\"\n+\twrite_junit_xml \"$(printf '%s\\n' \\\n+\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n+\tjunit_have_testcase=t\n+}\n+\n+finalize_test_output () {\n+\tif test -n \"$junit_xml_path\"\n+\tthen\n+\t\ttest -n \"$junit_have_testcase\" || {\n+\t\t\tjunit_start=$(test-tool date getnanos)\n+\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n+\t\t}\n+\n+\t\t# adjust the overall time\n+\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n+\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n+\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n+\t\t\t-e '/^ *<\\/testsuite/d' \\\n+\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n+\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n+\n+\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n+\t\twrite_junit_xml=\n+\tfi\n+}\n+\n+write_junit_xml () {\n+\tcase \"$1\" in\n+\t--truncate)\n+\t\t>\"$junit_xml_path\"\n+\t\tjunit_have_testcase=\n+\t\tshift\n+\t\t;;\n+\tesac\n+\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n+}\n+\n+xml_attr_encode () {\n+\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+}\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 531cef097db..62a57b00730 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -137,6 +137,12 @@ mark_option_requires_arg () {\n \tstore_arg_to=$2\n }\n \n+# These functions can be overridden e.g. to output JUnit XML\n+start_test_output () { :; }\n+start_test_case_output () { :; }\n+finalize_test_case_output () { :; }\n+finalize_test_output () { :; }\n+\n parse_option () {\n \tlocal opt=\"$1\"\n \n@@ -196,7 +202,7 @@ parse_option () {\n \t\ttee=t\n \t\t;;\n \t--write-junit-xml)\n-\t\twrite_junit_xml=t\n+\t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n \t--stress)\n \t\tstress=t ;;\n@@ -663,7 +669,7 @@ exec 6<&0\n exec 7>&2\n \n _error_exit () {\n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \tGIT_EXIT_OK=t\n \texit 1\n }\n@@ -773,35 +779,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$*\"\n-\tfi\n+\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n }\n \n test_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n-\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\t\t   then\n-\t\t\t\ttest-tool path-utils skip-n-bytes \\\n-\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n-\t\t\t   else\n-\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n-\t\t\t   fi)\")\"\n-\t\tjunit_insert=\"$junit_insert</failure>\"\n-\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\tthen\n-\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n-\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n-\t\tfi\n-\t\twrite_junit_xml_testcase \"$1\" \"      $junit_insert\"\n-\tfi\n+\tfinalize_test_case_output failure \"$@\"\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -814,19 +798,13 @@ test_failure_ () {\n }\n \n test_known_broken_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (breakage fixed)\"\n-\tfi\n+\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n }\n \n test_known_broken_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (known breakage)\"\n-\tfi\n+\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n }\n@@ -1103,10 +1081,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_start=$(test-tool date getnanos)\n-\tfi\n+\tstart_test_case_output\n }\n \n test_finish_ () {\n@@ -1157,12 +1132,7 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tif test -n \"$write_junit_xml\"\n-\t\tthen\n-\t\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n-\t\t\twrite_junit_xml_testcase \"$1\" \\\n-\t\t\t\t\"      <skipped message=\\\"$message\\\" />\"\n-\t\tfi\n+\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n@@ -1178,53 +1148,6 @@ test_at_end_hook_ () {\n \t:\n }\n \n-write_junit_xml () {\n-\tcase \"$1\" in\n-\t--truncate)\n-\t\t>\"$junit_xml_path\"\n-\t\tjunit_have_testcase=\n-\t\tshift\n-\t\t;;\n-\tesac\n-\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n-}\n-\n-xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n-}\n-\n-write_junit_xml_testcase () {\n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n-\tshift\n-\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n-\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n-\t\tdate getnanos $junit_start)\\\"\"\n-\twrite_junit_xml \"$(printf '%s\\n' \\\n-\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n-\tjunit_have_testcase=t\n-}\n-\n-finalize_junit_xml () {\n-\tif test -n \"$write_junit_xml\" && test -n \"$junit_xml_path\"\n-\tthen\n-\t\ttest -n \"$junit_have_testcase\" || {\n-\t\t\tjunit_start=$(test-tool date getnanos)\n-\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n-\t\t}\n-\n-\t\t# adjust the overall time\n-\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n-\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n-\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n-\t\t\t-e '/^ *<\\/testsuite/d' \\\n-\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n-\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n-\n-\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n-\t\twrite_junit_xml=\n-\tfi\n-}\n-\n test_atexit_cleanup=:\n test_atexit_handler () {\n \t# In a succeeding test script 'test_atexit_handler' is invoked\n@@ -1247,7 +1170,7 @@ test_done () {\n \t# removed, so the commands can access pidfiles and socket files.\n \ttest_atexit_handler\n \n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \n \tif test -z \"$HARNESS_ACTIVE\"\n \tthen\n@@ -1538,22 +1461,7 @@ fi\n # in subprocesses like git equals our $PWD (for pathname comparisons).\n cd -P \"$TRASH_DIRECTORY\" || exit 1\n \n-if test -n \"$write_junit_xml\"\n-then\n-\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n-\tmkdir -p \"$junit_xml_dir\"\n-\tjunit_xml_base=${0##*/}\n-\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n-\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n-\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n-\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n-\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n-\tjunit_suite_start=$(test-tool date getnanos)\n-\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\tthen\n-\t\tGIT_TEST_TEE_OFFSET=0\n-\tfi\n-fi\n+start_test_output \"$0\"\n \n # Convenience\n # A regexp to match 5 and 35 hexdigits\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453559","messageId":"RFC-patch-v4-1.6-cc137c69ee1-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 1/6] ci: make it easier to find failed tests' logs in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:23Z","receivedAt":"2022-04-13T19:57:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhen investigating a test failure, the time that matters most is the\ntime it takes from getting aware of the failure to displaying the output\nof the failing test case.\n\nYou currently have to know a lot of implementation details when\ninvestigating test failures in the CI runs. The first step is easy: the\nfailed job is marked quite clearly, but when opening it, the failed step\nis expanded, which in our case is the one running\n`ci/run-build-and-tests.sh`. This step, most notably, only offers a\nhigh-level view of what went wrong: it prints the output of `prove`\nwhich merely tells the reader which test script failed.\n\nThe actually interesting part is in the detailed log of said failed\ntest script. But that log is shown in the CI run's step that runs\n`ci/print-test-failures.sh`. And that step is _not_ expanded in the web\nUI by default. It is even marked as \"successful\", which makes it very\neasy to miss that there is useful information hidden in there.\n\nLet's help the reader by showing the failed tests' detailed logs in the\nstep that is expanded automatically, i.e. directly after the test suite\nfailed.\n\nThis also helps the situation where the _build_ failed and the\n`print-test-failures` step was executed under the assumption that the\n_test suite_ failed, and consequently failed to find any failed tests.\n\nAn alternative way to implement this patch would be to source\n`ci/print-test-failures.sh` in the `handle_test_failures` function to\nshow these logs. However, over the course of the next few commits, we\nwant to introduce some grouping which would be harder to achieve that\nway (for example, we do want a leaner, and colored, preamble for each\nfailed test script, and it would be trickier to accommodate the lack of\nnested groupings in GitHub workflows' output).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml       | 20 ++++--------------\n ci/print-test-failures-github.sh | 35 ++++++++++++++++++++++++++++++++\n 2 files changed, 39 insertions(+), 16 deletions(-)\n create mode 100755 ci/print-test-failures-github.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 6d25ec4ae3b..e55dda807f0 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -129,11 +129,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -218,11 +214,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -265,10 +257,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success()\n-    - run: ci/print-test-failures.sh\n-      if: failure()\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -301,10 +291,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success() && matrix.vector.skip-tests != 'no'\n-    - run: ci/print-test-failures.sh\n-      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\ndiff --git a/ci/print-test-failures-github.sh b/ci/print-test-failures-github.sh\nnew file mode 100755\nindex 00000000000..218aaf19763\n--- /dev/null\n+++ b/ci/print-test-failures-github.sh\n@@ -0,0 +1,35 @@\n+#!/bin/sh\n+\n+. ${0%/*}/lib-ci-type.sh\n+\n+set -e\n+\n+case \"$CI_TYPE\" in\n+github-actions)\n+\thandle_failed_tests () {\n+\t\tmkdir -p t/failed-test-artifacts\n+\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n+\n+\t\tfor test_exit in t/test-results/*.exit\n+\t\tdo\n+\t\t\ttest 0 != \"$(cat \"$test_exit\")\" || continue\n+\n+\t\t\ttest_name=\"${test_exit%.exit}\"\n+\t\t\ttest_name=\"${test_name##*/}\"\n+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n+\t\t\tcat \"t/test-results/$test_name.out\"\n+\n+\t\t\ttrash_dir=\"t/trash directory.$test_name\"\n+\t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n+\t\t\ttar czf t/failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n+\t\tdone\n+\t\treturn 1\n+\t}\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n+\texit 1\n+\t;;\n+esac\n+\n+handle_failed_tests\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453560","messageId":"RFC-patch-v4-3.6-84c722969d5-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 3/6] test(junit): avoid line feeds in XML attributes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:25Z","receivedAt":"2022-04-13T19:57:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn the test case's output, we do want newline characters, but in the XML\nattributes we do not want them.\n\nHowever, the `xml_attr_encode` function always adds a Line Feed at the\nend (which are then encoded as `&#x0a;`, even for XML attributes.\n\nThis seems not to faze Azure Pipelines' XML parser, but it still is\nincorrect, so let's fix it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nindex 9d55d74d764..c959183c7e2 100644\n--- a/t/test-lib-junit.sh\n+++ b/t/test-lib-junit.sh\n@@ -50,7 +50,7 @@ finalize_test_case_output () {\n \t\t;;\n \tfailure)\n \t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode --no-lf \"$1\")\\\">\"\n \t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n \t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n \t\t\t   then\n@@ -74,12 +74,12 @@ finalize_test_case_output () {\n \t\tset \"$* (known breakage)\"\n \t\t;;\n \tskip)\n-\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tmessage=\"$(xml_attr_encode --no-lf \"$skipped_reason\")\"\n \t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n \t\t;;\n \tesac\n \n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode --no-lf \"$this_test.$test_count $1\")\\\"\"\n \tshift\n \tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n \tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n@@ -122,5 +122,11 @@ write_junit_xml () {\n }\n \n xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tif test \"x$1\" = \"x--no-lf\"\n+\tthen\n+\t\tshift\n+\t\tprintf '%s' \"$*\" | test-tool xml-encode\n+\telse\n+\t\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tfi\n }\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453561","messageId":"RFC-patch-v4-4.6-8acaa800d3a-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 4/6] ci: optionally mark up output in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:26Z","receivedAt":"2022-04-13T19:57:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA couple of commands exist to spruce up the output in GitHub workflows:\nhttps://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions\n\nIn addition to the `::group::<label>`/`::endgroup::` commands (which we\nalready use to structure the output of the build step better), we also\nuse `::error::`/`::notice::` to draw the attention to test failures and\nto test cases that were expected to fail but didn't.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh              |  4 +--\n t/test-lib-github-workflow-markup.sh | 50 ++++++++++++++++++++++++++++\n t/test-lib.sh                        |  5 ++-\n 3 files changed, 56 insertions(+), 3 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 93c03380d44..af4831a54c6 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -795,7 +795,7 @@ test_verify_prereq () {\n }\n \n test_expect_failure () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-failure\"\n@@ -815,7 +815,7 @@ test_expect_failure () {\n }\n \n test_expect_success () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-success\"\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nnew file mode 100644\nindex 00000000000..d8dc969df4a\n--- /dev/null\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -0,0 +1,50 @@\n+# Library of functions to mark up test scripts' output suitable for\n+# pretty-printing it in GitHub workflows.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when run in GitHub\n+# workflows; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\ttest -n \"$GIT_TEST_TEE_OUTPUT_FILE\" ||\n+\tdie \"--github-workflow-markup requires --verbose-log\"\n+\tgithub_markup_output=\"${GIT_TEST_TEE_OUTPUT_FILE%.out}.markup\"\n+\t>$github_markup_output\n+\tGIT_TEST_TEE_OFFSET=0\n+}\n+\n+# No need to override start_test_case_output\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tfailure)\n+\t\techo >>$github_markup_output \"::error::failed: $this_test.$test_count $1\"\n+\t\t;;\n+\tfixed)\n+\t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n+\t\t;;\n+\tesac\n+\techo >>$github_markup_output \"::group::$test_case_result: $this_test.$test_count $*\"\n+\ttest-tool >>$github_markup_output path-utils skip-n-bytes \\\n+\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\techo >>$github_markup_output \"::endgroup::\"\n+}\n+\n+# No need to override finalize_test_output\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 62a57b00730..8a63b4b64c9 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -204,6 +204,9 @@ parse_option () {\n \t--write-junit-xml)\n \t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n+\t--github-workflow-markup)\n+\t\t. \"$TEST_DIRECTORY/test-lib-github-workflow-markup.sh\"\n+\t\t;;\n \t--stress)\n \t\tstress=t ;;\n \t--stress=*)\n@@ -1081,7 +1084,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tstart_test_case_output\n+\tstart_test_case_output \"$@\"\n }\n \n test_finish_ () {\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453562","messageId":"RFC-patch-v4-6.6-b291f64821c-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 6/6] ci: call `finalize_test_case_output` a little later","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:28Z","receivedAt":"2022-04-13T19:57:50Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe used to call that function already before printing the final verdict.\nHowever, now that we added grouping to the GitHub workflow output, we\nwill want to include even that part in the collapsible group for that\ntest case.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 8a63b4b64c9..1ceba46215f 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -782,13 +782,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n+\tfinalize_test_case_output ok \"$@\"\n }\n \n test_failure_ () {\n-\tfinalize_test_case_output failure \"$@\"\n+\tfailure_label=$1\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -798,18 +798,19 @@ test_failure_ () {\n \t\tsay_color error \"1..$test_count\"\n \t\t_error_exit\n \tfi\n+\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n }\n \n test_known_broken_ok_ () {\n-\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n+\tfinalize_test_case_output fixed \"$@\"\n }\n \n test_known_broken_failure_ () {\n-\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n+\tfinalize_test_case_output broken \"$@\"\n }\n \n test_debug () {\n@@ -1135,10 +1136,10 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n+\t\tfinalize_test_case_output skip \"$@\"\n \t\t;;\n \t*)\n \t\tfalse\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453563","messageId":"RFC-patch-v4-5.6-4499f743dd1-20220413T195514Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v4 5/6] ci: use `--github-workflow-markup` in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-13T19:57:27Z","receivedAt":"2022-04-13T19:57:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n[Ævar: due to re-structuring on top of my series the {begin,end}_group\nin CI isn't needed at all to get \"group\" output for the test\nsuite. This commit includes the now-squashed \"ci/run-build-and-tests:\nadd some structure to the GitHub workflow output\":]\n\nThe current output of Git's GitHub workflow can be quite confusing,\nespecially for contributors new to the project.\n\nTo make it more helpful, let's introduce some collapsible grouping.\nInitially, readers will see the high-level view of what actually\nhappened (did the build fail, or the test suite?). To drill down, the\nrespective group can be expanded.\n\nNote: sadly, workflow output currently cannot contain any nested groups\n(see https://github.com/actions/runner/issues/802 for details),\ntherefore we take pains to ensure to end any previous group before\nstarting a new one.\n\n[Ævar: The above comment isn't true anymore, as that limitation has\nbeen removed by basing this on my patches to run \"make\" and \"make\ntest\" directly from the top-level of main.yml.\n\nThose are now effectively their own \"group\", effectively giving this\nstage another group \"level\" to use. This means that the equivalent of\n\"make test\" won't be on the same level as an individual test failure.\n\nWe no longer take any pains to ensure balanced group output as a\nresult (which was a caveat the previous ci/lib.sh implementation had\nto deal with., We just need to \"cat\" the generated *.markup]\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                        | 3 ++-\n ci/print-test-failures-github.sh | 2 +-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3fd5291bc80..718c3252789 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -145,7 +145,8 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n case \"$CI_TYPE\" in\n github-actions)\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n+\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\ndiff --git a/ci/print-test-failures-github.sh b/ci/print-test-failures-github.sh\nindex 218aaf19763..e432a601621 100755\n--- a/ci/print-test-failures-github.sh\n+++ b/ci/print-test-failures-github.sh\n@@ -17,7 +17,7 @@ github-actions)\n \t\t\ttest_name=\"${test_exit%.exit}\"\n \t\t\ttest_name=\"${test_name##*/}\"\n \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n-\t\t\tcat \"t/test-results/$test_name.out\"\n+\t\t\tcat \"t/test-results/$test_name.markup\"\n \n \t\t\ttrash_dir=\"t/trash directory.$test_name\"\n \t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n-- \n2.36.0.rc2.843.g193535c2aa7\n\n"},{"id":"453600","messageId":"xmqqh76w7ktb.fsf@gitster.g","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 00/29] CI: run \"make\" in CI \"steps\", improve UX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-13T21:08:48Z","receivedAt":"2022-04-13T21:08:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n>  * The rather minor in code but rather big in UX terms is that I've\n>    added 29/29, which explicitly documents and shows examples of using\n>    the CI tooling in a way where you can locally run a CI target as if\n>    though it were a given $jobname, e.g.:\n\nYay.\n\n>    Likewise the ci/print-test-failures.sh script can now be run\n>    locally without any extra mock-ups, e.g.:\n\nDouble yay.\n\n>     @@ ci/lib.sh\n>      +# Starting assertions\n>      +if test -z \"$jobname\"\n>      +then\n>     -+\techo \"must set a CI jobname\" >&2\n>     ++\techo \"must set a CI jobname in the environment\" >&2\n>      +\texit 1\n>      +fi\n\nOK.  In the truely-automated-machine-initiated run, this should not\nmatter, but once we start allowing end-user to interact with the\nguts of the CI machinery, being as helpful as possible matters.\n"},{"id":"453630","messageId":"CAPig+cRhRzPL7OHBPNnsXjqYeZudHiM+ntHWSGPiJTD7mvT+=Q@mail.gmail.com","threadId":"57451","inReplyTo":"patch-v3-07.29-cc81b9fe37e-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 07/29] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T06:17:18Z","receivedAt":"2022-04-14T06:17:32Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Apr 13, 2022 at 5:33 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\n> invocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\n> directional formatting, 2021-11-04).\n\ns/spaws/spawns/\n\n> This didn't matter for the GitHub CI, but does when running the check\n> locally. A subsequent commit will start invoking it via a new check\n> from the top-level Makefile, and without this we'd visibly spawn a\n> pager when doing so.\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"453631","messageId":"CAPig+cTP937Gr1acUuiot0Ra9M6RbrQuBDbdeeJeQAtf_oxeaw@mail.gmail.com","threadId":"57451","inReplyTo":"patch-v3-03.29-820c4e551d9-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 03/29] CI: remove more dead Travis CI support","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T06:18:56Z","receivedAt":"2022-04-14T06:19:12Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Apr 13, 2022 at 5:13 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\n> support, 2021-11-23). This code was only called from or used by the\n> now-removed .travis.yml, or needed by the Travis CI environment.\n>\n> For the symlinking in ci/run-build-and-tests.sh: Back when\n> 3c93b829205 (travis-ci: build Git during the 'script' phase,\n> 2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\n> a symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\n> would use ci/run-build-and-tests.sh.\n>\n> As seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n> 2020-04-11) the current windows build uses a different entry point\n> under the GitHub CI, which doesn't use this .prove caching. Namely\n> \"ci/run-test-slice.sh\".\n>\n> We can be certain that it's never used in \"ci/run-test-slice.sh\"\n> because to have a \".prove\" file we'd need to use \"--state=save\", which\n> we only do in the dead Azure codepath in ci/lib.sh. If it were used it\n> would do the wrong thing, because the different test slices would each\n> try to clobber the same \"t/.prove\" file.\n>\n> If a subsequent run then used the -\"-state=failed,slow,save\" it would\n\ns/-\"-/--\"/\n\n> defeat the purpose of \"ci/run-test-slice.sh\", since all slices would\n> then run all tests. I.e. behavior of prove's \"--state\" options is to\n> select tests to run from the provided \"--state\" file, in addition to\n> those specified on the command-line.\n>\n> For ci/run-docker{,-build}.sh: It was likewise last referenced in the\n> .travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n> \".github/workflows/main.yml\" calls the same entry points as the main\n> \"regular\" job.\n>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"453632","messageId":"407028e3-ea88-a396-2d00-d7bf5977ba20@sunshineco.com","threadId":"57451","inReplyTo":"patch-v3-13.29-13feda050c0-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 13/29] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T06:46:09Z","receivedAt":"2022-04-14T06:46:30Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On 4/13/22 3:51 PM, Ævar Arnfjörð Bjarmason wrote:\n> Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\n> instead make the CI run \"make\" or \"make test\" directly. By doing this\n> we'll be able to easily see at a glance whether our failure was in the\n> compilation or testing, whether that's via human eyes or improve\n> machine readability.\n> \n> We also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\n> success() in the CI now, just like we already had a step conditional\n> on failure() running ci/print-test-failures.sh.\n> \n> The reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\n> place had to do with Travis CI-specific constraints that no longer\n> apply to us, as the Travis CI support has been removed.\n> \n> Instead we can configure the CI in an earlier step by running\n> \"ci/lib.sh\", which under GitHub CI will write the environment\n> variables we need to the \"$GITHUB_ENV\" file.\n> \n> We'll then have access to them in subsequent steps, and crucially\n> those variables will be prominently visible at the start of each step\n> via an expandable drop-down in the UI.drop-do.\n> \n> I.e. this changes the CI run from a top-down flow like (pseudocode):\n> \n>   - job:\n>     - step1:\n>       - use ci/lib.sh to set env vars\n>       - run a script like ci/run-build-and-tests.sh\n>     - step2:\n>       - if: failure()\n>       - use ci/lib.sh to set env vars\n>       - run ci/print-test-failures.sh\n> \n> To:\n> \n>   - job:\n>     - step1:\n>       - set variables in $GITHUB_ENV using ci/lib.sh\n>     - step2:\n>       - make\n>     - step3:\n>       - make test\n>     - step4:\n>       - if: failure()\n>       - run ci/print-test-failures.sh\n>     - step5:\n>       - if: success()\n>       - run ci/check-unignored-build-artifacts.sh\n> \n> There is a proposal[2] to get some of the benefits of this approach by\n> not re-arranging our variable setup in this way, but to instead use\n> the GitHub CI grouping syntax to focus on the relevant parts of \"make\"\n> or \"make test\" when we have failures.\n> \n> Doing it this way makes for better looking GitHub CI UI, and lays much\n> better ground work for our CI going forward. Because:\n> \n>   * The CI logic will be more portable to a future CI system, since a\n>     common feature of them is to run various commands in sequence, but\n>     a future system won't necessarily support the GitHub-specifics\n>     syntax of \"grouping\" output within a \"step\".\n> \n>     Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n>     be much easier than to deal with some CI-specific grouping syntax.\n> \n>   * At the start of every step the GitHub CI presents an expandable\n>     list of environment variables from \"$GITHUB_ENV\". We'll now see\n>     exactly what variables affected that step (although we currently\n>     overshoot that a bit, and always define all variables).\n> \n>   * CI failures will be easier to reproduce locally, as this makes the\n>     relevant ci/* scripts something that sets up our environment, but\n>     leaves \"make\" and \"make test\" working as they do locally.\n> \n>     To reproduce a run the user only needs to set the variables\n>     discussed in the drop-down above, either manually or by running\n>     \"ci/lib.sh\".\n> \n>   * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n>     -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n>     40 lines of trace output, culminating in using \"export\" to export\n>     the relevant environment variables.\n> \n>     Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n>     any subsequent one. The \"make\" targets then start out with the\n>     relevant output non-trace output right away.\n\ns/output non-trace output/non-trace output/\n\n>   * If we do want to use the grouping syntax within a \"step\" it'll now\n>     be easier to do so. It doesn't support nesting, so we'd have to\n>     make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n>     individual test failures. See \"sadly\" in [3].\n> \n> 1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n> 2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n> 3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\n"},{"id":"453633","messageId":"46b7dcdd-0c08-54ed-b8aa-22cf10d21e2f@sunshineco.com","threadId":"57451","inReplyTo":"patch-v3-17.29-8837bfa5433-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 17/29] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T06:51:07Z","receivedAt":"2022-04-14T06:51:13Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On 4/13/22 3:51 PM, Ævar Arnfjörð Bjarmason wrote:\n> Change the \"ci/test-documentation.sh\" script to run the bash-specific\n> parts in as one command in the CI job itself, and to run the two \"make\n> doc\" commands at the top-level.\n> \n> It'll now be obvious from the title of the step if if we failed in the\n> asciidoc or asciidoctor step.\n\ns/if if/if/\n\n> Since the \"check_unignored_build_artifacts()\" function is now only\n> used in \"ci/check-unignored-build-artifacts.sh\" move that function\n> there.\n> \n> The recipe for the job in \".github/workflows/main.yml\" is now a bit\n> verbose because it's effectively the same job twice, with a \"make\n> clean\" in-between. It would be better for the verbosity to run it via\n> a matrix as done in the alternate approach in [1] does, but then we'd\n> sacrifice overall CPU time for the brevity. It might still be worth\n> doing, but let's go for this simpler approach for now.\n> \n> 1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n\n"},{"id":"453639","messageId":"5e828906-964f-c328-6142-2fa05eaf596a@sunshineco.com","threadId":"57451","inReplyTo":"patch-v3-25.29-1268792233f-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T07:38:51Z","receivedAt":"2022-04-14T07:39:00Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On 4/13/22 3:51 PM, Ævar Arnfjörð Bjarmason wrote:\n> Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\n> picked up in ci/lib.sh let's instead have ci/lib.sh itself add it\n> directly to MAKEFLAGS.\n> \n> Setting CC=gcc by default made for confusing trace output, and since a\n> preceding change to carry it and others over across \"steps\" in the\n> GitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\n> confusingly has CC=gcc set, even though it builds with MSVC.\n> \n> Let's instead reply on the Makefile default of CC=cc, and only\n> override it for those jobs where it's needed. This does mean that\n> we'll need to set it for the \"pedantic\" job, which previously relied\n> on the default CC=gcc in case \"clang\" become the default on that\n> platform.\n\ns/reply/rely/\n\n> This partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n> \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n> aiming to only set those variables specific jobs need.\n> \n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n"},{"id":"453642","messageId":"214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com","threadId":"57451","inReplyTo":"patch-v3-29.29-2e3c02fa0df-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 29/29] CI: make it easy to use ci/*.sh outside of CI","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-14T08:00:46Z","receivedAt":"2022-04-14T08:00:52Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On 4/13/22 3:51 PM, Ævar Arnfjörð Bjarmason wrote:\n > In preceding commits the ci/.sh scripts have lost most of their\n > CI-specific assumptions. Let's go even further and explicitly support\n > running ci/lib.sh outside of CI.\n >\n > This was possible before by faking up enough CI-specific variables,\n > but as shown in the new \"help\" output being added here using the\n > ci/lib.sh to provide \"CI-like\" has now become trivial.\n >\n > The ci/print-test-failures.sh scripts can now be used outside of CI as\n > well, the only GitHub CI-specific part is now guarded by a check that\n > we'll pass if outside of GitHub CI.\n >\n > There's also a special-case here to not clobber $MAKEFLAGS in the\n > environment if we're outside of CI, in case the user has e.g. \"jN\" or\n > other flags to \"make\" that they'd prefer configured already.\n >\n > Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n > ---\n > diff --git a/ci/lib.sh b/ci/lib.sh\n > @@ -1,6 +1,30 @@\n > +#  Usage\n > +CI_TYPE_HELP_COMMANDS='\n > +\t# run \"make all test\" like the \"linux-leaks\" job\n > +\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n > +\n > +\t# run \"make all test\" like the \"linux-musl\" job\n > +\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n > +\n > +\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various \nGIT_TEST_* modes)\n > +\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n > +\n > +\t# run \"make test\" like the \"linux-sha256\" job\n > +\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n > +'\n > +\n > +CI_TYPE_HELP=\"\n > +running $0 outside of CI? You can use ci/lib.sh to set up your\n > +environment like a given CI job. E.g.:\n > +$CI_TYPE_HELP_COMMANDS\n > +\n > +note that some of these (e.g. the linux-musl one) may not work as\n > +expected due to the CI job configuring a platform that may not match\n > +yours.\"\n > +\n > @@ -9,6 +33,10 @@ mode=$1\n >   if test -z \"$mode\"\n >   then\n >   \techo \"need a $0 mode, e.g. --build or --test\" >&2\n > +\tif test -z \"$CI_TYPE\"\n > +\tthen\n > +\t\techo \"$CI_TYPE_HELP\" >&2\n > +\tfi\n >   \texit 1\n >   fi\n\nIt would never occur to me to try running a script named ci/lib.sh in\nthe first place, and I'm not sure I would even think to poke around in\nthe `ci` directory with the idea of being able to run CI tasks\nlocally. Would it make sense to aid discovery by mentioning this new\nfeature in the \"GitHub CI\" section of SubmittingPatches as a follow up\nto this series? (If so, perhaps the \"GitHub CI\" section should be\nrenamed to \"CI\".)\n\n > @@ -76,10 +108,29 @@ CC_PACKAGE=\n >   # How many jobs to run in parallel?\n >   NPROC=10\n > +case \"$CI_TYPE\" in\n > +'')\n > +\tif command -v nproc >/dev/null\n\nYou need to redirect stderr too in order to avoid a scary error\nmessage on platforms lacking `nproc`:\n\n     if command -v nproc >/dev/null 2>&1\n\n > +\tthen\n > +\t\tNPROC=$(nproc)\n > +\telse\n > +\t\tNPROC=1\n > +\tfi\n\nNeither macOS nor BSD has an `nproc` command, however, they do have\n`sysctl`:\n\n     elif command -v sysctl >/dev/null 2>&1\n     then # macOS & BSD\n         NPROC=$(sysctl -n hw.ncpu 2>/dev/null)\n\nand Windows provides a suitable environment variable:\n\n     elif test -n \"$NUMBER_OF_PROCESSORS\"\n     then # Windows\n         NPROC=\"$NUMBER_OF_PROCESSORS\"\n\n > +\tif test -n \"$MAKEFLAGS\"\n > +\tthen\n > +\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n > +\telse\n > +\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n > +\tfi\n > +\t;;\n\n"},{"id":"453648","messageId":"xmqq35ig2c6l.fsf@gitster.g","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"Re: [RFC PATCH v4 0/6] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-14T10:26:26Z","receivedAt":"2022-04-14T10:26:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> 6:  1d2b94436fc ! 6:  b291f64821c ci: call `finalize_test_case_output` a little later\n>     @@ t/test-lib.sh: trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n>       \ttest_failure=$(($test_failure + 1))\n>       \tsay_color error \"not ok $test_count - $1\"\n>       \tshift\n>     - \tprintf '%s\\n' \"$*\" | sed -e 's/^/#\t/'\n>     - \ttest \"$immediate\" = \"\" || _error_exit\n>     +@@ t/test-lib.sh: test_failure_ () {\n>     + \t\tsay_color error \"1..$test_count\"\n>     + \t\t_error_exit\n>     + \tfi\n>      +\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n>       }\n\nThis part, specifically the following from [6/6], looks iffy.  \n\n@@ -782,13 +782,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n+\tfinalize_test_case_output ok \"$@\"\n }\n \n test_failure_ () {\n-\tfinalize_test_case_output failure \"$@\"\n+\tfailure_label=$1\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -798,18 +798,19 @@ test_failure_ () {\n \t\tsay_color error \"1..$test_count\"\n \t\t_error_exit\n \tfi\n+\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n }\n \n\n\nWith the other 29-patch series applied on the same base as before,\ntest_failure_ does not have such \"fi\" inside.  Misapplication of\nrebase or something?\n\nIn any case, I've wiggled both series in and rebuilt 'seen'.\nLooking good as before.\n\nThanks.\n\n"},{"id":"453649","messageId":"220414.86tuavde26.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"xmqq35ig2c6l.fsf@gitster.g","subject":"Re: [RFC PATCH v4 0/6] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-14T12:47:30Z","receivedAt":"2022-04-14T12:50:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Apr 14 2022, Junio C Hamano wrote:\n\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> 6:  1d2b94436fc ! 6:  b291f64821c ci: call `finalize_test_case_output` a little later\n>>     @@ t/test-lib.sh: trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n>>       \ttest_failure=$(($test_failure + 1))\n>>       \tsay_color error \"not ok $test_count - $1\"\n>>       \tshift\n>>     - \tprintf '%s\\n' \"$*\" | sed -e 's/^/#\t/'\n>>     - \ttest \"$immediate\" = \"\" || _error_exit\n>>     +@@ t/test-lib.sh: test_failure_ () {\n>>     + \t\tsay_color error \"1..$test_count\"\n>>     + \t\t_error_exit\n>>     + \tfi\n>>      +\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n>>       }\n>\n> This part, specifically the following from [6/6], looks iffy.  \n>\n> @@ -782,13 +782,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n>  # the test_expect_* functions instead.\n>  \n>  test_ok_ () {\n> -\tfinalize_test_case_output ok \"$@\"\n>  \ttest_success=$(($test_success + 1))\n>  \tsay_color \"\" \"ok $test_count - $@\"\n> +\tfinalize_test_case_output ok \"$@\"\n>  }\n>  \n>  test_failure_ () {\n> -\tfinalize_test_case_output failure \"$@\"\n> +\tfailure_label=$1\n>  \ttest_failure=$(($test_failure + 1))\n>  \tsay_color error \"not ok $test_count - $1\"\n>  \tshift\n> @@ -798,18 +798,19 @@ test_failure_ () {\n>  \t\tsay_color error \"1..$test_count\"\n>  \t\t_error_exit\n>  \tfi\n> +\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n>  }\n>  \n>\n>\n> With the other 29-patch series applied on the same base as before,\n> test_failure_ does not have such \"fi\" inside.  Misapplication of\n> rebase or something?\n\nThis re-submission was rebased on \"master\", so that \"fi\" in the context\nis from the now-landed ab/test-tap-fix-for-immediate.\n\nI saw you'd fixed that conflict already, but figured rebasing before\nsubmission (as usual) would be helpful anyway, sorry about the\nconfusion.\n\n> In any case, I've wiggled both series in and rebuilt 'seen'.\n> Looking good as before.\n\nThanks, the end-state of the resolution looks good, and matches what I\nhave locally.\n"},{"id":"453651","messageId":"220414.86pmljday2.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com","subject":"Re: [PATCH v3 29/29] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-14T13:51:30Z","receivedAt":"2022-04-14T14:43:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Apr 14 2022, Eric Sunshine wrote:\n\n> On 4/13/22 3:51 PM, Ævar Arnfjörð Bjarmason wrote:\n>> In preceding commits the ci/.sh scripts have lost most of their\n>> CI-specific assumptions. Let's go even further and explicitly support\n>> running ci/lib.sh outside of CI.\n>>\n>> This was possible before by faking up enough CI-specific variables,\n>> but as shown in the new \"help\" output being added here using the\n>> ci/lib.sh to provide \"CI-like\" has now become trivial.\n>>\n>> The ci/print-test-failures.sh scripts can now be used outside of CI as\n>> well, the only GitHub CI-specific part is now guarded by a check that\n>> we'll pass if outside of GitHub CI.\n>>\n>> There's also a special-case here to not clobber $MAKEFLAGS in the\n>> environment if we're outside of CI, in case the user has e.g. \"jN\" or\n>> other flags to \"make\" that they'd prefer configured already.\n>>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>> diff --git a/ci/lib.sh b/ci/lib.sh\n>> @@ -1,6 +1,30 @@\n>> +#  Usage\n>> +CI_TYPE_HELP_COMMANDS='\n>> +\t# run \"make all test\" like the \"linux-leaks\" job\n>> +\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n>> +\n>> +\t# run \"make all test\" like the \"linux-musl\" job\n>> +\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n>> +\n>> +\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various\n>   GIT_TEST_* modes)\n>> +\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n>> +\n>> +\t# run \"make test\" like the \"linux-sha256\" job\n>> +\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n>> +'\n>> +\n>> +CI_TYPE_HELP=\"\n>> +running $0 outside of CI? You can use ci/lib.sh to set up your\n>> +environment like a given CI job. E.g.:\n>> +$CI_TYPE_HELP_COMMANDS\n>> +\n>> +note that some of these (e.g. the linux-musl one) may not work as\n>> +expected due to the CI job configuring a platform that may not match\n>> +yours.\"\n>> +\n>> @@ -9,6 +33,10 @@ mode=$1\n>>   if test -z \"$mode\"\n>>   then\n>>   \techo \"need a $0 mode, e.g. --build or --test\" >&2\n>> +\tif test -z \"$CI_TYPE\"\n>> +\tthen\n>> +\t\techo \"$CI_TYPE_HELP\" >&2\n>> +\tfi\n>>   \texit 1\n>>   fi\n>\n> It would never occur to me to try running a script named ci/lib.sh in\n> the first place, and I'm not sure I would even think to poke around in\n> the `ci` directory with the idea of being able to run CI tasks\n> locally. Would it make sense to aid discovery by mentioning this new\n> feature in the \"GitHub CI\" section of SubmittingPatches as a follow up\n> to this series? (If so, perhaps the \"GitHub CI\" section should be\n> renamed to \"CI\".)\n\nYes, I'd like to do that, but as a follow-up, specifically to have\nfailing tests in CI suggest a way to run them locally.\n\nIt would be better as ci/config.sh or something, but it was ci/lib.sh\nalready, and this way minimized the diff/conflicts.\n\n>> @@ -76,10 +108,29 @@ CC_PACKAGE=\n>>   # How many jobs to run in parallel?\n>>   NPROC=10\n>> +case \"$CI_TYPE\" in\n>> +'')\n>> +\tif command -v nproc >/dev/null\n>\n> You need to redirect stderr too in order to avoid a scary error\n> message on platforms lacking `nproc`:\n>\n>     if command -v nproc >/dev/null 2>&1\n\nI figured the scary error would be useful, it's only if you run it\nad-hoc, so it would be a nice hint as to why we fallback on the default\nnproc.\n\n>> +\tthen\n>> +\t\tNPROC=$(nproc)\n>> +\telse\n>> +\t\tNPROC=1\n>> +\tfi\n>\n> Neither macOS nor BSD has an `nproc` command, however, they do have\n> `sysctl`:\n>\n>     elif command -v sysctl >/dev/null 2>&1\n>     then # macOS & BSD\n>         NPROC=$(sysctl -n hw.ncpu 2>/dev/null)\n>\n> and Windows provides a suitable environment variable:\n>\n>     elif test -n \"$NUMBER_OF_PROCESSORS\"\n>     then # Windows\n>         NPROC=\"$NUMBER_OF_PROCESSORS\"\n\n*nod*\n\nI'd rather not finish this part up though and instead just have this\ncall some moral equivalent of t/helper/test-online-cpus.c.\n\nMost of our CI is linux, so just nproc for now felt like a good initial\naddition which we could expand on later.\n\n>> +\tif test -n \"$MAKEFLAGS\"\n>> +\tthen\n>> +\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n>> +\telse\n>> +\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n>> +\tfi\n>> +\t;;\n\n"},{"id":"453663","messageId":"xmqqzgknzff2.fsf@gitster.g","threadId":"57451","inReplyTo":"220414.86tuavde26.gmgdl@evledraar.gmail.com","subject":"Re: [RFC PATCH v4 0/6] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-14T18:30:09Z","receivedAt":"2022-04-14T18:30:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n>> With the other 29-patch series applied on the same base as before,\n>> test_failure_ does not have such \"fi\" inside.  Misapplication of\n>> rebase or something?\n>\n> This re-submission was rebased on \"master\", so that \"fi\" in the context\n> is from the now-landed ab/test-tap-fix-for-immediate.\n>\n> I saw you'd fixed that conflict already, but figured rebasing before\n> submission (as usual) would be helpful anyway, sorry about the\n> confusion.\n>\n>> In any case, I've wiggled both series in and rebuilt 'seen'.\n>> Looking good as before.\n>\n> Thanks, the end-state of the resolution looks good, and matches what I\n> have locally.\n\nOK, I guessed that much.\n\nIt may be OK for a topic to be rebased to an updated 'master' when\nit is not close to be merged to 'next', but I prefer to see a reroll\nto keep the same base, unless the new round starts depending on the\nnew base in a way more than just textually (i.e. e.g. wants to use a\nnew API function), as that makes it easier to read the comparison\nwith the previous round because a reasonably looking range-diff may\nnot necessarily mean that a patch that hasn't changed much from the\nprevious round would fit well inside the updated context.  This is\nespecially true for a series on the large-ish side, as I cannot\ntrust range-diff for an rebased series as much as I can for an\nupdate on the same base.\n\nThis time, I tried to queue the new ones on updated 'master' and\nthen compared it with the result of merging the ones that I wriggled\nto apply to the same base to the same updated 'master' to make sure\nthe end result is the same while I was working on making them apply\nbefore I sent the message you are responding to, so I am reasonably\nhappy with the result.\n\nIt may not be a bad idea, as we are in pre-release freeze anyway,\nfor me to discard the two topics and replace them with a fresh\napplication of the same version on top of 'master', as we have\nalready verified that the updates from the previous iteration look\nreasonable, to prepare for post-release (either merging to 'next' or\ntaking another reroll).\n\nThanks.\n"},{"id":"453677","messageId":"CAPUEspjT23rqBwkgARf90me1n0dd4pjS4i+ya=Vo=xCBCTjp4g@mail.gmail.com","threadId":"57451","inReplyTo":"patch-v3-25.29-1268792233f-20220413T194847Z-avarab@gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2022-04-15T02:21:56Z","receivedAt":"2022-04-15T02:22:12Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Wed, Apr 13, 2022 at 12:52 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> @@ -160,13 +169,23 @@ linux-TEST-vars)\n>         setenv --test GIT_TEST_WRITE_REV_INDEX 1\n>         setenv --test GIT_TEST_CHECKOUT_WORKERS 2\n>         ;;\n> +osx-gcc)\n> +       CC=gcc\n> +       CC_PACKAGE=gcc-9\n\nnot sure when this was broken since there were too many refactorings\naround this code, but this is definitely wrong.\n\nmacos' gcc is really clang, so if we really want to build with gcc\ninstead (and there are 9, 10 and 11 versions installed) need to use\ninstead (for version 9, which was what was used originally and what\nCC_PACKAGE was installing if needed)\n\nCC=gcc-9\n\nRight now both macos jobs are using clang, regardless of what the\nnicely named label says.\n\nCarlo\n"},{"id":"453704","messageId":"220415.86k0bqbgin.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"CAPUEspjT23rqBwkgARf90me1n0dd4pjS4i+ya=Vo=xCBCTjp4g@mail.gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-15T13:47:22Z","receivedAt":"2022-04-15T13:52:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Thu, Apr 14 2022, Carlo Arenas wrote:\n\n> On Wed, Apr 13, 2022 at 12:52 PM Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n>> @@ -160,13 +169,23 @@ linux-TEST-vars)\n>>         setenv --test GIT_TEST_WRITE_REV_INDEX 1\n>>         setenv --test GIT_TEST_CHECKOUT_WORKERS 2\n>>         ;;\n>> +osx-gcc)\n>> +       CC=gcc\n>> +       CC_PACKAGE=gcc-9\n>\n> not sure when this was broken since there were too many refactorings\n> around this code, but this is definitely wrong.\n>\n> macos' gcc is really clang, so if we really want to build with gcc\n> instead (and there are 9, 10 and 11 versions installed) need to use\n> instead (for version 9, which was what was used originally and what\n> CC_PACKAGE was installing if needed)\n>\n> CC=gcc-9\n>\n> Right now both macos jobs are using clang, regardless of what the\n> nicely named label says.\n\nI didn't know gcc on OSX was clang, that does seem broken.\n\nBut unless I'm missing something that's already been the case on\n\"master\" for a while, i.e. this is the master run showing that we'll\ninvoke \"gcc\":\nhttps://github.com/git/git/runs/6031562726?check_suite_focus=true#step:3:6\n\nAnd \"seen\", with this change, which shows that we'll do the same:\nhttps://github.com/git/git/runs/6031564900?check_suite_focus=true#step:5:7\n\nIf I understand you correctly both are effectively a NOOP and we don't\nuse that \"gcc-9\", but we should.\n\nIt looks like it was broken in my 707d2f2fe86 (CI: use \"$runs_on_pool\",\nnot \"$jobname\" to select packages & config, 2021-11-23).\n\nI'll fix that as along with any small follow-ups after this series,\nsound good?\n"},{"id":"453715","messageId":"xmqqmtgme0zh.fsf@gitster.g","threadId":"57451","inReplyTo":"220415.86k0bqbgin.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-15T16:59:46Z","receivedAt":"2022-04-15T16:59:53Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> I'll fix that as along with any small follow-ups after this series,\n> sound good?\n\nWithout any small follow-ups would be much much more preferrrable,\nand leave the follow-up to a separate series.\n\nA series doing too many things at once can mix bad apples slip in by\noverwhelming the reviewer bandwidth, and I am afraid that it may be\nwhat happened in the original \"bunch of Makefile updates\" that the\nbug originated from.  I am guessing that Carlo meant the same when\nhe said \"since there were too many refactorings around this code\".\n\nThanks.\n"},{"id":"453719","messageId":"CAPUEspiE3HBkkBzNgz8Gb6=fc2NPnfbGzzn2SEiGGG+zVo9DLA@mail.gmail.com","threadId":"57451","inReplyTo":"220415.86k0bqbgin.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2022-04-15T19:03:57Z","receivedAt":"2022-04-15T19:04:17Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Fri, Apr 15, 2022 at 6:52 AM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n>\n> But unless I'm missing something that's already been the case on\n> \"master\" for a while, i.e. this is the master run showing that we'll\n> invoke \"gcc\":\n> https://github.com/git/git/runs/6031562726?check_suite_focus=true#step:3:6\n\nThat would be unfortunate, considering the code in next (and all other\nnot yet affected) branches still has the definition added in\n176441bfb58 (ci: build Git with GCC 9 in the 'osx-gcc' build job,\n2019-11-27) and which survived your travis-ci removal series.\n\nNote that the value of CC is only relevant when the code is built, and\nGitHub actions provides its own for all tasks and at least this \"mock\"\nrun (which adds `$CC --version` before make) with next seems to\nindicate the right compiler is still being used there and hopefully\nalso in all other unaffected runs from all stable branches:\n\n  https://github.com/carenas/git/runs/6041742809\n\nEitherway, making sure that we really use gcc in the jobs that are\ntagged as such will make these extra runs (and their additional CPU\ntime) less wasteful and should be corrected ASAP.\n\nCarlo\n"},{"id":"453721","messageId":"CAPUEspgWTk0wjmomo2g9TVHZny7stCt=B8D=HA2=gk_SEC5vnQ@mail.gmail.com","threadId":"57451","inReplyTo":"CAPUEspiE3HBkkBzNgz8Gb6=fc2NPnfbGzzn2SEiGGG+zVo9DLA@mail.gmail.com","subject":"Re: [PATCH v3 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2022-04-15T20:28:54Z","receivedAt":"2022-04-15T20:29:10Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Fri, Apr 15, 2022 at 12:03 PM Carlo Arenas <carenas@gmail.com> wrote:\n>\n> On Fri, Apr 15, 2022 at 6:52 AM Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n> >\n> > But unless I'm missing something that's already been the case on\n> > \"master\" for a while, i.e. this is the master run showing that we'll\n> > invoke \"gcc\":\n> > https://github.com/git/git/runs/6031562726?check_suite_focus=true#step:3:6\n>\n> That would be unfortunate, considering the code in next (and all other\n> not yet affected) branches still have the definition added in\n> 176441bfb58 (ci: build Git with GCC 9 in the 'osx-gcc' build job,\n> 2019-11-27) and which survived your travis-ci removal series.\n\nNevermind, my test was flawed, this[1] updated run does show this code\nwas indeed refactored away and the bug also introduced to next and\nbeyond.\n\nCarlo\n\n[1] https://github.com/carenas/git/runs/6042506530\n"},{"id":"453816","messageId":"patch-v4-01.31-ed27ca0b7e7-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 01/31] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:38Z","receivedAt":"2022-04-18T16:29:18Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cbc2f8f1caa..57141d38a85 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453817","messageId":"patch-v4-02.31-737fe1e2c4c-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 02/31] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:39Z","receivedAt":"2022-04-18T16:29:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57141d38a85..5fda166ad47 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"must set a CI jobname in the environment\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453818","messageId":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v3-00.29-00000000000-20220413T194847Z-avarab@gmail.com","subject":"[PATCH v4 00/31] CI: run \"make\" in CI \"steps\", improve UX","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:37Z","receivedAt":"2022-04-18T16:29:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This series changes CI \"step\" targets that are shellscripts that do N\nthings to instead be single command invocations at the \"step\" level,\ndriven by the CI recipe itself.\n\nTo do that we need to pass state that we previously re-setup for every\n\"step\" via $GITHUB_ENV, whose state we then helpfully show (this is just\na standard GitHub CI feature) in a drop-down at the start of every\n\"step\".\n\nI.e. at the tip of this series you can reliably look at that\n$GITHUB_ENV view to see what the full and relevant environment was for\nthat \"make\", \"make test\" or whatever.\n\nChanges since v3:\n\n * Typo/grammar fixes pointed out by Eric Sunshine\n\n * The ci/print-test-failures.sh scripts still had some dead Travis\n   code (noticed while re-rolling). Removed it, and squashed into the\n   travis removal commit.\n\n * Split up the part of \"CI: combine\n   ci/install{,-docker}-dependencies.sh\" that was replacing bash\n   constructs with POSIX ones into a preceding commit doing only that.\n\n * There was a regression in \"CI: set CC in MAKEFLAGS directly, don't\n   add it to the environment\" where we didn't properly install the\n   right CI package. The whole CC_PACKAGE is now contained within\n   \"ci/install-dependencies.sh\".\n\n * In addition to the regression Carlo noted already on \"master\" where\n   the osx-gcc job is using clang. That's now fixed in a new \"CI: have\n   osx-gcc use gcc, not clang\".\n\n * Extend the last commit to have an \"nproc\" on BSD/OSX/Windows too,\n   this is only for the case of ad-hoc running ci/lib.sh locally.\n\nÆvar Arnfjörð Bjarmason (31):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: make \"$jobname\" explicit, remove fallback\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: remove unused Azure ci/* code\n  CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n  CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n  ci/lib.sh: use \"test\" instead of \"[\"\n  CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n  CI: invoke \"make artifacts-tar\" directly in windows-build\n  CI: split up and reduce \"ci/test-documentation.sh\"\n  CI: make ci/install-dependencies.sh POSIX-compatible\n  CI: combine ci/install{,-docker}-dependencies.sh\n  CI: move \"env\" definitions into ci/lib.sh\n  ci/run-test-slice.sh: replace shelling out with \"echo\"\n  CI: pre-select test slice in Windows & VS tests\n  CI: only invoke ci/lib.sh as \"steps\" in main.yml\n  CI: narrow down variable definitions in --build and --test\n  CI: add more variables to MAKEFLAGS, except under vs-build\n  CI: set CC in MAKEFLAGS directly, don't add it to the environment\n  CI: set SANITIZE=leak in MAKEFLAGS directly\n  CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n  CI: don't use \"set -x\" in \"ci/lib.sh\" output\n  CI: have osx-gcc use gcc, not clang\n  CI: make it easy to use ci/*.sh outside of CI\n\n .github/workflows/main.yml            | 100 ++++---\n Makefile                              |  31 ++-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  74 ++++-\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |   6 +\n ci/lib-online_cpus.sh                 |  26 ++\n ci/lib-tput.sh                        |   5 +\n ci/lib.sh                             | 379 +++++++++++++++-----------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  53 +---\n ci/run-build-and-tests.sh             |  54 ----\n ci/run-docker-build.sh                |  66 -----\n ci/run-docker.sh                      |  47 ----\n ci/run-static-analysis.sh             |  32 ---\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  10 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ----\n shared.mak                            |   1 +\n 22 files changed, 453 insertions(+), 616 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-online_cpus.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff against v3:\n 1:  3cb4749c5ea =  1:  ed27ca0b7e7 CI: run \"set -ex\" early in ci/lib.sh\n 2:  7de95ff437e =  2:  737fe1e2c4c CI: make \"$jobname\" explicit, remove fallback\n 3:  820c4e551d9 !  3:  d875069fc28 CI: remove more dead Travis CI support\n    @@ Commit message\n         would do the wrong thing, because the different test slices would each\n         try to clobber the same \"t/.prove\" file.\n     \n    -    If a subsequent run then used the -\"-state=failed,slow,save\" it would\n    +    If a subsequent run then used the \"--state=failed,slow,save\" it would\n         defeat the purpose of \"ci/run-test-slice.sh\", since all slices would\n         then run all tests. I.e. behavior of prove's \"--state\" options is to\n         select tests to run from the provided \"--state\" file, in addition to\n    @@ Commit message\n         \".github/workflows/main.yml\" calls the same entry points as the main\n         \"regular\" job.\n     \n    +    For \"ci/print-test-failures.sh\" the creation of the tarball added in\n    +    aea8879a6ac (travis-ci: include the trash directories of failed tests\n    +    in the trace log, 2018-08-01) has been dead since my 4a6e4b96026,\n    +    which removed the fall-through case from the \"case/esac\" statement.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    @@ ci/lib.sh: then\n      \techo \"Could not identify CI type\" >&2\n     \n      ## ci/print-test-failures.sh ##\n    -@@ ci/print-test-failures.sh: do\n    - \t\t\tfi\n    - \t\t\tcombined_trash_size=$new_combined_trash_size\n    +@@ ci/print-test-failures.sh: then\n    + \texit\n    + fi\n      \n    +-case \"$jobname\" in\n    +-osx-clang|osx-gcc)\n    +-\t# base64 in OSX doesn't wrap its output at 76 columns by\n    +-\t# default, but prints a single, very long line.\n    +-\tbase64_opts=\"-b 76\"\n    +-\t;;\n    +-esac\n    +-\n    +-combined_trash_size=0\n    + for TEST_EXIT in test-results/*.exit\n    + do\n    + \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n    +@@ ci/print-test-failures.sh: do\n    + \t\tazure-pipelines)\n    + \t\t\tmkdir -p failed-test-artifacts\n    + \t\t\tmv \"$trash_dir\" failed-test-artifacts\n    +-\t\t\tcontinue\n    + \t\t\t;;\n    + \t\tgithub-actions)\n    + \t\t\tmkdir -p failed-test-artifacts\n    + \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n    + \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n    + \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n    +-\t\t\tcontinue\n    + \t\t\t;;\n    + \t\t*)\n    + \t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n    + \t\t\texit 1\n    + \t\t\t;;\n    + \t\tesac\n    +-\t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n    +-\t\tif [ -d \"$trash_dir\" ]\n    +-\t\tthen\n    +-\t\t\ttar czp \"$trash_dir\" |base64 $base64_opts >\"$trash_tgz_b64\"\n    +-\n    +-\t\t\ttrash_size=$(wc -c <\"$trash_tgz_b64\")\n    +-\t\t\tif [ $trash_size -gt 1048576 ]\n    +-\t\t\tthen\n    +-\t\t\t\t# larger than 1MB\n    +-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)\"\n    +-\t\t\t\tcontinue\n    +-\t\t\tfi\n    +-\n    +-\t\t\tnew_combined_trash_size=$(($combined_trash_size + $trash_size))\n    +-\t\t\tif [ $new_combined_trash_size -gt 1048576 ]\n    +-\t\t\tthen\n    +-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)\"\n    +-\t\t\t\tcontinue\n    +-\t\t\tfi\n    +-\t\t\tcombined_trash_size=$new_combined_trash_size\n    +-\n     -\t\t\t# DO NOT modify these two 'echo'-ed strings below\n     -\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n     -\t\t\t# as well.\n    - \t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n    - \t\t\tcat \"$trash_tgz_b64\"\n    - \t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n    +-\t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n    +-\t\t\tcat \"$trash_tgz_b64\"\n    +-\t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n    +-\t\tfi\n    + \tfi\n    + done\n     \n      ## ci/run-build-and-tests.sh ##\n     @@\n 4:  914e81118b8 =  4:  2590459db33 CI: remove dead \"tree skipping\" code\n 5:  b2e456f9a9b !  5:  e311ea8b9b3 CI: remove unused Azure ci/* code\n    @@ ci/print-test-failures.sh: do\n     -\t\tazure-pipelines)\n     -\t\t\tmkdir -p failed-test-artifacts\n     -\t\t\tmv \"$trash_dir\" failed-test-artifacts\n    --\t\t\tcontinue\n     -\t\t\t;;\n      \t\tgithub-actions)\n      \t\t\tmkdir -p failed-test-artifacts\n 6:  30968e36bdd =  6:  151f28e3818 CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n 7:  cc81b9fe37e =  7:  6c2a8ee9c4e CI: don't have \"git grep\" invoke a pager in tree content check\n 8:  2387b0c5842 =  8:  64a0a1fc8ce CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n 9:  54a4d79bf8d =  9:  0f780bf9e3c CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n10:  9a31b7d5011 = 10:  3cdeae9c141 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n11:  8ab4e81e1ca = 11:  1d3d357dcef CI: consistently use \"export\" in ci/lib.sh\n12:  9fe00566767 = 12:  5ef0756d095 CI: export variables via a wrapper\n13:  13feda050c0 ! 13:  e0ce614eb6d CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n    @@ Commit message\n     \n            Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n            any subsequent one. The \"make\" targets then start out with the\n    -       relevant output non-trace output right away.\n    +       relevant non-trace output right away.\n     \n          * If we do want to use the grouping syntax within a \"step\" it'll now\n            be easier to do so. It doesn't support nesting, so we'd have to\n14:  d3909b8e896 = 14:  a8e70124929 ci/lib.sh: use \"test\" instead of \"[\"\n15:  d63a689eae0 = 15:  bb335d1c0ca CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n16:  ac1ffe9c642 = 16:  5458e6dab0b CI: invoke \"make artifacts-tar\" directly in windows-build\n17:  8837bfa5433 ! 17:  5e5a5b71700 CI: split up and reduce \"ci/test-documentation.sh\"\n    @@ Commit message\n         parts in as one command in the CI job itself, and to run the two \"make\n         doc\" commands at the top-level.\n     \n    -    It'll now be obvious from the title of the step if if we failed in the\n    +    It'll now be obvious from the title of the step if we failed in the\n         asciidoc or asciidoctor step.\n     \n         Since the \"check_unignored_build_artifacts()\" function is now only\n -:  ----------- > 18:  eec7a11376e CI: make ci/install-dependencies.sh POSIX-compatible\n18:  aa491990c1a ! 19:  a9c98582de1 CI: combine ci/install{,-docker}-dependencies.sh\n    @@ Commit message\n         statement in the latter only cared about \"$jobname\", and can be folded\n         into the same \"case\" statement in the former.\n     \n    -    The reason they split up is historical, and because the\n    -    \"ci/install-dependencies.sh\" used \"ci/lib.sh\", which requires\n    -    \"bash\". At least one of the docker containers doesn't have \"bash\". To\n    -    make the existing code POSIX-compatible we need to replace pushd/popd\n    -    with a sub-shell, but no other changes were needed.\n    +    The reason they split up is historical, until a preceding commit\n    +    \"ci/lib.sh\" required \"bash\", which might not have been available in\n    +    \"docker\".\n     \n         This also fixes issue in \"ci/install-docker-dependencies.sh\" where\n         we'd hide errors due to not using \"set -e\". Now that we include\n    @@ .github/workflows/main.yml: jobs:\n          - run: make test\n     \n      ## ci/install-dependencies.sh ##\n    -@@\n    --#!/usr/bin/env bash\n    -+#!/bin/sh\n    - #\n    - # Install dependencies required to build and test Git on Linux and macOS\n    - #\n    -@@ ci/install-dependencies.sh: ubuntu-latest)\n    - \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n    - \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n    - \tmkdir --parents \"$P4_PATH\"\n    --\tpushd \"$P4_PATH\"\n    -+\t(\n    -+\t\tcd \"$P4_PATH\"\n    - \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n    - \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n    - \t\tchmod u+x p4d\n    - \t\tchmod u+x p4\n    --\tpopd\n    -+\t)\n    - \tmkdir --parents \"$GIT_LFS_PATH\"\n    --\tpushd \"$GIT_LFS_PATH\"\n    -+\t(\n    -+\t\tcd \"$GIT_LFS_PATH\"\n    - \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n    - \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n    - \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n    --\tpopd\n    -+\t)\n    - \t;;\n    - macos-latest)\n    - \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n     @@ ci/install-dependencies.sh: linux-gcc-default)\n      \tsudo apt-get -q update\n      \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n19:  39b13298425 = 20:  96e7eb68906 CI: move \"env\" definitions into ci/lib.sh\n20:  0a92c478d28 = 21:  fdbe8554f5d ci/run-test-slice.sh: replace shelling out with \"echo\"\n21:  16ac7f5c210 = 22:  f257ab59971 CI: pre-select test slice in Windows & VS tests\n22:  939ef573b75 = 23:  1d95088da29 CI: only invoke ci/lib.sh as \"steps\" in main.yml\n23:  8e79c3e39e0 = 24:  a7434b215db CI: narrow down variable definitions in --build and --test\n24:  d1d5c1e2f65 = 25:  78f4609a9c1 CI: add more variables to MAKEFLAGS, except under vs-build\n25:  1268792233f ! 26:  26a34f1d4b9 CI: set CC in MAKEFLAGS directly, don't add it to the environment\n    @@ Metadata\n      ## Commit message ##\n         CI: set CC in MAKEFLAGS directly, don't add it to the environment\n     \n    -    Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\n    -    picked up in ci/lib.sh let's instead have ci/lib.sh itself add it\n    -    directly to MAKEFLAGS.\n    +    Rather than pass a \"$CC\" in the environment to be picked up in\n    +    ci/lib.sh let's instead have ci/lib.sh itself add it directly to\n    +    MAKEFLAGS. For \"$CC_PACKAGE\" its setting and use can stay within\n    +    ci/install-dependencies.sh.\n     \n         Setting CC=gcc by default made for confusing trace output, and since a\n         preceding change to carry it and others over across \"steps\" in the\n         GitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\n         confusingly has CC=gcc set, even though it builds with MSVC.\n     \n    -    Let's instead reply on the Makefile default of CC=cc, and only\n    -    override it for those jobs where it's needed. This does mean that\n    -    we'll need to set it for the \"pedantic\" job, which previously relied\n    -    on the default CC=gcc in case \"clang\" become the default on that\n    -    platform.\n    +    Let's instead rely on the Makefile default of CC=cc, and only override\n    +    it for those jobs where it's needed. This does mean that we'll need to\n    +    set it for the \"pedantic\" job, which previously relied on the default\n    +    CC=gcc in case \"clang\" become the default on that platform.\n     \n         This partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n         \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n    @@ .github/workflows/main.yml: jobs:\n            runs_on_pool: ${{matrix.vector.pool}}\n          runs-on: ${{matrix.vector.pool}}\n     \n    + ## ci/install-dependencies.sh ##\n    +@@ ci/install-dependencies.sh: UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n    +  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n    +  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n    + \n    ++CC_PACKAGE=\n    ++case \"$jobname\" in\n    ++linux-gcc | linux-TEST-vars)\n    ++\tCC_PACKAGE=gcc-8\n    ++\t;;\n    ++osx-gcc)\n    ++\tCC_PACKAGE=gcc-9\n    ++\t;;\n    ++esac\n    ++\n    + case \"$runs_on_pool\" in\n    + ubuntu-latest)\n    + \t# The Linux build installs the defined dependency versions below.\n    +\n      ## ci/lib.sh ##\n     @@ ci/lib.sh: setenv () {\n      \tfi\n    @@ ci/lib.sh: setenv () {\n      \n     +# Clear variables that may come from the outside world.\n     +CC=\n    -+CC_PACKAGE=\n     +\n      # How many jobs to run in parallel?\n      NPROC=10\n    @@ ci/lib.sh: vs-test)\n      \t;;\n      linux-gcc)\n     +\tCC=gcc\n    -+\tCC_PACKAGE=gcc-8\n      \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n      \t;;\n     +linux-gcc-default)\n    @@ ci/lib.sh: vs-test)\n     +\t;;\n      linux-TEST-vars)\n     +\tCC=gcc\n    -+\tCC_PACKAGE=gcc-8\n      \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n      \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n      \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n    @@ ci/lib.sh: linux-TEST-vars)\n      \t;;\n     +osx-gcc)\n     +\tCC=gcc\n    -+\tCC_PACKAGE=gcc-9\n     +\t;;\n     +osx-clang)\n     +\tCC=clang\n26:  83138dacd3e = 27:  514de8d16b0 CI: set SANITIZE=leak in MAKEFLAGS directly\n27:  0508777c68e ! 28:  6501059c594 CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n    @@ ci/lib.sh: linux-TEST-vars)\n      osx-gcc)\n     +\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n      \tCC=gcc\n    - \tCC_PACKAGE=gcc-9\n      \t;;\n      osx-clang)\n     +\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n28:  c0ce0fd3a80 = 29:  1bdcf1399d9 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n -:  ----------- > 30:  94abb826627 CI: have osx-gcc use gcc, not clang\n29:  2e3c02fa0df ! 31:  4fc67e668da CI: make it easy to use ci/*.sh outside of CI\n    @@ Commit message\n         environment if we're outside of CI, in case the user has e.g. \"jN\" or\n         other flags to \"make\" that they'd prefer configured already.\n     \n    +    Using \"ci/lib.sh\" as a stand-alone script is much more useful if it\n    +    doesn't hardcode NPROC=10, let's provide a poor shellscript\n    +    replacement for the online_cpus() we have in thread-utils.c to cover\n    +    the most common OS's. It was suggested to use \"2>&1\" to invoke\n    +    \"command -v\", but per my reading of [2] and my own testing that\n    +    doesn't seem to be needed. Perhaps it's only needed for \"which(1)\"?\n    +\n    +    1. https://lore.kernel.org/git/214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com/\n    +    2. https://pubs.opengroup.org/onlinepubs/009604499/utilities/command.html\n    +\n    +    Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib-ci-type.sh ##\n    @@ ci/lib-ci-type.sh\n     -\texit 1\n      fi\n     \n    + ## ci/lib-online_cpus.sh (new) ##\n    +@@\n    ++#!/bin/sh\n    ++\n    ++# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n    ++# that presents a chicken & egg problem. But if we move it to a\n    ++# stand-oline command...\n    ++online_cpus() {\n    ++\tNPROC=\n    ++\n    ++\tif command -v nproc >/dev/null\n    ++\tthen\n    ++\t\t# GNU coreutils\n    ++\t\tNPROC=$(nproc)\n    ++\telif command -v sysctl >/dev/null\n    ++\tthen\n    ++\t\t# BSD & Mac OS X\n    ++\t\tNPROC=$(sysctl -n hw.ncpu)\n    ++\telif test -n \"$NUMBER_OF_PROCESSORS\"\n    ++\tthen\n    ++\t\t# Windows\n    ++\t\tNPROC=\"$NUMBER_OF_PROCESSORS\"\n    ++\telse\n    ++\t\tNPROC=1\n    ++\tfi\n    ++\n    ++\techo $NPROC\n    ++}\n    +\n      ## ci/lib.sh ##\n     @@\n      #!/bin/sh\n    @@ ci/lib.sh: setenv () {\n      \tfi\n      \n      \techo \"SET: '$key=$val'\" >&2\n    -@@ ci/lib.sh: CC_PACKAGE=\n    +@@ ci/lib.sh: CC=\n      \n      # How many jobs to run in parallel?\n      NPROC=10\n     +case \"$CI_TYPE\" in\n     +'')\n    -+\tif command -v nproc >/dev/null\n    -+\tthen\n    -+\t\tNPROC=$(nproc)\n    -+\telse\n    -+\t\tNPROC=1\n    -+\tfi\n    ++\t. ${0%/*}/lib-online_cpus.sh\n    ++\tNPROC=$(online_cpus)\n     +\n     +\tif test -n \"$MAKEFLAGS\"\n     +\tthen\n    @@ ci/lib.sh: github-actions)\n     \n      ## ci/print-test-failures.sh ##\n     @@ ci/print-test-failures.sh: do\n    - \t\ttest_name=\"${TEST_EXIT%.exit}\"\n    - \t\ttest_name=\"${test_name##*/}\"\n    - \t\ttrash_dir=\"trash directory.$test_name\"\n    --\t\tcase \"$CI_TYPE\" in\n    --\t\tgithub-actions)\n    -+\t\tif test \"$CI_TYPE\" = \"github-actions\"\n    -+\t\tthen\n    - \t\t\tmkdir -p failed-test-artifacts\n    - \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n      \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n      \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n    - \t\t\tcontinue\n    --\t\t\t;;\n    + \t\t\t;;\n     -\t\t*)\n     -\t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n     -\t\t\texit 1\n     -\t\t\t;;\n    --\t\tesac\n    -+\t\tfi\n    - \t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n    - \t\tif [ -d \"$trash_dir\" ]\n    - \t\tthen\n    + \t\tesac\n    + \tfi\n    + done\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453819","messageId":"patch-v4-03.31-d875069fc28-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 03/31] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:40Z","receivedAt":"2022-04-18T16:29:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the \"--state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nFor \"ci/print-test-failures.sh\" the creation of the tarball added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01) has been dead since my 4a6e4b96026,\nwhich removed the fall-through case from the \"case/esac\" statement.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     | 39 ---------------------\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 220 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5fda166ad47..510b20726ab 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..740ebb7c529 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -16,15 +16,6 @@ then\n \texit\n fi\n \n-case \"$jobname\" in\n-osx-clang|osx-gcc)\n-\t# base64 in OSX doesn't wrap its output at 76 columns by\n-\t# default, but prints a single, very long line.\n-\tbase64_opts=\"-b 76\"\n-\t;;\n-esac\n-\n-combined_trash_size=0\n for TEST_EXIT in test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n@@ -42,47 +33,17 @@ do\n \t\tazure-pipelines)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n \t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-\t\t\tcontinue\n \t\t\t;;\n \t\t*)\n \t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \t\t\texit 1\n \t\t\t;;\n \t\tesac\n-\t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n-\t\tif [ -d \"$trash_dir\" ]\n-\t\tthen\n-\t\t\ttar czp \"$trash_dir\" |base64 $base64_opts >\"$trash_tgz_b64\"\n-\n-\t\t\ttrash_size=$(wc -c <\"$trash_tgz_b64\")\n-\t\t\tif [ $trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\t# larger than 1MB\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\n-\t\t\tnew_combined_trash_size=$(($combined_trash_size + $trash_size))\n-\t\t\tif [ $new_combined_trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\t\t\tcombined_trash_size=$new_combined_trash_size\n-\n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n-\t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n-\t\t\tcat \"$trash_tgz_b64\"\n-\t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n-\t\tfi\n \tfi\n done\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453820","messageId":"patch-v4-05.31-e311ea8b9b3-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 05/31] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:42Z","receivedAt":"2022-04-18T16:29:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  4 ----\n 4 files changed, 1 insertion(+), 44 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex dbcebad2fb2..e7ea8799411 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tbrew install --cask --no-quarantine perforce || {\n \t\t# Update the definitions and try again\n@@ -69,7 +67,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d12eaf338f9..c4b829c1eed 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 740ebb7c529..47e2ea1ad10 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -30,10 +30,6 @@ do\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453821","messageId":"patch-v4-04.31-2590459db33-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 04/31] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:41Z","receivedAt":"2022-04-18T16:29:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 510b20726ab..d12eaf338f9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453822","messageId":"patch-v4-06.31-151f28e3818-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 06/31] CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:43Z","receivedAt":"2022-04-18T16:29:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a8c51f77d16 (ci: clear and mark MAKEFLAGS exported just once,\n2019-02-07) the assignment of MAKEFLAGS was done up-front to\nfuture-proof this code for the bug fixed in 406f93ae488 (ci: make sure\nwe build Git parallel, 2019-02-07).\n\nBut since 4a6e4b96026 (CI: remove Travis CI support, 2021-11-23) the\n--jobs=10 has been an invariant here, so let's assign --jobs=$NPROC to\nthe MAKEFLAGS right away, this gets rid of the leading whitespace from\nthe $MAKEFLAGS variable, as it would previously be empty on the first\nassignment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c4b829c1eed..21c009757f4 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -26,17 +26,19 @@ check_unignored_build_artifacts ()\n # GitHub Action doesn't set TERM, which is required by tput\n export TERM=${TERM:-dumb}\n \n+# How many jobs to run in parallel?\n+NPROC=10\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+export MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453823","messageId":"patch-v4-07.31-6c2a8ee9c4e-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 07/31] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:44Z","receivedAt":"2022-04-18T16:29:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453824","messageId":"patch-v4-08.31-64a0a1fc8ce-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 08/31] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:45Z","receivedAt":"2022-04-18T16:30:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 28 ++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n shared.mak                 |  1 +\n 4 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex f8bccfab5e9..8717ea7e745 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3031,6 +3031,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3466,3 +3480,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\ndiff --git a/shared.mak b/shared.mak\nindex 50d4596f0d6..83e0aa16e7d 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -68,6 +68,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \n ## Used in \"Documentation/Makefile\"\n \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453825","messageId":"patch-v4-13.31-e0ce614eb6d-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 13/31] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:50Z","receivedAt":"2022-04-18T16:30:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 36 +++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 58 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..c83f6a21ca3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: no\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'no'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 34b4400f38b..01006379fd0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3727e6ec2f9..cc9a368be42 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -39,7 +41,10 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -109,6 +114,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453826","messageId":"patch-v4-14.31-a8e70124929-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 14/31] ci/lib.sh: use \"test\" instead of \"[\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:51Z","receivedAt":"2022-04-18T16:30:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the ci/lib.sh script to use \"if test\" rather than \"if [\". Until\nthe preceding commit this script relied on the non-POSIX \"export X=Y\"\nsyntax, but now that it's POSIX portable let's use our usual style in\nit, and not the bash-specific style that was used in it historically.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cc9a368be42..ffc0e524aaa 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -94,7 +94,7 @@ ubuntu-latest)\n \t\tbreak\n \tfi\n \n-\tif [ \"$jobname\" = linux-gcc ]\n+\tif test \"$jobname\" = linux-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n \telse\n@@ -104,7 +104,7 @@ ubuntu-latest)\n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n+\tif test \"$jobname\" = osx-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \telse\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453827","messageId":"patch-v4-12.31-5ef0756d095-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 12/31] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:49Z","receivedAt":"2022-04-18T16:30:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore the \"varname\" parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 51 ++++++++++++++++++++++++++++++---------\n ci/run-build-and-tests.sh | 34 +++++++++++++-------------\n 2 files changed, 57 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5783eed1b20..3727e6ec2f9 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,35 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--build)\n+\t\t\t;;\n+\t\t--test)\n+\t\t\t;;\n+\t\t--all)\n+\t\t\t;;\n+\t\t-*)\n+\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +53,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # How many jobs to run in parallel?\n NPROC=10\n@@ -37,21 +66,21 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -67,7 +96,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -90,9 +119,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453828","messageId":"patch-v4-11.31-1d3d357dcef-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 11/31] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:48Z","receivedAt":"2022-04-18T16:30:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5736a4d2e04..5783eed1b20 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -30,7 +30,7 @@ export TERM=${TERM:-dumb}\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -38,9 +38,10 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -94,4 +95,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453829","messageId":"patch-v4-16.31-5458e6dab0b-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 16/31] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:53Z","receivedAt":"2022-04-18T16:30:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 05c5771e7f6..2c23a19eac2 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453830","messageId":"patch-v4-17.31-5e5a5b71700-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 17/31] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:54Z","receivedAt":"2022-04-18T16:30:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 2c23a19eac2..92b914f16fd 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ffc0e524aaa..35a972fa3f5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -47,16 +47,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453831","messageId":"patch-v4-19.31-a9c98582de1-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 19/31] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:56Z","receivedAt":"2022-04-18T16:30:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, until a preceding commit\n\"ci/lib.sh\" required \"bash\", which might not have been available in\n\"docker\".\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 15 +++++++++++++++\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 16 insertions(+), 23 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 92b914f16fd..3fd3e4f873c 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex db58de0a6fd..8e41747ef6f 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -97,6 +97,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null && type p4 >/dev/null\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453832","messageId":"patch-v4-18.31-eec7a11376e-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 18/31] CI: make ci/install-dependencies.sh POSIX-compatible","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:55Z","receivedAt":"2022-04-18T16:30:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the unportable constructs in the \"ci/install-dependencies.sh\"\nscripts to use POSIX replacements, and have it run under \"/bin/sh\"\ninstead of \"/usr/bin/env bash\". We needed to:\n\n* Replace pushd/popd with a sub-shell.\n* Change \"mkdir --parents\" to \"mkdir -p\".\n* Use POSIX \"export\" syntax.\n\nThis is in preparation for combining this script and\n\"ci/install-docker-dependencies.sh\", which doesn't have access to\n\"bash\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 25 ++++++++++++++++---------\n 1 file changed, 16 insertions(+), 9 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 01006379fd0..db58de0a6fd 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -21,7 +21,8 @@ ubuntu-latest)\n \n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tPATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\texport PATH\n \tif test -n \"$GITHUB_PATH\"\n \tthen\n \t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n@@ -33,22 +34,28 @@ ubuntu-latest)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n-\tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\tmkdir -p \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n-\tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t)\n+\tmkdir -p \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n-\texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n+\tHOMEBREW_NO_AUTO_UPDATE=1\n+\texport HOMEBREW_NO_AUTO_UPDATE\n+\tHOMEBREW_NO_INSTALL_CLEANUP=1\n+\texport HOMEBREW_NO_INSTALL_CLEANUP\n+\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n \tbrew link --force gettext\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453833","messageId":"patch-v4-20.31-96e7eb68906-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 20/31] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:57Z","receivedAt":"2022-04-18T16:30:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 3fd3e4f873c..fe37e0f1b36 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 35a972fa3f5..8c574b21a67 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -104,6 +104,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453834","messageId":"patch-v4-21.31-fdbe8554f5d-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 21/31] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:58Z","receivedAt":"2022-04-18T16:30:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453835","messageId":"patch-v4-22.31-f257ab59971-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 22/31] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:59Z","receivedAt":"2022-04-18T16:30:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  4 ++--\n 2 files changed, 10 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (57%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex fe37e0f1b36..1e13718b989 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 57%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..ec602f8a053 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,10 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+echo T=\"$tests\" >>$GITHUB_ENV\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453836","messageId":"patch-v4-25.31-78f4609a9c1-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 25/31] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:02Z","receivedAt":"2022-04-18T16:30:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 50bc766254b..8fb0bfd43e1 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -61,6 +61,13 @@ COMMON_MAKEFLAGS=--jobs=$NPROC\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n \n+# Use common options for \"make\" (cmake in \"vs-build\" below uses the\n+# intermediate variables directly)\n+DEVELOPER=1\n+MAKEFLAGS=\"$MAKEFLAGS DEVELOPER=$DEVELOPER\"\n+SKIP_DASHED_BUILT_INS=YesPlease\n+MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC:-gcc}\"\n@@ -77,10 +84,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -117,6 +122,9 @@ windows-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453837","messageId":"patch-v4-27.31-514de8d16b0-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 27/31] CI: set SANITIZE=leak in MAKEFLAGS directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:04Z","receivedAt":"2022-04-18T16:30:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As in the preceding commit's change to do likewise for CC, let's not\nset SANITIZE in the environment. When I added the \"linux-leaks\" job in\nin 956d2e4639b (tests: add a test mode for SANITIZE=leak, run it in\nCI, 2021-09-23) I missed that I could do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 977ee6293ef..ac96b7a1c61 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -197,7 +197,7 @@ linux-musl)\n \t;;\n linux-leaks)\n \tCC=gcc\n-\tsetenv --build SANITIZE leak\n+\tMAKEFLAGS=\"$MAKEFLAGS SANITIZE=leak\"\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453838","messageId":"patch-v4-29.31-1bdcf1399d9-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 29/31] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:06Z","receivedAt":"2022-04-18T16:30:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 23 +++++++++++++++++++++--\n 1 file changed, 21 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 1a7200451e4..ab7546800e0 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -18,15 +18,26 @@ then\n \texit 1\n fi\n \n+# Show our configuration\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+fi\n+\n # Helper functions\n setenv () {\n+\tlocal skip=\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build | --test)\n \t\t\tif test \"$1\" != \"$mode\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \n \t\t\t;;\n@@ -45,10 +56,18 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\techo \"SKIP '$key=$val'\" >&2\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453839","messageId":"patch-v4-28.31-6501059c594-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 28/31] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:05Z","receivedAt":"2022-04-18T16:30:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ac96b7a1c61..1a7200451e4 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -104,14 +104,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif test \"$jobname\" = osx-gcc\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -167,9 +159,11 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453840","messageId":"patch-v4-26.31-26a34f1d4b9-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 26/31] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:03Z","receivedAt":"2022-04-18T16:30:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rather than pass a \"$CC\" in the environment to be picked up in\nci/lib.sh let's instead have ci/lib.sh itself add it directly to\nMAKEFLAGS. For \"$CC_PACKAGE\" its setting and use can stay within\nci/install-dependencies.sh.\n\nSetting CC=gcc by default made for confusing trace output, and since a\npreceding change to carry it and others over across \"steps\" in the\nGitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\nconfusingly has CC=gcc set, even though it builds with MSVC.\n\nLet's instead rely on the Makefile default of CC=cc, and only override\nit for those jobs where it's needed. This does mean that we'll need to\nset it for the \"pedantic\" job, which previously relied on the default\nCC=gcc in case \"clang\" become the default on that platform.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/install-dependencies.sh | 10 ++++++++++\n ci/lib.sh                  | 23 ++++++++++++++++++++---\n 3 files changed, 30 insertions(+), 16 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 0787cadc76b..6d25ec4ae3b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 52f2180d5b4..1d05f43d19e 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -9,6 +9,16 @@ UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n+CC_PACKAGE=\n+case \"$jobname\" in\n+linux-gcc | linux-TEST-vars)\n+\tCC_PACKAGE=gcc-8\n+\t;;\n+osx-gcc)\n+\tCC_PACKAGE=gcc-9\n+\t;;\n+esac\n+\n case \"$runs_on_pool\" in\n ubuntu-latest)\n \t# The Linux build installs the defined dependency versions below.\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8fb0bfd43e1..977ee6293ef 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -51,6 +51,9 @@ setenv () {\n \tfi\n }\n \n+# Clear variables that may come from the outside world.\n+CC=\n+\n # How many jobs to run in parallel?\n NPROC=10\n \n@@ -70,8 +73,6 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC:-gcc}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n@@ -143,9 +144,14 @@ vs-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -160,13 +166,22 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n+\tCC=gcc\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n \tsetenv --build DEVOPTS pedantic\n@@ -181,9 +196,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453841","messageId":"patch-v4-31.31-4fc67e668da-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 31/31] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:08Z","receivedAt":"2022-04-18T16:30:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the ci/.sh scripts have lost most of their\nCI-specific assumptions. Let's go even further and explicitly support\nrunning ci/lib.sh outside of CI.\n\nThis was possible before by faking up enough CI-specific variables,\nbut as shown in the new \"help\" output being added here using the\nci/lib.sh to provide \"CI-like\" has now become trivial.\n\nThe ci/print-test-failures.sh scripts can now be used outside of CI as\nwell, the only GitHub CI-specific part is now guarded by a check that\nwe'll pass if outside of GitHub CI.\n\nThere's also a special-case here to not clobber $MAKEFLAGS in the\nenvironment if we're outside of CI, in case the user has e.g. \"jN\" or\nother flags to \"make\" that they'd prefer configured already.\n\nUsing \"ci/lib.sh\" as a stand-alone script is much more useful if it\ndoesn't hardcode NPROC=10, let's provide a poor shellscript\nreplacement for the online_cpus() we have in thread-utils.c to cover\nthe most common OS's. It was suggested to use \"2>&1\" to invoke\n\"command -v\", but per my reading of [2] and my own testing that\ndoesn't seem to be needed. Perhaps it's only needed for \"which(1)\"?\n\n1. https://lore.kernel.org/git/214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com/\n2. https://pubs.opengroup.org/onlinepubs/009604499/utilities/command.html\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh         |  3 ---\n ci/lib-online_cpus.sh     | 26 ++++++++++++++++++\n ci/lib.sh                 | 57 ++++++++++++++++++++++++++++++++++++---\n ci/print-test-failures.sh |  4 ---\n 4 files changed, 79 insertions(+), 11 deletions(-)\n create mode 100644 ci/lib-online_cpus.sh\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex 6f01fd9e5d9..09acab7aaec 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -3,7 +3,4 @@\n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n-else\n-\techo \"Could not identify CI type\" >&2\n-\texit 1\n fi\ndiff --git a/ci/lib-online_cpus.sh b/ci/lib-online_cpus.sh\nnew file mode 100644\nindex 00000000000..6ce7ec5692d\n--- /dev/null\n+++ b/ci/lib-online_cpus.sh\n@@ -0,0 +1,26 @@\n+#!/bin/sh\n+\n+# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n+# that presents a chicken & egg problem. But if we move it to a\n+# stand-oline command...\n+online_cpus() {\n+\tNPROC=\n+\n+\tif command -v nproc >/dev/null\n+\tthen\n+\t\t# GNU coreutils\n+\t\tNPROC=$(nproc)\n+\telif command -v sysctl >/dev/null\n+\tthen\n+\t\t# BSD & Mac OS X\n+\t\tNPROC=$(sysctl -n hw.ncpu)\n+\telif test -n \"$NUMBER_OF_PROCESSORS\"\n+\tthen\n+\t\t# Windows\n+\t\tNPROC=\"$NUMBER_OF_PROCESSORS\"\n+\telse\n+\t\tNPROC=1\n+\tfi\n+\n+\techo $NPROC\n+}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8f80be4c3df..362bd031df0 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,6 +1,30 @@\n #!/bin/sh\n set -e\n \n+#  Usage\n+CI_TYPE_HELP_COMMANDS='\n+\t# run \"make all test\" like the \"linux-leaks\" job\n+\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n+\n+\t# run \"make all test\" like the \"linux-musl\" job\n+\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n+\n+\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n+\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n+\n+\t# run \"make test\" like the \"linux-sha256\" job\n+\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n+'\n+\n+CI_TYPE_HELP=\"\n+running $0 outside of CI? You can use ci/lib.sh to set up your\n+environment like a given CI job. E.g.:\n+$CI_TYPE_HELP_COMMANDS\n+\n+note that some of these (e.g. the linux-musl one) may not work as\n+expected due to the CI job configuring a platform that may not match\n+yours.\"\n+\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n@@ -9,6 +33,10 @@ mode=$1\n if test -z \"$mode\"\n then\n \techo \"need a $0 mode, e.g. --build or --test\" >&2\n+\tif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$CI_TYPE_HELP\" >&2\n+\tfi\n \texit 1\n fi\n \n@@ -35,7 +63,7 @@ setenv () {\n \tdo\n \t\tcase \"$1\" in\n \t\t--build | --test)\n-\t\t\tif test \"$1\" != \"$mode\"\n+\t\t\tif test \"$1\" != \"$mode\" && test \"$mode\" != \"--all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n@@ -65,6 +93,10 @@ setenv () {\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$key=\\\"$val\\\"\"\n+\t\techo \"export $key\"\n \tfi\n \n \techo \"SET: '$key=$val'\" >&2\n@@ -75,10 +107,25 @@ CC=\n \n # How many jobs to run in parallel?\n NPROC=10\n+case \"$CI_TYPE\" in\n+'')\n+\t. ${0%/*}/lib-online_cpus.sh\n+\tNPROC=$(online_cpus)\n+\n+\tif test -n \"$MAKEFLAGS\"\n+\tthen\n+\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n+\telse\n+\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\tfi\n+\t;;\n+*)\n+\t# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+\t# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\t;;\n+esac\n \n-# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n-# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n-COMMON_MAKEFLAGS=--jobs=$NPROC\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n@@ -98,6 +145,8 @@ github-actions)\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n \t;;\n+'')\n+\t;;\n *)\n \techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 29f8c332eca..ec395c79ccd 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -36,10 +36,6 @@ do\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n \t\t\t;;\n-\t\t*)\n-\t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n-\t\t\texit 1\n-\t\t\t;;\n \t\tesac\n \tfi\n done\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453842","messageId":"patch-v4-09.31-0f780bf9e3c-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 09/31] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:46Z","receivedAt":"2022-04-18T16:31:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8717ea7e745..2e1ae6c6067 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3402,7 +3402,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3492,5 +3492,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453843","messageId":"patch-v4-15.31-bb335d1c0ca-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 15/31] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:52Z","receivedAt":"2022-04-18T16:31:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c83f6a21ca3..05c5771e7f6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453844","messageId":"patch-v4-10.31-3cdeae9c141-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 10/31] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:28:47Z","receivedAt":"2022-04-18T16:31:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex e7ea8799411..34b4400f38b 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 21c009757f4..5736a4d2e04 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -67,18 +67,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453845","messageId":"patch-v4-30.31-94abb826627-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:07Z","receivedAt":"2022-04-18T16:31:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix a regression in 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23). In that commit I\nchanged CC=gcc from CC=gcc-9, but on OSX the \"gcc\" in $PATH points to\nclang, we need to use gcc-9 instead.\n\nReported-by: Carlo Arenas <carenas@gmail.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ab7546800e0..8f80be4c3df 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -179,7 +179,7 @@ linux-TEST-vars)\n \t;;\n osx-gcc)\n \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\tCC=gcc\n+\tCC=gcc-9\n \t;;\n osx-clang)\n \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453846","messageId":"patch-v4-24.31-a7434b215db-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 24/31] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:01Z","receivedAt":"2022-04-18T16:31:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nSince we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\ntest\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\nsteps, i.e. the one with PYTHON_PATH, CC etc. These will all be\ncarried over from the earlier --build step.\n\nThat won't be true in the case of the \"windows-test\" and \"vs-test\"\njobs, since they run separately from the corresponding \"build\"\nstep. So we'll need to make sure that we have the --jobs=N argument\nfor those.\n\nThis doesn't matter that much, as we'll still have --jobs=N in\nGIT_PROVE_OPTS. So the only thing we'll use it for is parallelism in\nthe t/Makefile before we get to running \"prove\". Still, it's good to\nbe consistent for good measure, and to run the t/Makefile itself in\nparallel.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 20 +++++++++++---------\n ci/lib.sh                  | 30 +++++++++++++++++++++++-------\n 2 files changed, 34 insertions(+), 16 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 1e13718b989..0787cadc76b 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'no'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +333,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +354,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +366,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8f7e178f3ff..50bc766254b 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -5,6 +5,13 @@ set -ex\n . ${0%/*}/lib-ci-type.sh\n \n # Starting assertions\n+mode=$1\n+if test -z \"$mode\"\n+then\n+\techo \"need a $0 mode, e.g. --build or --test\" >&2\n+\texit 1\n+fi\n+\n if test -z \"$jobname\"\n then\n \techo \"must set a CI jobname in the environment\" >&2\n@@ -16,11 +23,12 @@ setenv () {\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n-\t\t--build)\n-\t\t\t;;\n-\t\t--test)\n-\t\t\t;;\n-\t\t--all)\n+\t\t--build | --test)\n+\t\t\tif test \"$1\" != \"$mode\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n+\n \t\t\t;;\n \t\t-*)\n \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n@@ -46,8 +54,12 @@ setenv () {\n # How many jobs to run in parallel?\n NPROC=10\n \n+# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+COMMON_MAKEFLAGS=--jobs=$NPROC\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=$COMMON_MAKEFLAGS\n \n case \"$CI_TYPE\" in\n github-actions)\n@@ -101,6 +113,9 @@ windows-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n+windows-test)\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n+\t;;\n vs-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n@@ -117,6 +132,7 @@ vs-build)\n \t;;\n vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n@@ -162,4 +178,4 @@ linux-leaks)\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453847","messageId":"patch-v4-23.31-1d95088da29-20220418T132809Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v4 23/31] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-18T16:29:00Z","receivedAt":"2022-04-18T16:32:05Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  9 +++++++++\n ci/lib-tput.sh                        |  5 +++++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 33 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 8e41747ef6f..52f2180d5b4 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..6f01fd9e5d9\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..b62ef13c44c\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,5 @@\n+#!/bin/sh\n+\n+# GitHub Action doesn't set TERM, which is required by tput\n+TERM=${TERM:-dumb}\n+export TERM\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8c574b21a67..8f7e178f3ff 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -47,18 +43,14 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # How many jobs to run in parallel?\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=--jobs=$NPROC\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC:-gcc}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n@@ -66,11 +58,12 @@ then\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 47e2ea1ad10..29f8c332eca 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex ec602f8a053..a0332095bb3 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.36.0.rc2.898.gdf6bbac50ff\n\n"},{"id":"453899","messageId":"CAPig+cQi1sRt_fMi13LtFvDL3J3ZcNaOzTugQaN-T41YAgw5Nw@mail.gmail.com","threadId":"57451","inReplyTo":"patch-v4-31.31-4fc67e668da-20220418T132809Z-avarab@gmail.com","subject":"Re: [PATCH v4 31/31] CI: make it easy to use ci/*.sh outside of CI","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2022-04-18T17:57:25Z","receivedAt":"2022-04-18T17:57:40Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Mon, Apr 18, 2022 at 12:29 PM Ævar Arnfjörð Bjarmason\n<avarab@gmail.com> wrote:\n> In preceding commits the ci/.sh scripts have lost most of their\n> CI-specific assumptions. Let's go even further and explicitly support\n> running ci/lib.sh outside of CI.\n>\n> This was possible before by faking up enough CI-specific variables,\n> but as shown in the new \"help\" output being added here using the\n> ci/lib.sh to provide \"CI-like\" has now become trivial.\n>\n> The ci/print-test-failures.sh scripts can now be used outside of CI as\n> well, the only GitHub CI-specific part is now guarded by a check that\n> we'll pass if outside of GitHub CI.\n>\n> There's also a special-case here to not clobber $MAKEFLAGS in the\n> environment if we're outside of CI, in case the user has e.g. \"jN\" or\n> other flags to \"make\" that they'd prefer configured already.\n>\n> Using \"ci/lib.sh\" as a stand-alone script is much more useful if it\n> doesn't hardcode NPROC=10, let's provide a poor shellscript\n> replacement for the online_cpus() we have in thread-utils.c to cover\n> the most common OS's. It was suggested to use \"2>&1\" to invoke\n> \"command -v\", but per my reading of [2] and my own testing that\n> doesn't seem to be needed. Perhaps it's only needed for \"which(1)\"?\n\nNot redirecting stderr makes sense. I almost certainly accidentally\ntyped \"type foo\" reflexively even though I meant to type \"command -v\nfoo\", which explains why I thought redirecting stderr was needed. The\nexplanation above probably would have best been done simply as a reply\nto the review thread rather than as part of the commit message, but\ndropping it from the commit message is not worth a reroll.\n\n> 1. https://lore.kernel.org/git/214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com/\n> 2. https://pubs.opengroup.org/onlinepubs/009604499/utilities/command.html\n>\n> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n> diff --git a/ci/lib-online_cpus.sh b/ci/lib-online_cpus.sh\n> @@ -0,0 +1,26 @@\n> +# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n> +# that presents a chicken & egg problem. But if we move it to a\n> +# stand-oline command...\n\nUm, what's a \"stand-oline\"?\n"},{"id":"453903","messageId":"e303769f-c008-8187-c20f-01a950657fed@gmail.com","threadId":"57451","inReplyTo":"320b3dde-a84e-0074-bed8-57061293b2b0@github.com","subject":"Re: [PATCH v2 00/25] CI: run \"make [test]\" directly, use $GITHUB_ENV","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2022-04-18T18:33:31Z","receivedAt":"2022-04-18T18:33:43Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Ævar\n\nOn 25/03/2022 20:43, Victoria Dye wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>> A re-roll of my improvements my series to simplify the CI setup a lot\n>> (see diffstat), much of it was dealing with constraints that went away\n>> with Travis et al. CI for this series (OSX runners failing for\n>> unrelated reasons):\n>>\n>>      https://github.com/avar/git/actions/runs/2040223909\n>>\n>> For a much more detailed summary of how the output looks before/after\n>> see v1[].\n>>\n>> This series heavily conflicts with Johannes's\n>> js/ci-github-workflow-markup in \"seen\", but in the v1 I suggested\n>> basing that series on top of this one, because it can benefit a lot\n>> from these simplifications.\n>>\n>> I'll reply to this series with a proposed rebasing of that series on\n>> top of this one, which allows for removing almost all of its changes\n>> to \"ci/\" with no harm to its end-goals, i.e. the splitting up of\n>> \"make\" and \"make test\" output is something it'll get for free from\n>> this series.\n>>\n>> Junio: Since that series has been stalled on still-outstanding\n>> performance issues for a couple of months I was hoping we could queue\n>> this instead, and perhaps in addition if Johannes approves of the\n>> proposed re-roll on top of his.\n>>\n>> There's some forward progress on the performance issues (this[2] reply\n>> of Victoria Dye's from yesterday), but fully resolving those will\n>> probably take a bit...\n>>\n>> Whereas even though this one is relatively large I don't think there's\n>> anything controversial here. The one concern that's been raised has\n>> been Johannes's objection to removing some of the dead Azure code\n>> (which was needed to move forward here). I asked how he'd prefer to\n>> move forward with that in [3], but there hasn't been a reply to that\n>> in >1 month.\n>>\n> \n> While the largeness of a series shouldn't necessarily block it, the lack of\n> overarching structure or purpose in this one makes it really difficult for\n> me to review with much confidence (I can't speak for everyone, but it may be\n> one of the reasons for the general lack of feedback).\n\nThat applies to me, I think this would be easier to follow if it was \nsplit up. As far as I can tell there are several groups of changes and I \nthink it would be easier for reviewers if they were split into separate \nshorter series.\n\n1. Split building git and running the tests into separate steps. This is\n    I think the only user facing change. I think it is worthwhile and\n    could be done in a single patch that just moved make test into a\n    separate script without a lot of refactoring. In particular I do not\n    see the need for separate steps that setup the environment for the\n    build and tests (especially as the build environment variables are\n    still present when the tests are run).\n    Without the refactoring anyone resurrecting the azure pipelines for\n    testing security fixes would easily be able to update those build\n    definitions.\n\n2. Moving the static analysis ci job into the Makefile. I'm not sure\n    what the practical benefit of this is but it could be a self\n    contained series.\n\n3. Being able to run the ci scripts locally. Does this have a use beyond\n    debugging them locally? Could this be implemented with a wrapper\n    script rather than a large refactoring?\n\n4. Cleanups. To be honest I think we could happily live without a some\n    of these, especially patches 24-26 of v3 that rework code introduced\n    in this series.\n\nI see v4 has been posted while I was writing this and is even longer \nthan v3.\n\nBest Wishes\n\nPhillip\n\n> If you believe all of\n> these patches as thematically-related enough to warrant being in a single\n> series, then it would help a lot if you could:\n> \n> 1. Clearly describe the purpose of the series (yes they're all CI\n>     improvements, but *why* these particular improvements, and why do they\n>     all need to go together?)\n> 2. Outline the \"path\" these commits take to accomplishing that purpose (\"The\n>     first 3 commits do X because Y. Then, the next 4 commits do A because B.\"\n>     etc. or whatever format fits your writing style, as long as the\n>     information is there).\n> 3. Reorganize commits as necessary to keep the above outline from jumping\n>     back and forth between topics.\n> \n> Personally, I think this could (should?) be split into at least two series:\n> one that breaks up 'run-build-and-tests.sh' (and is more directly relevant\n> to dscho's series), and one that does the cleanup/flag change/other work.\n> The two appear to be independent, and the resulting two series would be a\n> much more manageable 10-15 commits each.\n> \n>> I think just removing it is OK, we can always bring it back if needed,\n>> and doing so is actually going to be simpler on top of this since the\n>> CI is now less special, and leans more heavily on the logic of our\n>> normal build process.\n>>\n>> 1. https://lore.kernel.org/git/cover-00.25-00000000000-20220221T143936Z-avarab@gmail.com\n>> 2. https://lore.kernel.org/git/6b83bb83-32b9-20c9-fa02-c1c3170351c3@github.com/\n>> 3. https://lore.kernel.org/git/220222.86y2236ndp.gmgdl@evledraar.gmail.com/\n>>\n>> Ævar Arnfjörð Bjarmason (25):\n>>    CI: run \"set -ex\" early in ci/lib.sh\n>>    CI: make \"$jobname\" explicit, remove fallback\n>>    CI: remove more dead Travis CI support\n>>    CI: remove dead \"tree skipping\" code\n>>    CI: remove unused Azure ci/* code\n>>    CI: don't have \"git grep\" invoke a pager in tree content check\n>>    CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>>    CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>>    CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n>>    CI: consistently use \"export\" in ci/lib.sh\n>>    CI: export variables via a wrapper\n>>    CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n>>    CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n>>    CI: invoke \"make artifacts-tar\" directly in windows-build\n>>    CI: split up and reduce \"ci/test-documentation.sh\"\n>>    CI: combine ci/install{,-docker}-dependencies.sh\n>>    CI: move \"env\" definitions into ci/lib.sh\n>>    ci/run-test-slice.sh: replace shelling out with \"echo\"\n>>    CI: pre-select test slice in Windows & VS tests\n>>    CI: only invoke ci/lib.sh as \"steps\" in main.yml\n>>    CI: narrow down variable definitions in --build and --test\n>>    CI: add more variables to MAKEFLAGS, except under vs-build\n>>    CI: set CC in MAKEFLAGS directly, don't add it to the environment\n>>    CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n>>    CI: don't use \"set -x\" in \"ci/lib.sh\" output\n>>\n>>   .github/workflows/main.yml            | 100 +++++---\n>>   Makefile                              |  31 ++-\n>>   ci/check-directional-formatting.bash  |   2 +-\n>>   ci/check-unignored-build-artifacts.sh |  20 ++\n>>   ci/install-dependencies.sh            |  53 ++++-\n>>   ci/install-docker-dependencies.sh     |  22 --\n>>   ci/lib-ci-type.sh                     |  10 +\n>>   ci/lib-tput.sh                        |   2 +\n>>   ci/lib.sh                             | 316 +++++++++++++-------------\n>>   ci/make-test-artifacts.sh             |  12 -\n>>   ci/mount-fileshare.sh                 |  25 --\n>>   ci/print-test-failures.sh             |  16 +-\n>>   ci/run-build-and-tests.sh             |  54 -----\n>>   ci/run-docker-build.sh                |  66 ------\n>>   ci/run-docker.sh                      |  47 ----\n>>   ci/run-static-analysis.sh             |  32 ---\n>>   ci/run-test-slice.sh                  |  17 --\n>>   ci/select-test-slice.sh               |  10 +\n>>   ci/test-documentation.sh              |  37 +--\n>>   ci/util/extract-trash-dirs.sh         |  50 ----\n>>   shared.mak                            |   1 +\n>>   21 files changed, 346 insertions(+), 577 deletions(-)\n>>   create mode 100755 ci/check-unignored-build-artifacts.sh\n>>   delete mode 100755 ci/install-docker-dependencies.sh\n>>   create mode 100644 ci/lib-ci-type.sh\n>>   create mode 100644 ci/lib-tput.sh\n>>   delete mode 100755 ci/make-test-artifacts.sh\n>>   delete mode 100755 ci/mount-fileshare.sh\n>>   delete mode 100755 ci/run-build-and-tests.sh\n>>   delete mode 100755 ci/run-docker-build.sh\n>>   delete mode 100755 ci/run-docker.sh\n>>   delete mode 100755 ci/run-static-analysis.sh\n>>   delete mode 100755 ci/run-test-slice.sh\n>>   create mode 100755 ci/select-test-slice.sh\n>>   delete mode 100755 ci/util/extract-trash-dirs.sh\n>>\n>> Range-diff against v1:\n>>   1:  970849a227f =  1:  4addbd70213 CI: run \"set -ex\" early in ci/lib.sh\n>>   2:  eda7fb18064 =  2:  b23aa99fd37 CI: make \"$jobname\" explicit, remove fallback\n>>   3:  3ee32815cf3 =  3:  eec15a95879 CI: remove more dead Travis CI support\n>>   4:  c81c1b3f504 =  4:  73c894f1665 CI: remove dead \"tree skipping\" code\n>>   5:  4738a22a36d =  5:  b5e6d538554 CI: remove unused Azure ci/* code\n>>   6:  59e4f41e86c =  6:  a4b9febbdca CI: don't have \"git grep\" invoke a pager in tree content check\n>>   7:  836ef20fdcc !  7:  5d46d5b34c9 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n>>      @@ .github/workflows/main.yml: jobs:\n>>            if: needs.ci-config.outputs.enabled == 'yes'\n>>       \n>>        ## Makefile ##\n>>      -@@ Makefile: ifndef V\n>>      - \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n>>      - \tQUIET_RC       = @echo '   ' RC $@;\n>>      - \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n>>      -+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n>>      - \tQUIET_SUBDIR0  = +@subdir=\n>>      - \tQUIET_SUBDIR1  = ;$(NO_SUBDIR) echo '   ' SUBDIR $$subdir; \\\n>>      - \t\t\t $(MAKE) $(PRINT_DIR) -C $$subdir\n>>       @@ Makefile: coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n>>        # See contrib/coccinelle/README\n>>        coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n>>      @@ ci/run-static-analysis.sh (deleted)\n>>       -\n>>       -make hdr-check ||\n>>       -exit 1\n>>      +\n>>      + ## shared.mak ##\n>>      +@@ shared.mak: ifndef V\n>>      + \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n>>      + \tQUIET_RC       = @echo '   ' RC $@;\n>>      + \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n>>      ++\tQUIET_CHECK    = @echo '   ' CHECK $@;\n>>      +\n>>      + ## Used in \"Documentation/Makefile\"\n>>      + \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n>>   8:  95cd496868e =  8:  81e06f13d84 CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n>>   9:  a1d0796259e =  9:  3be91c26d44 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n>> 10:  b6a61a786c5 = 10:  9dc148341ba CI: consistently use \"export\" in ci/lib.sh\n>> 11:  f2fcee5d6e4 = 11:  e9c7ba492e8 CI: export variables via a wrapper\n>> 12:  dfd823f2e7d = 12:  86d5a48d59a CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n>> 13:  46459fff296 = 13:  649ad1ae249 CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n>> 14:  aecd3ebaafe = 14:  b1b5b083389 CI: invoke \"make artifacts-tar\" directly in windows-build\n>> 15:  4f1564af70f = 15:  dfa91ac8938 CI: split up and reduce \"ci/test-documentation.sh\"\n>> 16:  868613a5b06 = 16:  ba4ed216769 CI: combine ci/install{,-docker}-dependencies.sh\n>> 17:  5d854e8ff36 = 17:  b5e89a33340 CI: move \"env\" definitions into ci/lib.sh\n>> 18:  a6106525b7f = 18:  571f4d0f441 ci/run-test-slice.sh: replace shelling out with \"echo\"\n>> 19:  e9c6c4dd293 = 19:  2edea06ee4d CI: pre-select test slice in Windows & VS tests\n>> 20:  40d86e8c1dc = 20:  ef9daa6882f CI: only invoke ci/lib.sh as \"steps\" in main.yml\n>> 21:  abf9c504740 = 21:  44e3ace5fbe CI: narrow down variable definitions in --build and --test\n>> 22:  9f4c2798a82 = 22:  5f56b922e08 CI: add more variables to MAKEFLAGS, except under vs-build\n>> 23:  8a8b7ecf16b ! 23:  b45b7cec94e CI: stop over-setting the $CC variable\n>>      @@ Metadata\n>>       Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>>       \n>>        ## Commit message ##\n>>      -    CI: stop over-setting the $CC variable\n>>      +    CI: set CC in MAKEFLAGS directly, don't add it to the environment\n>>       \n>>      -    As detailed in 2c8921db2b8 (travis-ci: build with the right compiler,\n>>      -    2019-01-17) the reason we started using $CC in $MAKEFLAGS as opposed\n>>      -    to setting it in the environment was due to Travis CI clobbering $CC\n>>      -    in the environment.\n>>      +    Rather than pass a \"$CC\" and \"$CC_PACKAGE\" in the environment to be\n>>      +    picked up in ci/lib.sh let's instead have ci/lib.sh itself add it\n>>      +    directly to MAKEFLAGS.\n>>       \n>>      -    We don't need to set it unconditionally to accomplish that, but rather\n>>      -    just have it set for those jobs that need them. E.g. the \"win+VS\n>>      -    build\" job confusingly has CC=gcc set, even though it builds with\n>>      -    MSVC.\n>>      +    Setting CC=gcc by default made for confusing trace output, and since a\n>>      +    preceding change to carry it and others over across \"steps\" in the\n>>      +    GitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\n>>      +    confusingly has CC=gcc set, even though it builds with MSVC.\n>>      +\n>>      +    Let's instead reply on the Makefile default of CC=cc, and only\n>>      +    override it for those jobs where it's needed. This does mean that\n>>      +    we'll need to set it for the \"pedantic\" job, which previously relied\n>>      +    on the default CC=gcc in case \"clang\" become the default on that\n>>      +    platform.\n>>       \n>>           This partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n>>           \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n>>      @@ ci/lib.sh: linux-TEST-vars)\n>>        \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n>>        \t;;\n>>        pedantic)\n>>      ++\tCC=gcc\n>>      + \t# Don't run the tests; we only care about whether Git can be\n>>      + \t# built.\n>>      + \tsetenv --build DEVOPTS pedantic\n>>       @@ ci/lib.sh: linux-musl)\n>>        \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n>>        \t;;\n>> 24:  d7b472b4a52 = 24:  06bf8d9f61b CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n>> 25:  08a9776c259 = 25:  6dc96ba8b82 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n> \n"},{"id":"453905","messageId":"55271bbe-7b6e-7c92-7337-2439a2f5be26@talktalk.net","threadId":"57451","inReplyTo":"patch-v4-30.31-94abb826627-20220418T132809Z-avarab@gmail.com","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Phillip Wood","fromEmail":"phillip.wood@talktalk.net","sentAt":"2022-04-18T18:38:07Z","receivedAt":"2022-04-18T18:38:15Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 18/04/2022 17:29, Ævar Arnfjörð Bjarmason wrote:\n> Fix a regression in 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n> \"$jobname\" to select packages & config, 2021-11-23). In that commit I\n> changed CC=gcc from CC=gcc-9, but on OSX the \"gcc\" in $PATH points to\n> clang, we need to use gcc-9 instead.\n\nAs this is fixing a bug in master, perhaps it would be better as a \nseparate patch that can be merged before this series (this series could \nbe rebased on to the fix)\n\nBest Wishes\n\nPhillip\n\n> Reported-by: Carlo Arenas <carenas@gmail.com>\n> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n> ---\n>   ci/lib.sh | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/ci/lib.sh b/ci/lib.sh\n> index ab7546800e0..8f80be4c3df 100755\n> --- a/ci/lib.sh\n> +++ b/ci/lib.sh\n> @@ -179,7 +179,7 @@ linux-TEST-vars)\n>   \t;;\n>   osx-gcc)\n>   \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n> -\tCC=gcc\n> +\tCC=gcc-9\n>   \t;;\n>   osx-clang)\n>   \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n\n"},{"id":"453920","messageId":"220419.86r15t8llw.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"CAPig+cQi1sRt_fMi13LtFvDL3J3ZcNaOzTugQaN-T41YAgw5Nw@mail.gmail.com","subject":"Re: [PATCH v4 31/31] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-19T09:31:35Z","receivedAt":"2022-04-19T09:32:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Mon, Apr 18 2022, Eric Sunshine wrote:\n\n> On Mon, Apr 18, 2022 at 12:29 PM Ævar Arnfjörð Bjarmason\n> <avarab@gmail.com> wrote:\n>> In preceding commits the ci/.sh scripts have lost most of their\n>> CI-specific assumptions. Let's go even further and explicitly support\n>> running ci/lib.sh outside of CI.\n>>\n>> This was possible before by faking up enough CI-specific variables,\n>> but as shown in the new \"help\" output being added here using the\n>> ci/lib.sh to provide \"CI-like\" has now become trivial.\n>>\n>> The ci/print-test-failures.sh scripts can now be used outside of CI as\n>> well, the only GitHub CI-specific part is now guarded by a check that\n>> we'll pass if outside of GitHub CI.\n>>\n>> There's also a special-case here to not clobber $MAKEFLAGS in the\n>> environment if we're outside of CI, in case the user has e.g. \"jN\" or\n>> other flags to \"make\" that they'd prefer configured already.\n>>\n>> Using \"ci/lib.sh\" as a stand-alone script is much more useful if it\n>> doesn't hardcode NPROC=10, let's provide a poor shellscript\n>> replacement for the online_cpus() we have in thread-utils.c to cover\n>> the most common OS's. It was suggested to use \"2>&1\" to invoke\n>> \"command -v\", but per my reading of [2] and my own testing that\n>> doesn't seem to be needed. Perhaps it's only needed for \"which(1)\"?\n>\n> Not redirecting stderr makes sense. I almost certainly accidentally\n> typed \"type foo\" reflexively even though I meant to type \"command -v\n> foo\", which explains why I thought redirecting stderr was needed. The\n> explanation above probably would have best been done simply as a reply\n> to the review thread rather than as part of the commit message, but\n> dropping it from the commit message is not worth a reroll.\n\nThanks. I figured including it was worthwhile, since I'd probably on\nanother day have looked at it & mixed them up the same way, i.e. you\nneed the redirection for \"which\"...\n\n>> 1. https://lore.kernel.org/git/214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com/\n>> 2. https://pubs.opengroup.org/onlinepubs/009604499/utilities/command.html\n>>\n>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n>> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n>> ---\n>> diff --git a/ci/lib-online_cpus.sh b/ci/lib-online_cpus.sh\n>> @@ -0,0 +1,26 @@\n>> +# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n>> +# that presents a chicken & egg problem. But if we move it to a\n>> +# stand-oline command...\n>\n> Um, what's a \"stand-oline\"?\n\nTypo for stand-alone, sorry.\n"},{"id":"453954","messageId":"xmqqh76orx3v.fsf@gitster.g","threadId":"57451","inReplyTo":"55271bbe-7b6e-7c92-7337-2439a2f5be26@talktalk.net","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-20T08:13:24Z","receivedAt":"2022-04-20T08:13:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood@talktalk.net> writes:\n\n> On 18/04/2022 17:29, Ævar Arnfjörð Bjarmason wrote:\n>> Fix a regression in 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n>> \"$jobname\" to select packages & config, 2021-11-23). In that commit I\n>> changed CC=gcc from CC=gcc-9, but on OSX the \"gcc\" in $PATH points to\n>> clang, we need to use gcc-9 instead.\n>\n> As this is fixing a bug in master, perhaps it would be better as a\n> separate patch that can be merged before this series (this series\n> could be rebased on to the fix)\n\nYeah, that sounds quite sensible.\n\nOr perhaps start from 'master', merge this (and other fixes, if\nthere are, in this series), merge Dscho's CI updates and then use\nthat as an updated base?\n\n\n"},{"id":"453967","messageId":"52382f7c-5b6a-63b6-2eb2-26c12f31f529@gmail.com","threadId":"57451","inReplyTo":"xmqqh76orx3v.fsf@gitster.g","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2022-04-20T10:11:09Z","receivedAt":"2022-04-20T10:11:17Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"On 20/04/2022 09:13, Junio C Hamano wrote:\n> Phillip Wood <phillip.wood@talktalk.net> writes:\n> \n>> On 18/04/2022 17:29, Ævar Arnfjörð Bjarmason wrote:\n>>> Fix a regression in 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n>>> \"$jobname\" to select packages & config, 2021-11-23). In that commit I\n>>> changed CC=gcc from CC=gcc-9, but on OSX the \"gcc\" in $PATH points to\n>>> clang, we need to use gcc-9 instead.\n>>\n>> As this is fixing a bug in master, perhaps it would be better as a\n>> separate patch that can be merged before this series (this series\n>> could be rebased on to the fix)\n> \n> Yeah, that sounds quite sensible.\n> \n> Or perhaps start from 'master', merge this (and other fixes, if\n> there are, in this series), merge Dscho's CI updates and then use\n> that as an updated base?\n\nIt would certainly be nice to get Dscho's updates merged sooner rather \nthan later as I think they represent a more significant improvement for \nCI users. There is a complication though in that Dscho's series adds \ngithub markup to the build output and this series separates the build \nfrom the tests which means that is not necessary. I think it should be \neasy enough to change Dscho's series so it only uses github markup for \nthe tests which is the main improvement and just wait for the build and \ntests to be separated in this series (ideally they'd be a short easy to \nreview series that did just that).\n\nBest Wishes\n\nPhillip\n"},{"id":"453996","messageId":"xmqqr15rpp9b.fsf@gitster.g","threadId":"57451","inReplyTo":"52382f7c-5b6a-63b6-2eb2-26c12f31f529@gmail.com","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-20T18:45:52Z","receivedAt":"2022-04-20T18:46:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Phillip Wood <phillip.wood123@gmail.com> writes:\n\n> ... There is a complication though in that Dscho's series\n> adds github markup to the build output and this series separates the\n> build from the tests which means that is not necessary. I think it\n> should be easy enough to change Dscho's series so it only uses github\n> markup for the tests which is the main improvement and just wait for\n> the build and tests to be separated in this series (ideally they'd be\n> a short easy to review series that did just that).\n\nOK, Dscho, Ævar, does that sound like a workable plan?  See a reroll\nof Dscho's series (which Phillip considers \"should be easy enough\")\nfirst, get it solid enough and merge down to 'next', and then see\nthe refactoring by Ævar on top, hopefully with a minumum churn that\nmakes it impossible for people to review?\n\nThanks, all.\n"},{"id":"454068","messageId":"nycvar.QRO.7.76.6.2204211454500.355@tvgsbejvaqbjf.bet","threadId":"57451","inReplyTo":"xmqqr15rpp9b.fsf@gitster.g","subject":"js/ci-github-workflow-markup, was Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2022-04-21T12:57:02Z","receivedAt":"2022-04-21T12:57:46Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio,\n\nOn Wed, 20 Apr 2022, Junio C Hamano wrote:\n\n> OK, Dscho, Ævar, does that sound like a workable plan?  See a reroll\n> of Dscho's series (which Phillip considers \"should be easy enough\")\n> first, get it solid enough and merge down to 'next', and then see\n> the refactoring by Ævar on top, hopefully with a minumum churn that\n> makes it impossible for people to review?\n\nThat works for me. Give me a few more days to catch up and then I will\nsend a new iteration of my patch series.\n\nThanks,\nDscho\n"},{"id":"454100","messageId":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v4-00.31-00000000000-20220418T132809Z-avarab@gmail.com","subject":"[PATCH v5 00/29] CI: run \"make\" in CI \"steps\", improve UX","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:22:55Z","receivedAt":"2022-04-21T18:23:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This series changes CI \"step\" targets that are shellscripts that do N\nthings to instead be single command invocations at the \"step\" level,\ndriven by the CI recipe itself.\n\nTo do that we need to pass state that we previously re-setup for every\n\"step\" via $GITHUB_ENV, whose state we then helpfully show (this is just\na standard GitHub CI feature) in a drop-down at the start of every\n\"step\".\n\nI.e. at the tip of this series you can reliably look at that\n$GITHUB_ENV view to see what the full and relevant environment was for\nthat \"make\", \"make test\" or whatever.\n\nChange since v4:\n\n * Minor UX improvements for 29/29, e.g. \"error: \" prefixes for error\n   messages.\n * Addressed feedback from Phillip Wood at\n   https://lore.kernel.org/git/1157a463-f6c6-1df5-59cd-419d73eed1df@gmail.com/:\n\n   - That bash-specific ${../../} syntax is gone\n   - The inverted \"skip-test: no\" is now a \"skip-test: yes\", as it should be.\n\n   - The new \"trace\" output from ci/lib.sh now doesn't have \"SKIP\"\n     lines, i.e. we just say what variables we do set, not what we\n     don't set. E.g.:\n     https://github.com/avar/git/runs/6093145633?check_suite_focus=true#step:4:13\n\n   - I looked at the \"a lot of churn\" comment, there's e.g. \"CI:\n     export variables via a wrapper\" where we first make a wrapper to\n     \"export\" variables, then make further use of it, some of which\n     involves touching the same lines again.\n\n     Likewise first invoking ci/lib.sh, then splitting that up into\n     ci/lib.sh --build and ci/lib.sh --test.\n\n     I looked at squashing some of that together, but I think it\n     really makes it harder to review & reason about to do N things at\n     the same time, even if the net diff size is bigger.\n * Squashed together two commits that were adjusting bash syntax to be\n   POSIX syntax.\n * For the pedantic job that skips tests the \"ci/lib.sh --test\" step\n   of setting up variables for it is now also skipped. See:\n   https://github.com/avar/git/runs/6093144782?check_suite_focus=true\n * Made ci/select-test-slice.sh do the same \"are we in GitHub CI?\"\n   check as the rest of the scripts, it's now easier to run it\n   stand-alone for testing.\n * Adjusted usage output, made it friendlier, moved those UX bits over\n   to a test_commit-like getopts parsing.\n * Fixed a typo/commit message suggestion by Eric Sunshine.\n\n * This series contained a regression fix for an issue already on\n   \"master\", which I've split out in\n   https://lore.kernel.org/git/patch-v2-1.1-92acf9420a9-20220421T174733Z-avarab@gmail.com/\n\n   When the two are merged there's a conflict that's resolved thusly,\n   per a --remerge-diff (which I snipped away with [...]). I.e. gcc-8\n   and gcc-9 need to be added to the linux-gcc and osx-gcc part of\n   ci/lib.sh:\n\t\n\tdiff --git a/ci/lib.sh b/ci/lib.sh\n\tremerge CONFLICT (content): Merge conflict in ci/lib.sh\n\tindex 407e994edcd..a4e9d51ad6c 100755\n\t--- a/ci/lib.sh\n\t+++ b/ci/lib.sh\n\t@@ -30,126 +30,6 @@ usage() {\n\t \tthen\n\t \t\techo \"$CI_TYPE_HELP\" >&2\n\t \tfi\n\t-<<<<<<< ca24940186b (Merge branch 'avar/ci-have-osx-p4-install-fall-back-on-sha256-no-check' into build-master)\n\t-=======\n\t[...snipped ~100 lines ... ]\n\t->>>>>>> 92acf9420a9 (CI: select CC based on CC_PACKAGE (again))\n\t \texit 1\n\t }\n\t \n\t@@ -373,7 +253,7 @@ vs-test)\n\t \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n\t \t;;\n\t linux-gcc)\n\t-\tCC=gcc\n\t+\tCC=gcc-8\n\t \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n\t \t;;\n\t linux-gcc-default)\n\t@@ -397,7 +277,7 @@ linux-TEST-vars)\n\t \t;;\n\t osx-gcc)\n\t \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n\t-\tCC=gcc\n\t+\tCC=gcc-9\n\t \t;;\n\t osx-clang)\n\t \tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n\nÆvar Arnfjörð Bjarmason (29):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: make \"$jobname\" explicit, remove fallback\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: remove unused Azure ci/* code\n  CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n  CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n  CI: make ci/{lib,install-dependencies}.sh POSIX-compatible\n  CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n  CI: invoke \"make artifacts-tar\" directly in windows-build\n  CI: split up and reduce \"ci/test-documentation.sh\"\n  CI: combine ci/install{,-docker}-dependencies.sh\n  CI: move \"env\" definitions into ci/lib.sh\n  ci/run-test-slice.sh: replace shelling out with \"echo\"\n  CI: pre-select test slice in Windows & VS tests\n  CI: only invoke ci/lib.sh as \"steps\" in main.yml\n  CI: narrow down variable definitions in --build and --test\n  CI: add more variables to MAKEFLAGS, except under vs-build\n  CI: set CC in MAKEFLAGS directly, don't add it to the environment\n  CI: set SANITIZE=leak in MAKEFLAGS directly\n  CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n  CI: don't use \"set -x\" in \"ci/lib.sh\" output\n  CI: make it easy to use ci/*.sh outside of CI\n\n .github/workflows/main.yml            | 101 +++---\n Makefile                              |  31 +-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  82 +++--\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |   6 +\n ci/lib-online_cpus.sh                 |  26 ++\n ci/lib-tput.sh                        |   5 +\n ci/lib.sh                             | 424 ++++++++++++++++----------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  53 +---\n ci/run-build-and-tests.sh             |  54 ----\n ci/run-docker-build.sh                |  66 ----\n ci/run-docker.sh                      |  47 ---\n ci/run-static-analysis.sh             |  32 --\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  13 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ---\n shared.mak                            |   1 +\n 22 files changed, 508 insertions(+), 618 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-online_cpus.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff against v4:\n 1:  ed27ca0b7e7 =  1:  84d8098e365 CI: run \"set -ex\" early in ci/lib.sh\n 2:  737fe1e2c4c !  2:  3f5c071b0f6 CI: make \"$jobname\" explicit, remove fallback\n    @@ ci/lib.sh\n     +# Starting assertions\n     +if test -z \"$jobname\"\n     +then\n    -+\techo \"must set a CI jobname in the environment\" >&2\n    ++\techo \"error: must set a CI jobname in the environment\" >&2\n     +\texit 1\n     +fi\n     +\n 3:  d875069fc28 =  3:  c64845a4efb CI: remove more dead Travis CI support\n 4:  2590459db33 =  4:  45856e67d5d CI: remove dead \"tree skipping\" code\n 5:  e311ea8b9b3 =  5:  d4671148eb7 CI: remove unused Azure ci/* code\n 6:  151f28e3818 =  6:  45ea80d0495 CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n 7:  6c2a8ee9c4e =  7:  a264b40ba0d CI: don't have \"git grep\" invoke a pager in tree content check\n 8:  64a0a1fc8ce =  8:  4a58f7be8d4 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n 9:  0f780bf9e3c =  9:  78c0c81af43 CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n10:  3cdeae9c141 = 10:  07e36035a1e CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n11:  1d3d357dcef = 11:  272bd590a95 CI: consistently use \"export\" in ci/lib.sh\n12:  5ef0756d095 = 12:  ea35327e24c CI: export variables via a wrapper\n13:  e0ce614eb6d ! 13:  f6ff81f48ab CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n    @@ .github/workflows/main.yml: jobs:\n                image: daald/ubuntu32:xenial\n              - jobname: pedantic\n                image: fedora\n    -+          skip-tests: no\n    ++          skip-tests: yes\n          env:\n            jobname: ${{matrix.vector.jobname}}\n          runs-on: ubuntu-latest\n    @@ .github/workflows/main.yml: jobs:\n     +    - run: ci/lib.sh\n     +    - run: make\n     +    - run: make test\n    -+      if: success() && matrix.vector.skip-tests != 'no'\n    ++      if: success() && matrix.vector.skip-tests != 'yes'\n          - run: ci/print-test-failures.sh\n     -      if: failure()\n    -+      if: failure() && matrix.vector.skip-tests != 'no'\n    ++      if: failure() && matrix.vector.skip-tests != 'yes'\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v1\n14:  a8e70124929 <  -:  ----------- ci/lib.sh: use \"test\" instead of \"[\"\n18:  eec7a11376e ! 14:  533dbc50c4f CI: make ci/install-dependencies.sh POSIX-compatible\n    @@ Metadata\n     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## Commit message ##\n    -    CI: make ci/install-dependencies.sh POSIX-compatible\n    +    CI: make ci/{lib,install-dependencies}.sh POSIX-compatible\n     \n         Change the unportable constructs in the \"ci/install-dependencies.sh\"\n         scripts to use POSIX replacements, and have it run under \"/bin/sh\"\n    @@ Commit message\n         \"ci/install-docker-dependencies.sh\", which doesn't have access to\n         \"bash\".\n     \n    +    While we're at it change \"if [\" to \"if test\" in ci/lib.sh. This isn't\n    +    strictly speaking a case of POSIX-incompatibility, but that syntax was\n    +    being used there because this code was using idiomatic bash\n    +    constructs. Let's have it use our usual style of \"if test\" instead.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/install-dependencies.sh ##\n    @@ ci/install-dependencies.sh: ubuntu-latest)\n      \t# Uncomment this if you want to run perf tests:\n      \t# brew install gnu-time\n      \tbrew link --force gettext\n    +@@ ci/install-dependencies.sh: macos-latest)\n    + \n    + \tif test -n \"$CC_PACKAGE\"\n    + \tthen\n    +-\t\tBREW_PACKAGE=${CC_PACKAGE/-/@}\n    ++\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n    + \t\tbrew install \"$BREW_PACKAGE\"\n    + \t\tbrew link \"$BREW_PACKAGE\"\n    + \tfi\n    +\n    + ## ci/lib.sh ##\n    +@@ ci/lib.sh: ubuntu-latest)\n    + \t\tbreak\n    + \tfi\n    + \n    +-\tif [ \"$jobname\" = linux-gcc ]\n    ++\tif test \"$jobname\" = linux-gcc\n    + \tthen\n    + \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n    + \telse\n    +@@ ci/lib.sh: ubuntu-latest)\n    + \tsetenv --test GIT_TEST_HTTPD true\n    + \t;;\n    + macos-latest)\n    +-\tif [ \"$jobname\" = osx-gcc ]\n    ++\tif test \"$jobname\" = osx-gcc\n    + \tthen\n    + \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n    + \telse\n15:  bb335d1c0ca = 15:  6044c2b383f CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n16:  5458e6dab0b = 16:  4d1a9f88c32 CI: invoke \"make artifacts-tar\" directly in windows-build\n17:  5e5a5b71700 = 17:  5c8f464a60f CI: split up and reduce \"ci/test-documentation.sh\"\n19:  a9c98582de1 = 18:  a218be76819 CI: combine ci/install{,-docker}-dependencies.sh\n20:  96e7eb68906 = 19:  83e21b4f501 CI: move \"env\" definitions into ci/lib.sh\n21:  fdbe8554f5d = 20:  fd0e1610577 ci/run-test-slice.sh: replace shelling out with \"echo\"\n22:  f257ab59971 ! 21:  0c7cd9d64ba CI: pre-select test slice in Windows & VS tests\n    @@ ci/run-test-slice.sh => ci/select-test-slice.sh\n      tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n      \tt[0-9]*.sh))\n     -make --quiet -C t T=\"$tests\"\n    -+echo T=\"$tests\" >>$GITHUB_ENV\n    ++if test -n \"$GITHUB_ENV\"\n    ++then\n    ++\techo T=\"$tests\" >>$GITHUB_ENV\n    ++fi\n23:  1d95088da29 = 22:  1b077665352 CI: only invoke ci/lib.sh as \"steps\" in main.yml\n24:  a7434b215db ! 23:  1867da7eddb CI: narrow down variable definitions in --build and --test\n    @@ Commit message\n         fewer, which makes diagnosing anything going on there easier, as we\n         won't have to look at a deluge of e.g. GIT_TEST_* variables.\n     \n    +    For the \"pedantic\" job (which has no test phase) we won't run the\n    +    \"ci/lib.sh --test\" step, which will be clearly visible as a skipped\n    +    step in the UX.\n    +\n         Since we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\n         test\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\n         steps, i.e. the one with PYTHON_PATH, CC etc. These will all be\n    @@ .github/workflows/main.yml: jobs:\n     +    - run: ci/lib.sh --build\n          - run: make\n     +    - run: ci/lib.sh --test\n    ++      if: success() && matrix.vector.skip-tests != 'yes'\n          - run: make test\n    -       if: success() && matrix.vector.skip-tests != 'no'\n    +       if: success() && matrix.vector.skip-tests != 'yes'\n          - run: ci/print-test-failures.sh\n     @@ .github/workflows/main.yml: jobs:\n          steps:\n    @@ .github/workflows/main.yml: jobs:\n     \n      ## ci/lib.sh ##\n     @@ ci/lib.sh: set -ex\n    + # Helper libraries\n      . ${0%/*}/lib-ci-type.sh\n      \n    ++# Parse options\n    ++mode_build=\n    ++mode_test=\n    ++while test $# != 0\n    ++do\n    ++\tcase \"$1\" in\n    ++\t--build)\n    ++\t\tmode_build=t\n    ++\t\t;;\n    ++\t--test)\n    ++\t\tmode_test=t\n    ++\t\t;;\n    ++\t-*)\n    ++\t\techo \"error: invalid option: $1\" >&2\n    ++\t\texit 1\n    ++\t\t;;\n    ++\t*)\n    ++\t\techo \"error: invalid argument: $1\" >&2\n    ++\t\texit 1\n    ++\t\t;;\n    ++\tesac\n    ++\tshift\n    ++done\n    ++\n      # Starting assertions\n    -+mode=$1\n    -+if test -z \"$mode\"\n    + if test -z \"$jobname\"\n    + then\n    +@@ ci/lib.sh: then\n    + \texit 1\n    + fi\n    + \n    ++if test \"$mode_test$mode_build\" != \"t\"\n     +then\n    -+\techo \"need a $0 mode, e.g. --build or --test\" >&2\n    ++\techo \"error: need one mode, e.g. --build or --test\" >&2\n     +\texit 1\n     +fi\n     +\n    - if test -z \"$jobname\"\n    - then\n    - \techo \"must set a CI jobname in the environment\" >&2\n    -@@ ci/lib.sh: setenv () {\n    + # Helper functions\n    + setenv () {\n      \twhile test $# != 0\n      \tdo\n      \t\tcase \"$1\" in\n    --\t\t--build)\n    --\t\t\t;;\n    --\t\t--test)\n    + \t\t--build)\n    ++\t\t\tif test -z \"$mode_build\"\n    ++\t\t\tthen\n    ++\t\t\t\treturn 0\n    ++\t\t\tfi\n    + \t\t\t;;\n    + \t\t--test)\n     -\t\t\t;;\n     -\t\t--all)\n    -+\t\t--build | --test)\n    -+\t\t\tif test \"$1\" != \"$mode\"\n    ++\t\t\tif test -z \"$mode_test\"\n     +\t\t\tthen\n     +\t\t\t\treturn 0\n     +\t\t\tfi\n    -+\n      \t\t\t;;\n      \t\t-*)\n      \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n25:  78f4609a9c1 = 24:  a4e3a9d2c28 CI: add more variables to MAKEFLAGS, except under vs-build\n26:  26a34f1d4b9 ! 25:  48d99cee809 CI: set CC in MAKEFLAGS directly, don't add it to the environment\n    @@ Commit message\n         \"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\n         aiming to only set those variables specific jobs need.\n     \n    +    Since we don't need to make this generic enough to handle \"gcc-9\"\n    +    turning into \"gcc@9\" for \"brew install\" let's remove what was\n    +    originally a bash-specific replacement in 707d2f2fe86 (CI: use\n    +    \"$runs_on_pool\", not \"$jobname\" to select packages & config,\n    +    2021-11-23), and which a preceding commit changed to a \"tr\"\n    +    invocation.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## .github/workflows/main.yml ##\n    @@ ci/install-dependencies.sh: UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl\n       libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n      \n     +CC_PACKAGE=\n    ++BREW_CC_PACKAGE=\n     +case \"$jobname\" in\n     +linux-gcc | linux-TEST-vars)\n     +\tCC_PACKAGE=gcc-8\n     +\t;;\n     +osx-gcc)\n    -+\tCC_PACKAGE=gcc-9\n    ++\tBREW_CC_PACKAGE=gcc@9\n     +\t;;\n     +esac\n     +\n      case \"$runs_on_pool\" in\n      ubuntu-latest)\n      \t# The Linux build installs the defined dependency versions below.\n    +@@ ci/install-dependencies.sh: macos-latest)\n    + \t} ||\n    + \tbrew install homebrew/cask/perforce\n    + \n    +-\tif test -n \"$CC_PACKAGE\"\n    ++\tif test -n \"$BREW_CC_PACKAGE\"\n    + \tthen\n    +-\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n    +-\t\tbrew install \"$BREW_PACKAGE\"\n    +-\t\tbrew link \"$BREW_PACKAGE\"\n    ++\t\tbrew install \"$BREW_CC_PACKAGE\"\n    ++\t\tbrew link \"$BREW_CC_PACKAGE\"\n    + \tfi\n    + \t;;\n    + esac\n     \n      ## ci/lib.sh ##\n     @@ ci/lib.sh: setenv () {\n27:  514de8d16b0 = 26:  07a6c087297 CI: set SANITIZE=leak in MAKEFLAGS directly\n28:  6501059c594 = 27:  50f21ffdffe CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n29:  1bdcf1399d9 ! 28:  e35dff2bef3 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n    @@ Commit message\n         script doesn't \"set -x\" and will act differently depending on the\n         $CI_TYPE.\n     \n    +    It's useful when developing this script to see what variables\n    +    it *doesn't* set, but such output isn't useful to users, so let's hide\n    +    the \"SKIP\" output behind a --debug option.\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## ci/lib.sh ##\n    @@ ci/lib.sh\n      \n      # Helper libraries\n      . ${0%/*}/lib-ci-type.sh\n    +@@ ci/lib.sh: set -ex\n    + # Parse options\n    + mode_build=\n    + mode_test=\n    ++mode_debug=\n    + while test $# != 0\n    + do\n    + \tcase \"$1\" in\n    + \t--build)\n    ++\t\techo \"MODE: $1\" >&2\n    + \t\tmode_build=t\n    + \t\t;;\n    + \t--test)\n    ++\t\techo \"MODE: $1\" >&2\n    + \t\tmode_test=t\n    + \t\t;;\n    ++\t--debug)\n    ++\t\techo \"DEBUG: $1\" >&2\n    ++\t\tmode_debug=t\n    ++\t\t;;\n    + \t-*)\n    + \t\techo \"error: invalid option: $1\" >&2\n    + \t\texit 1\n     @@ ci/lib.sh: then\n      \texit 1\n      fi\n    @@ ci/lib.sh: then\n     +echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n     +echo \"CONFIG: jobname=$jobname\" >&2\n     +echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n    -+echo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n     +if test -n \"$GITHUB_ENV\"\n     +then\n     +\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n     +fi\n    ++echo >&2\n     +\n      # Helper functions\n      setenv () {\n    -+\tlocal skip=\n    ++\tskip=\n      \twhile test $# != 0\n      \tdo\n      \t\tcase \"$1\" in\n    - \t\t--build | --test)\n    - \t\t\tif test \"$1\" != \"$mode\"\n    + \t\t--build)\n    + \t\t\tif test -z \"$mode_build\"\n    + \t\t\tthen\n    +-\t\t\t\treturn 0\n    ++\t\t\t\tskip=t\n    + \t\t\tfi\n    + \t\t\t;;\n    + \t\t--test)\n    + \t\t\tif test -z \"$mode_test\"\n      \t\t\tthen\n     -\t\t\t\treturn 0\n     +\t\t\t\tskip=t\n      \t\t\tfi\n    - \n      \t\t\t;;\n    + \t\t-*)\n     @@ ci/lib.sh: setenv () {\n      \tval=$2\n      \tshift 2\n      \n     +\tif test -n \"$skip\"\n     +\tthen\n    -+\t\techo \"SKIP '$key=$val'\" >&2\n    ++\t\tif test -n \"$mode_debug\"\n    ++\t\tthen\n    ++\t\t\techo \"SKIP: '$key=$val'\" >&2\n    ++\t\tfi\n     +\t\treturn 0\n     +\tfi\n     +\n30:  94abb826627 <  -:  ----------- CI: have osx-gcc use gcc, not clang\n31:  4fc67e668da ! 29:  13d8c6997c3 CI: make it easy to use ci/*.sh outside of CI\n    @@ Commit message\n         Using \"ci/lib.sh\" as a stand-alone script is much more useful if it\n         doesn't hardcode NPROC=10, let's provide a poor shellscript\n         replacement for the online_cpus() we have in thread-utils.c to cover\n    -    the most common OS's. It was suggested to use \"2>&1\" to invoke\n    -    \"command -v\", but per my reading of [2] and my own testing that\n    -    doesn't seem to be needed. Perhaps it's only needed for \"which(1)\"?\n    -\n    -    1. https://lore.kernel.org/git/214f8670-91d5-f4b6-efa1-76966c3ab1ee@sunshineco.com/\n    -    2. https://pubs.opengroup.org/onlinepubs/009604499/utilities/command.html\n    +    the most common OS's.\n     \n         Helped-by: Eric Sunshine <sunshine@sunshineco.com>\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n    @@ ci/lib-online_cpus.sh (new)\n     +#!/bin/sh\n     +\n     +# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n    -+# that presents a chicken & egg problem. But if we move it to a\n    -+# stand-oline command...\n    ++# that currently presents a chicken & egg problem. We need this before\n    ++# we build (much of) anything.\n     +online_cpus() {\n     +\tNPROC=\n     +\n    @@ ci/lib.sh\n      #!/bin/sh\n      set -e\n      \n    -+#  Usage\n    ++# Usage\n     +CI_TYPE_HELP_COMMANDS='\n     +\t# run \"make all test\" like the \"linux-leaks\" job\n     +\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n    @@ ci/lib.sh\n     +'\n     +\n     +CI_TYPE_HELP=\"\n    -+running $0 outside of CI? You can use ci/lib.sh to set up your\n    ++Running $0 outside of CI? You can use ci/lib.sh to set up your\n     +environment like a given CI job. E.g.:\n     +$CI_TYPE_HELP_COMMANDS\n    -+\n    -+note that some of these (e.g. the linux-musl one) may not work as\n    ++Note that some of these (e.g. the linux-musl one) may not work as\n     +expected due to the CI job configuring a platform that may not match\n     +yours.\"\n     +\n    - # Helper libraries\n    - . ${0%/*}/lib-ci-type.sh\n    - \n    -@@ ci/lib.sh: mode=$1\n    - if test -z \"$mode\"\n    - then\n    - \techo \"need a $0 mode, e.g. --build or --test\" >&2\n    ++usage() {\n    ++\techo \"usage: jobname=<job-name> [runs_on_pool=<pool-name>] $0 (--build | --test)\" >&2\n     +\tif test -z \"$CI_TYPE\"\n     +\tthen\n     +\t\techo \"$CI_TYPE_HELP\" >&2\n     +\tfi\n    - \texit 1\n    ++\texit 1\n    ++}\n    ++\n    + # Helper libraries\n    + . ${0%/*}/lib-ci-type.sh\n    + \n    + # Parse options\n    ++mode_all=\n    + mode_build=\n    + mode_test=\n    + mode_debug=\n    + while test $# != 0\n    + do\n    + \tcase \"$1\" in\n    ++\t--all)\n    ++\t\techo \"MODE: $1\" >&2\n    ++\t\tmode_all=t\n    ++\t\tmode_build=t\n    ++\t\tmode_test=t\n    ++\t\t;;\n    + \t--build)\n    + \t\techo \"MODE: $1\" >&2\n    + \t\tmode_build=t\n    +@@ ci/lib.sh: do\n    + \t\t;;\n    + \t-*)\n    + \t\techo \"error: invalid option: $1\" >&2\n    +-\t\texit 1\n    ++\t\tusage\n    + \t\t;;\n    + \t*)\n    + \t\techo \"error: invalid argument: $1\" >&2\n    +-\t\texit 1\n    ++\t\tusage\n    + \t\t;;\n    + \tesac\n    + \tshift\n    +@@ ci/lib.sh: done\n    + if test -z \"$jobname\"\n    + then\n    + \techo \"error: must set a CI jobname in the environment\" >&2\n    +-\texit 1\n    ++\tusage\n      fi\n      \n    +-if test \"$mode_test$mode_build\" != \"t\"\n    ++if test \"$mode_test$mode_build\" != \"t\" && test -z \"$mode_all\"\n    + then\n    + \techo \"error: need one mode, e.g. --build or --test\" >&2\n    +-\texit 1\n    ++\tusage\n    + fi\n    + \n    + # Show our configuration\n     @@ ci/lib.sh: setenv () {\n      \tdo\n      \t\tcase \"$1\" in\n    - \t\t--build | --test)\n    --\t\t\tif test \"$1\" != \"$mode\"\n    -+\t\t\tif test \"$1\" != \"$mode\" && test \"$mode\" != \"--all\"\n    + \t\t--build)\n    +-\t\t\tif test -z \"$mode_build\"\n    ++\t\t\tif test -z \"$mode_build$mode_all\"\n    + \t\t\tthen\n    + \t\t\t\tskip=t\n    + \t\t\tfi\n    + \t\t\t;;\n    + \t\t--test)\n    +-\t\t\tif test -z \"$mode_test\"\n    ++\t\t\tif test -z \"$mode_test$mode_all\"\n      \t\t\tthen\n      \t\t\t\tskip=t\n      \t\t\tfi\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454101","messageId":"patch-v5-03.29-c64845a4efb-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 03/29] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:22:58Z","receivedAt":"2022-04-21T18:23:51Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the \"--state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nFor \"ci/print-test-failures.sh\" the creation of the tarball added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01) has been dead since my 4a6e4b96026,\nwhich removed the fall-through case from the \"case/esac\" statement.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     | 39 ---------------------\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 220 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 6d76c2d406b..648940da877 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..740ebb7c529 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -16,15 +16,6 @@ then\n \texit\n fi\n \n-case \"$jobname\" in\n-osx-clang|osx-gcc)\n-\t# base64 in OSX doesn't wrap its output at 76 columns by\n-\t# default, but prints a single, very long line.\n-\tbase64_opts=\"-b 76\"\n-\t;;\n-esac\n-\n-combined_trash_size=0\n for TEST_EXIT in test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n@@ -42,47 +33,17 @@ do\n \t\tazure-pipelines)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n \t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-\t\t\tcontinue\n \t\t\t;;\n \t\t*)\n \t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \t\t\texit 1\n \t\t\t;;\n \t\tesac\n-\t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n-\t\tif [ -d \"$trash_dir\" ]\n-\t\tthen\n-\t\t\ttar czp \"$trash_dir\" |base64 $base64_opts >\"$trash_tgz_b64\"\n-\n-\t\t\ttrash_size=$(wc -c <\"$trash_tgz_b64\")\n-\t\t\tif [ $trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\t# larger than 1MB\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\n-\t\t\tnew_combined_trash_size=$(($combined_trash_size + $trash_size))\n-\t\t\tif [ $new_combined_trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\t\t\tcombined_trash_size=$new_combined_trash_size\n-\n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n-\t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n-\t\t\tcat \"$trash_tgz_b64\"\n-\t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n-\t\tfi\n \tfi\n done\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454102","messageId":"patch-v5-01.29-84d8098e365-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 01/29] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:22:56Z","receivedAt":"2022-04-21T18:23:54Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cbc2f8f1caa..57141d38a85 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454103","messageId":"patch-v5-02.29-3f5c071b0f6-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 02/29] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:22:57Z","receivedAt":"2022-04-21T18:23:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57141d38a85..6d76c2d406b 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"error: must set a CI jobname in the environment\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454104","messageId":"patch-v5-04.29-45856e67d5d-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 04/29] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:22:59Z","receivedAt":"2022-04-21T18:23:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 648940da877..a30ab35d9c2 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC:-gcc}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454105","messageId":"patch-v5-08.29-4a58f7be8d4-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 08/29] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:03Z","receivedAt":"2022-04-21T18:23:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 28 ++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n shared.mak                 |  1 +\n 4 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex f8bccfab5e9..8717ea7e745 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3031,6 +3031,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3466,3 +3480,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\ndiff --git a/shared.mak b/shared.mak\nindex 50d4596f0d6..83e0aa16e7d 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -68,6 +68,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \n ## Used in \"Documentation/Makefile\"\n \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454106","messageId":"patch-v5-10.29-07e36035a1e-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 10/29] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:05Z","receivedAt":"2022-04-21T18:24:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex e7ea8799411..34b4400f38b 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex edf26984aeb..3ceb36c7058 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -67,18 +67,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454107","messageId":"patch-v5-11.29-272bd590a95-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 11/29] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:06Z","receivedAt":"2022-04-21T18:24:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3ceb36c7058..2e425cb787c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -30,7 +30,7 @@ export TERM=${TERM:-dumb}\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -38,9 +38,10 @@ then\n \tCC=\"${CC:-gcc}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -94,4 +95,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454108","messageId":"patch-v5-09.29-78c0c81af43-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 09/29] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:04Z","receivedAt":"2022-04-21T18:24:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8717ea7e745..2e1ae6c6067 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3402,7 +3402,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3492,5 +3492,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454109","messageId":"patch-v5-12.29-ea35327e24c-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 12/29] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:07Z","receivedAt":"2022-04-21T18:24:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore the \"varname\" parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 51 ++++++++++++++++++++++++++++++---------\n ci/run-build-and-tests.sh | 34 +++++++++++++-------------\n 2 files changed, 57 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 2e425cb787c..e36e350e74c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,35 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--build)\n+\t\t\t;;\n+\t\t--test)\n+\t\t\t;;\n+\t\t--all)\n+\t\t\t;;\n+\t\t-*)\n+\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +53,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # How many jobs to run in parallel?\n NPROC=10\n@@ -37,21 +66,21 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -67,7 +96,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -90,9 +119,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454110","messageId":"patch-v5-07.29-a264b40ba0d-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 07/29] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:02Z","receivedAt":"2022-04-21T18:24:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454111","messageId":"patch-v5-05.29-d4671148eb7-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 05/29] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:00Z","receivedAt":"2022-04-21T18:24:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  4 ----\n 4 files changed, 1 insertion(+), 44 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex dbcebad2fb2..e7ea8799411 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tbrew install --cask --no-quarantine perforce || {\n \t\t# Update the definitions and try again\n@@ -69,7 +67,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex a30ab35d9c2..a6cdcfa014b 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 740ebb7c529..47e2ea1ad10 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -30,10 +30,6 @@ do\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454112","messageId":"patch-v5-06.29-45ea80d0495-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 06/29] CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:01Z","receivedAt":"2022-04-21T18:24:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a8c51f77d16 (ci: clear and mark MAKEFLAGS exported just once,\n2019-02-07) the assignment of MAKEFLAGS was done up-front to\nfuture-proof this code for the bug fixed in 406f93ae488 (ci: make sure\nwe build Git parallel, 2019-02-07).\n\nBut since 4a6e4b96026 (CI: remove Travis CI support, 2021-11-23) the\n--jobs=10 has been an invariant here, so let's assign --jobs=$NPROC to\nthe MAKEFLAGS right away, this gets rid of the leading whitespace from\nthe $MAKEFLAGS variable, as it would previously be empty on the first\nassignment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex a6cdcfa014b..edf26984aeb 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -26,17 +26,19 @@ check_unignored_build_artifacts ()\n # GitHub Action doesn't set TERM, which is required by tput\n export TERM=${TERM:-dumb}\n \n+# How many jobs to run in parallel?\n+NPROC=10\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+export MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC:-gcc}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454113","messageId":"patch-v5-13.29-f6ff81f48ab-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 13/29] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:08Z","receivedAt":"2022-04-21T18:24:31Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 36 +++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 58 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..57b2db06923 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: yes\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'yes'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'yes'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 34b4400f38b..01006379fd0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex e36e350e74c..43231862aa5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -39,7 +41,10 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -109,6 +114,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454114","messageId":"patch-v5-14.29-533dbc50c4f-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 14/29] CI: make ci/{lib,install-dependencies}.sh POSIX-compatible","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:09Z","receivedAt":"2022-04-21T18:24:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the unportable constructs in the \"ci/install-dependencies.sh\"\nscripts to use POSIX replacements, and have it run under \"/bin/sh\"\ninstead of \"/usr/bin/env bash\". We needed to:\n\n* Replace pushd/popd with a sub-shell.\n* Change \"mkdir --parents\" to \"mkdir -p\".\n* Use POSIX \"export\" syntax.\n\nThis is in preparation for combining this script and\n\"ci/install-docker-dependencies.sh\", which doesn't have access to\n\"bash\".\n\nWhile we're at it change \"if [\" to \"if test\" in ci/lib.sh. This isn't\nstrictly speaking a case of POSIX-incompatibility, but that syntax was\nbeing used there because this code was using idiomatic bash\nconstructs. Let's have it use our usual style of \"if test\" instead.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 27 +++++++++++++++++----------\n ci/lib.sh                  |  4 ++--\n 2 files changed, 19 insertions(+), 12 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 01006379fd0..1ad4dd7db39 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -21,7 +21,8 @@ ubuntu-latest)\n \n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tPATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\texport PATH\n \tif test -n \"$GITHUB_PATH\"\n \tthen\n \t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n@@ -33,22 +34,28 @@ ubuntu-latest)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n-\tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\tmkdir -p \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n-\tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t)\n+\tmkdir -p \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n-\texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n+\tHOMEBREW_NO_AUTO_UPDATE=1\n+\texport HOMEBREW_NO_AUTO_UPDATE\n+\tHOMEBREW_NO_INSTALL_CLEANUP=1\n+\texport HOMEBREW_NO_INSTALL_CLEANUP\n+\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n \tbrew link --force gettext\n@@ -62,7 +69,7 @@ macos-latest)\n \n \tif test -n \"$CC_PACKAGE\"\n \tthen\n-\t\tBREW_PACKAGE=${CC_PACKAGE/-/@}\n+\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n \t\tbrew install \"$BREW_PACKAGE\"\n \t\tbrew link \"$BREW_PACKAGE\"\n \tfi\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 43231862aa5..2fd022c94bc 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -94,7 +94,7 @@ ubuntu-latest)\n \t\tbreak\n \tfi\n \n-\tif [ \"$jobname\" = linux-gcc ]\n+\tif test \"$jobname\" = linux-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n \telse\n@@ -104,7 +104,7 @@ ubuntu-latest)\n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n+\tif test \"$jobname\" = osx-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \telse\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454115","messageId":"patch-v5-16.29-4d1a9f88c32-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 16/29] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:11Z","receivedAt":"2022-04-21T18:24:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c97fbd0f0b3..ca993afd098 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454116","messageId":"patch-v5-17.29-5c8f464a60f-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 17/29] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:12Z","receivedAt":"2022-04-21T18:24:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ca993afd098..88eb2ef2dad 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 2fd022c94bc..63c14f504b3 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -47,16 +47,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454117","messageId":"patch-v5-18.29-a218be76819-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 18/29] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:13Z","receivedAt":"2022-04-21T18:25:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, until a preceding commit\n\"ci/lib.sh\" required \"bash\", which might not have been available in\n\"docker\".\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 15 +++++++++++++++\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 16 insertions(+), 23 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 88eb2ef2dad..42944020436 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 1ad4dd7db39..adece989491 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -97,6 +97,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null && type p4 >/dev/null\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454118","messageId":"patch-v5-19.29-83e21b4f501-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 19/29] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:14Z","receivedAt":"2022-04-21T18:25:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 42944020436..5f167ac5be6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 63c14f504b3..cae324e2fd7 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -104,6 +104,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454119","messageId":"patch-v5-20.29-fd0e1610577-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 20/29] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:15Z","receivedAt":"2022-04-21T18:25:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454120","messageId":"patch-v5-22.29-1b077665352-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 22/29] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:17Z","receivedAt":"2022-04-21T18:25:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  9 +++++++++\n ci/lib-tput.sh                        |  5 +++++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 33 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex adece989491..4b4cdbe26e0 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..6f01fd9e5d9\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..b62ef13c44c\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,5 @@\n+#!/bin/sh\n+\n+# GitHub Action doesn't set TERM, which is required by tput\n+TERM=${TERM:-dumb}\n+export TERM\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex cae324e2fd7..fea45a1a8d3 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -47,18 +43,14 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # How many jobs to run in parallel?\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=--jobs=$NPROC\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC:-gcc}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n@@ -66,11 +58,12 @@ then\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 47e2ea1ad10..29f8c332eca 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex f59d8cadda5..eccf9a48104 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454121","messageId":"patch-v5-23.29-1867da7eddb-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 23/29] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:18Z","receivedAt":"2022-04-21T18:25:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nFor the \"pedantic\" job (which has no test phase) we won't run the\n\"ci/lib.sh --test\" step, which will be clearly visible as a skipped\nstep in the UX.\n\nSince we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\ntest\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\nsteps, i.e. the one with PYTHON_PATH, CC etc. These will all be\ncarried over from the earlier --build step.\n\nThat won't be true in the case of the \"windows-test\" and \"vs-test\"\njobs, since they run separately from the corresponding \"build\"\nstep. So we'll need to make sure that we have the --jobs=N argument\nfor those.\n\nThis doesn't matter that much, as we'll still have --jobs=N in\nGIT_PROVE_OPTS. So the only thing we'll use it for is parallelism in\nthe t/Makefile before we get to running \"prove\". Still, it's good to\nbe consistent for good measure, and to run the t/Makefile itself in\nparallel.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 21 ++++++++-------\n ci/lib.sh                  | 52 +++++++++++++++++++++++++++++++++++---\n 2 files changed, 60 insertions(+), 13 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 83e0aa1f469..bb62b4ff725 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n+      if: success() && matrix.vector.skip-tests != 'yes'\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'yes'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +334,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +355,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +367,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex fea45a1a8d3..c875208817f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -4,6 +4,30 @@ set -ex\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n+# Parse options\n+mode_build=\n+mode_test=\n+while test $# != 0\n+do\n+\tcase \"$1\" in\n+\t--build)\n+\t\tmode_build=t\n+\t\t;;\n+\t--test)\n+\t\tmode_test=t\n+\t\t;;\n+\t-*)\n+\t\techo \"error: invalid option: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\t*)\n+\t\techo \"error: invalid argument: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -11,16 +35,28 @@ then\n \texit 1\n fi\n \n+if test \"$mode_test$mode_build\" != \"t\"\n+then\n+\techo \"error: need one mode, e.g. --build or --test\" >&2\n+\texit 1\n+fi\n+\n # Helper functions\n setenv () {\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n+\t\t\tif test -z \"$mode_build\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n \t\t\t;;\n \t\t--test)\n-\t\t\t;;\n-\t\t--all)\n+\t\t\tif test -z \"$mode_test\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n \t\t\t;;\n \t\t-*)\n \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n@@ -46,8 +82,12 @@ setenv () {\n # How many jobs to run in parallel?\n NPROC=10\n \n+# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+COMMON_MAKEFLAGS=--jobs=$NPROC\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=$COMMON_MAKEFLAGS\n \n case \"$CI_TYPE\" in\n github-actions)\n@@ -101,6 +141,9 @@ windows-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n+windows-test)\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n+\t;;\n vs-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n@@ -117,6 +160,7 @@ vs-build)\n \t;;\n vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n@@ -162,4 +206,4 @@ linux-leaks)\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454122","messageId":"patch-v5-24.29-a4e3a9d2c28-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 24/29] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:19Z","receivedAt":"2022-04-21T18:25:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c875208817f..c8cc37c50b4 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -89,6 +89,13 @@ COMMON_MAKEFLAGS=--jobs=$NPROC\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n \n+# Use common options for \"make\" (cmake in \"vs-build\" below uses the\n+# intermediate variables directly)\n+DEVELOPER=1\n+MAKEFLAGS=\"$MAKEFLAGS DEVELOPER=$DEVELOPER\"\n+SKIP_DASHED_BUILT_INS=YesPlease\n+MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC:-gcc}\"\n@@ -105,10 +112,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -145,6 +150,9 @@ windows-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454123","messageId":"patch-v5-26.29-07a6c087297-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 26/29] CI: set SANITIZE=leak in MAKEFLAGS directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:21Z","receivedAt":"2022-04-21T18:25:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As in the preceding commit's change to do likewise for CC, let's not\nset SANITIZE in the environment. When I added the \"linux-leaks\" job in\nin 956d2e4639b (tests: add a test mode for SANITIZE=leak, run it in\nCI, 2021-09-23) I missed that I could do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8d19ca5ced8..b6e7a6647bb 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -225,7 +225,7 @@ linux-musl)\n \t;;\n linux-leaks)\n \tCC=gcc\n-\tsetenv --build SANITIZE leak\n+\tMAKEFLAGS=\"$MAKEFLAGS SANITIZE=leak\"\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454124","messageId":"patch-v5-25.29-48d99cee809-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:20Z","receivedAt":"2022-04-21T18:25:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rather than pass a \"$CC\" in the environment to be picked up in\nci/lib.sh let's instead have ci/lib.sh itself add it directly to\nMAKEFLAGS. For \"$CC_PACKAGE\" its setting and use can stay within\nci/install-dependencies.sh.\n\nSetting CC=gcc by default made for confusing trace output, and since a\npreceding change to carry it and others over across \"steps\" in the\nGitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\nconfusingly has CC=gcc set, even though it builds with MSVC.\n\nLet's instead rely on the Makefile default of CC=cc, and only override\nit for those jobs where it's needed. This does mean that we'll need to\nset it for the \"pedantic\" job, which previously relied on the default\nCC=gcc in case \"clang\" become the default on that platform.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSince we don't need to make this generic enough to handle \"gcc-9\"\nturning into \"gcc@9\" for \"brew install\" let's remove what was\noriginally a bash-specific replacement in 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), and which a preceding commit changed to a \"tr\"\ninvocation.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/install-dependencies.sh | 18 ++++++++++++++----\n ci/lib.sh                  | 23 ++++++++++++++++++++---\n 3 files changed, 34 insertions(+), 20 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex bb62b4ff725..6835e942280 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 4b4cdbe26e0..65548bf0b25 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -9,6 +9,17 @@ UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n+CC_PACKAGE=\n+BREW_CC_PACKAGE=\n+case \"$jobname\" in\n+linux-gcc | linux-TEST-vars)\n+\tCC_PACKAGE=gcc-8\n+\t;;\n+osx-gcc)\n+\tBREW_CC_PACKAGE=gcc@9\n+\t;;\n+esac\n+\n case \"$runs_on_pool\" in\n ubuntu-latest)\n \t# The Linux build installs the defined dependency versions below.\n@@ -67,11 +78,10 @@ macos-latest)\n \t} ||\n \tbrew install homebrew/cask/perforce\n \n-\tif test -n \"$CC_PACKAGE\"\n+\tif test -n \"$BREW_CC_PACKAGE\"\n \tthen\n-\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n-\t\tbrew install \"$BREW_PACKAGE\"\n-\t\tbrew link \"$BREW_PACKAGE\"\n+\t\tbrew install \"$BREW_CC_PACKAGE\"\n+\t\tbrew link \"$BREW_CC_PACKAGE\"\n \tfi\n \t;;\n esac\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex c8cc37c50b4..8d19ca5ced8 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -79,6 +79,9 @@ setenv () {\n \tfi\n }\n \n+# Clear variables that may come from the outside world.\n+CC=\n+\n # How many jobs to run in parallel?\n NPROC=10\n \n@@ -98,8 +101,6 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC:-gcc}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n@@ -171,9 +172,14 @@ vs-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -188,13 +194,22 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n+\tCC=gcc\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n \tsetenv --build DEVOPTS pedantic\n@@ -209,9 +224,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454125","messageId":"patch-v5-28.29-e35dff2bef3-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 28/29] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:23Z","receivedAt":"2022-04-21T18:25:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nIt's useful when developing this script to see what variables\nit *doesn't* set, but such output isn't useful to users, so let's hide\nthe \"SKIP\" output behind a --debug option.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 35 ++++++++++++++++++++++++++++++++---\n 1 file changed, 32 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex f2f75901a9c..9e38c893890 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -7,15 +7,22 @@ set -ex\n # Parse options\n mode_build=\n mode_test=\n+mode_debug=\n while test $# != 0\n do\n \tcase \"$1\" in\n \t--build)\n+\t\techo \"MODE: $1\" >&2\n \t\tmode_build=t\n \t\t;;\n \t--test)\n+\t\techo \"MODE: $1\" >&2\n \t\tmode_test=t\n \t\t;;\n+\t--debug)\n+\t\techo \"DEBUG: $1\" >&2\n+\t\tmode_debug=t\n+\t\t;;\n \t-*)\n \t\techo \"error: invalid option: $1\" >&2\n \t\texit 1\n@@ -41,21 +48,32 @@ then\n \texit 1\n fi\n \n+# Show our configuration\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+fi\n+echo >&2\n+\n # Helper functions\n setenv () {\n+\tskip=\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n \t\t\tif test -z \"$mode_build\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t--test)\n \t\t\tif test -z \"$mode_test\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t-*)\n@@ -73,10 +91,21 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\tif test -n \"$mode_debug\"\n+\t\tthen\n+\t\t\techo \"SKIP: '$key=$val'\" >&2\n+\t\tfi\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454126","messageId":"patch-v5-15.29-6044c2b383f-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 15/29] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:10Z","receivedAt":"2022-04-21T18:25:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 57b2db06923..c97fbd0f0b3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454127","messageId":"patch-v5-21.29-0c7cd9d64ba-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 21/29] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:16Z","receivedAt":"2022-04-21T18:25:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  7 +++++--\n 2 files changed, 13 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (50%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 5f167ac5be6..83e0aa1f469 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 50%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..f59d8cadda5 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,13 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo T=\"$tests\" >>$GITHUB_ENV\n+fi\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454128","messageId":"patch-v5-27.29-50f21ffdffe-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 27/29] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:22Z","receivedAt":"2022-04-21T18:25:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex b6e7a6647bb..f2f75901a9c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -132,14 +132,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif test \"$jobname\" = osx-gcc\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -195,9 +187,11 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454129","messageId":"patch-v5-29.29-13d8c6997c3-20220421T181526Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v5 29/29] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:23:24Z","receivedAt":"2022-04-21T18:25:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the ci/.sh scripts have lost most of their\nCI-specific assumptions. Let's go even further and explicitly support\nrunning ci/lib.sh outside of CI.\n\nThis was possible before by faking up enough CI-specific variables,\nbut as shown in the new \"help\" output being added here using the\nci/lib.sh to provide \"CI-like\" has now become trivial.\n\nThe ci/print-test-failures.sh scripts can now be used outside of CI as\nwell, the only GitHub CI-specific part is now guarded by a check that\nwe'll pass if outside of GitHub CI.\n\nThere's also a special-case here to not clobber $MAKEFLAGS in the\nenvironment if we're outside of CI, in case the user has e.g. \"jN\" or\nother flags to \"make\" that they'd prefer configured already.\n\nUsing \"ci/lib.sh\" as a stand-alone script is much more useful if it\ndoesn't hardcode NPROC=10, let's provide a poor shellscript\nreplacement for the online_cpus() we have in thread-utils.c to cover\nthe most common OS's.\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh         |  3 --\n ci/lib-online_cpus.sh     | 26 +++++++++++++\n ci/lib.sh                 | 80 ++++++++++++++++++++++++++++++++++-----\n ci/print-test-failures.sh |  4 --\n 4 files changed, 96 insertions(+), 17 deletions(-)\n create mode 100644 ci/lib-online_cpus.sh\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex 6f01fd9e5d9..09acab7aaec 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -3,7 +3,4 @@\n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n-else\n-\techo \"Could not identify CI type\" >&2\n-\texit 1\n fi\ndiff --git a/ci/lib-online_cpus.sh b/ci/lib-online_cpus.sh\nnew file mode 100644\nindex 00000000000..7cf0cd042fa\n--- /dev/null\n+++ b/ci/lib-online_cpus.sh\n@@ -0,0 +1,26 @@\n+#!/bin/sh\n+\n+# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n+# that currently presents a chicken & egg problem. We need this before\n+# we build (much of) anything.\n+online_cpus() {\n+\tNPROC=\n+\n+\tif command -v nproc >/dev/null\n+\tthen\n+\t\t# GNU coreutils\n+\t\tNPROC=$(nproc)\n+\telif command -v sysctl >/dev/null\n+\tthen\n+\t\t# BSD & Mac OS X\n+\t\tNPROC=$(sysctl -n hw.ncpu)\n+\telif test -n \"$NUMBER_OF_PROCESSORS\"\n+\tthen\n+\t\t# Windows\n+\t\tNPROC=\"$NUMBER_OF_PROCESSORS\"\n+\telse\n+\t\tNPROC=1\n+\tfi\n+\n+\techo $NPROC\n+}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 9e38c893890..80e89f89b7f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,16 +1,55 @@\n #!/bin/sh\n set -e\n \n+# Usage\n+CI_TYPE_HELP_COMMANDS='\n+\t# run \"make all test\" like the \"linux-leaks\" job\n+\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n+\n+\t# run \"make all test\" like the \"linux-musl\" job\n+\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n+\n+\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n+\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n+\n+\t# run \"make test\" like the \"linux-sha256\" job\n+\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n+'\n+\n+CI_TYPE_HELP=\"\n+Running $0 outside of CI? You can use ci/lib.sh to set up your\n+environment like a given CI job. E.g.:\n+$CI_TYPE_HELP_COMMANDS\n+Note that some of these (e.g. the linux-musl one) may not work as\n+expected due to the CI job configuring a platform that may not match\n+yours.\"\n+\n+usage() {\n+\techo \"usage: jobname=<job-name> [runs_on_pool=<pool-name>] $0 (--build | --test)\" >&2\n+\tif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$CI_TYPE_HELP\" >&2\n+\tfi\n+\texit 1\n+}\n+\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n # Parse options\n+mode_all=\n mode_build=\n mode_test=\n mode_debug=\n while test $# != 0\n do\n \tcase \"$1\" in\n+\t--all)\n+\t\techo \"MODE: $1\" >&2\n+\t\tmode_all=t\n+\t\tmode_build=t\n+\t\tmode_test=t\n+\t\t;;\n \t--build)\n \t\techo \"MODE: $1\" >&2\n \t\tmode_build=t\n@@ -25,11 +64,11 @@ do\n \t\t;;\n \t-*)\n \t\techo \"error: invalid option: $1\" >&2\n-\t\texit 1\n+\t\tusage\n \t\t;;\n \t*)\n \t\techo \"error: invalid argument: $1\" >&2\n-\t\texit 1\n+\t\tusage\n \t\t;;\n \tesac\n \tshift\n@@ -39,13 +78,13 @@ done\n if test -z \"$jobname\"\n then\n \techo \"error: must set a CI jobname in the environment\" >&2\n-\texit 1\n+\tusage\n fi\n \n-if test \"$mode_test$mode_build\" != \"t\"\n+if test \"$mode_test$mode_build\" != \"t\" && test -z \"$mode_all\"\n then\n \techo \"error: need one mode, e.g. --build or --test\" >&2\n-\texit 1\n+\tusage\n fi\n \n # Show our configuration\n@@ -65,13 +104,13 @@ setenv () {\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n-\t\t\tif test -z \"$mode_build\"\n+\t\t\tif test -z \"$mode_build$mode_all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t--test)\n-\t\t\tif test -z \"$mode_test\"\n+\t\t\tif test -z \"$mode_test$mode_all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n@@ -103,6 +142,10 @@ setenv () {\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$key=\\\"$val\\\"\"\n+\t\techo \"export $key\"\n \tfi\n \n \techo \"SET: '$key=$val'\" >&2\n@@ -113,10 +156,25 @@ CC=\n \n # How many jobs to run in parallel?\n NPROC=10\n+case \"$CI_TYPE\" in\n+'')\n+\t. ${0%/*}/lib-online_cpus.sh\n+\tNPROC=$(online_cpus)\n+\n+\tif test -n \"$MAKEFLAGS\"\n+\tthen\n+\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n+\telse\n+\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\tfi\n+\t;;\n+*)\n+\t# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+\t# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\t;;\n+esac\n \n-# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n-# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n-COMMON_MAKEFLAGS=--jobs=$NPROC\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n@@ -136,6 +194,8 @@ github-actions)\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n \t;;\n+'')\n+\t;;\n *)\n \techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 29f8c332eca..ec395c79ccd 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -36,10 +36,6 @@ do\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n \t\t\t;;\n-\t\t*)\n-\t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n-\t\t\texit 1\n-\t\t\t;;\n \t\tesac\n \tfi\n done\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454132","messageId":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v4-0.6-00000000000-20220413T195514Z-avarab@gmail.com","subject":"[RFC PATCH v5 00/10] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:24Z","receivedAt":"2022-04-21T18:36:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"See the \"v3\" for the \"real\" cover-letter:\nhttps://lore.kernel.org/git/RFC-cover-v3-0.6-00000000000-20220325T183946Z-avarab@gmail.com/\n\nI submitted a re-roll of the parent series at\nhttps://lore.kernel.org/git/cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com\nwhich required a conflict resolution for this one.\n\nThis version also has outstanding changes I had for using\nci/print-test-failures.sh with a parameter instead of the previous\ncopy/pasted and adjusted ci/print-test-failures-github.sh:\nhttps://lore.kernel.org/git/RFC-patch-v4-1.6-cc137c69ee1-20220413T195514Z-avarab@gmail.com/\n\nThere's some discussion about these two serieses in general, and\nJohannes intends to re-roll this:\nhttps://lore.kernel.org/git/nycvar.QRO.7.76.6.2204211454500.355@tvgsbejvaqbjf.bet/\n\nSo whatever Junio ends up (re-)picking up (and I'll reply in some of\nthose threads) hopefully having this version for comparison helps.\n\nJohannes Schindelin (6):\n  ci: make it easier to find failed tests' logs in the GitHub workflow\n  tests: refactor --write-junit-xml code\n  test(junit): avoid line feeds in XML attributes\n  ci: optionally mark up output in the GitHub workflow\n  ci: use `--github-workflow-markup` in the GitHub workflow\n  ci: call `finalize_test_case_output` a little later\n\nÆvar Arnfjörð Bjarmason (4):\n  CI: don't \"cd\" in ci/print-test-failures.sh\n  CI: add --exit-code to ci/print-test-failures.sh\n  CI: don't include \"test-results/\" in ci/print-test-failures.sh output\n  CI: stop setting FAILED_TEST_ARTIFACTS N times\n\n .github/workflows/main.yml           |  20 +---\n ci/lib.sh                            |   2 +-\n ci/print-test-failures.sh            |  89 ++++++++++++++----\n t/test-lib-functions.sh              |   4 +-\n t/test-lib-github-workflow-markup.sh |  50 ++++++++++\n t/test-lib-junit.sh                  | 132 +++++++++++++++++++++++++++\n t/test-lib.sh                        | 128 ++++----------------------\n 7 files changed, 282 insertions(+), 143 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n create mode 100644 t/test-lib-junit.sh\n\nRange-diff against v4:\n -:  ----------- >  1:  56910df26e7 CI: don't \"cd\" in ci/print-test-failures.sh\n -:  ----------- >  2:  caec0b1089a CI: add --exit-code to ci/print-test-failures.sh\n -:  ----------- >  3:  577a5be34f4 CI: don't include \"test-results/\" in ci/print-test-failures.sh output\n -:  ----------- >  4:  1482f840f64 CI: stop setting FAILED_TEST_ARTIFACTS N times\n 1:  cc137c69ee1 !  5:  4291892fbd3 ci: make it easier to find failed tests' logs in the GitHub workflow\n    @@ .github/workflows/main.yml: jobs:\n     -      if: failure()\n     -      shell: bash\n     -      run: ci/print-test-failures.sh\n    -+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n    ++      run: . /etc/profile && make -C t -e || ci/print-test-failures.sh\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v2\n    @@ .github/workflows/main.yml: jobs:\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n    -     - run: ci/lib.sh --build\n          - run: make\n          - run: ci/lib.sh --test\n    +       if: success() && matrix.vector.skip-tests != 'yes'\n     -    - run: make test\n     +    - run: make test || ci/print-test-failures-github.sh\n    -       if: success() && matrix.vector.skip-tests != 'no'\n    +       if: success() && matrix.vector.skip-tests != 'yes'\n     -    - run: ci/print-test-failures.sh\n    --      if: failure() && matrix.vector.skip-tests != 'no'\n    +-      if: failure() && matrix.vector.skip-tests != 'yes'\n          - name: Upload failed tests' directories\n            if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n            uses: actions/upload-artifact@v1\n     \n    - ## ci/print-test-failures-github.sh (new) ##\n    -@@\n    -+#!/bin/sh\n    -+\n    -+. ${0%/*}/lib-ci-type.sh\n    -+\n    -+set -e\n    -+\n    + ## ci/print-test-failures.sh ##\n    +@@ ci/print-test-failures.sh: set -e\n    + . ${0%/*}/lib-ci-type.sh\n    + . ${0%/*}/lib-tput.sh\n    + \n    +-exit_code=\n     +case \"$CI_TYPE\" in\n     +github-actions)\n    -+\thandle_failed_tests () {\n    -+\t\tmkdir -p t/failed-test-artifacts\n    -+\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n    -+\n    -+\t\tfor test_exit in t/test-results/*.exit\n    -+\t\tdo\n    -+\t\t\ttest 0 != \"$(cat \"$test_exit\")\" || continue\n    -+\n    -+\t\t\ttest_name=\"${test_exit%.exit}\"\n    -+\t\t\ttest_name=\"${test_name##*/}\"\n    -+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n    -+\t\t\tcat \"t/test-results/$test_name.out\"\n    -+\n    -+\t\t\ttrash_dir=\"t/trash directory.$test_name\"\n    -+\t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n    -+\t\t\ttar czf t/failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n    -+\t\tdone\n    -+\t\treturn 1\n    -+\t}\n    ++\texit_code=t\n    ++\tgithub_workflow_markup=t\n     +\t;;\n     +*)\n    -+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n    -+\texit 1\n    ++\texit_code=\n    ++\tgithub_workflow_markup=\n     +\t;;\n     +esac\n     +\n    -+handle_failed_tests\n    + while test $# != 0\n    + do\n    + \tcase \"$1\" in\n    + \t--exit-code)\n    + \t\texit_code=t\n    + \t\t;;\n    ++\t--no-exit-code)\n    ++\t\texit_code=\n    ++\t\t;;\n    ++\t--github-workflow-markup)\n    ++\t\tgithub_workflow_markup=t\n    ++\t\t;;\n    ++\t--no-github-workflow-markup)\n    ++\t\tgithub_workflow_markup=\n    ++\t\t;;\n    + \t*)\n    + \t\techo \"BUG: invalid $0 argument: $1\" >&2\n    + \t\texit 1\n    +@@ ci/print-test-failures.sh: do\n    + \t\tTEST_OUT=\"${TEST_NAME}.out\"\n    + \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n    + \n    +-\t\techo \"------------------------------------------------------------------------\"\n    +-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    +-\t\techo \"------------------------------------------------------------------------\"\n    ++\t\tif test -n \"$github_workflow_markup\"\n    ++\t\tthen\n    ++\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n    ++\t\telse\n    ++\t\t\techo \"------------------------------------------------------------------------\"\n    ++\t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    ++\t\t\techo \"------------------------------------------------------------------------\"\n    ++\t\tfi\n    + \t\tcat \"t/test-results/${TEST_OUT}\"\n    + \n    + \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n 2:  91f96c4f210 =  6:  d9b7d5ddf5a tests: refactor --write-junit-xml code\n 3:  84c722969d5 =  7:  2d233bbdc22 test(junit): avoid line feeds in XML attributes\n 4:  8acaa800d3a =  8:  5dd43a1624b ci: optionally mark up output in the GitHub workflow\n 5:  4499f743dd1 !  9:  877edff3b4d ci: use `--github-workflow-markup` in the GitHub workflow\n    @@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n      \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n     -\tGIT_TEST_OPTS=\"--verbose-log -x\"\n     +\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    -+\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n      \ttest Windows != \"$RUNNER_OS\" ||\n      \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n      \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n     \n    - ## ci/print-test-failures-github.sh ##\n    -@@ ci/print-test-failures-github.sh: github-actions)\n    - \t\t\ttest_name=\"${test_exit%.exit}\"\n    - \t\t\ttest_name=\"${test_name##*/}\"\n    - \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${test_name} ===\\\\e[m\\\\n\"\n    --\t\t\tcat \"t/test-results/$test_name.out\"\n    -+\t\t\tcat \"t/test-results/$test_name.markup\"\n    + ## ci/print-test-failures.sh ##\n    +@@ ci/print-test-failures.sh: do\n    + \t\tif test -n \"$github_workflow_markup\"\n    + \t\tthen\n    + \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n    ++\t\t\tcat \"t/test-results/$TEST_MARKUP\"\n    + \t\telse\n    + \t\t\techo \"------------------------------------------------------------------------\"\n    + \t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    + \t\t\techo \"------------------------------------------------------------------------\"\n    ++\t\t\tcat \"t/test-results/${TEST_OUT}\"\n    + \t\tfi\n    +-\t\tcat \"t/test-results/${TEST_OUT}\"\n      \n    - \t\t\ttrash_dir=\"t/trash directory.$test_name\"\n    - \t\t\tcp \"t/test-results/$test_name.out\" t/failed-test-artifacts/\n    + \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n    + \t\tcase \"$CI_TYPE\" in\n 6:  b291f64821c = 10:  6b278194f9a ci: call `finalize_test_case_output` a little later\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454133","messageId":"RFC-patch-v5-02.10-caec0b1089a-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 02/10] CI: add --exit-code to ci/print-test-failures.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:26Z","receivedAt":"2022-04-21T18:36:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The ci/print-test-failures.sh scripts will exit 0 when there's failed\ntests, let's teach it --exit-code to have it exit non-zero in those\ncases.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 25 +++++++++++++++++++++++++\n 1 file changed, 25 insertions(+)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex f6736f424e0..d00cd0e4944 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -8,16 +8,33 @@ set -e\n . ${0%/*}/lib-ci-type.sh\n . ${0%/*}/lib-tput.sh\n \n+exit_code=\n+while test $# != 0\n+do\n+\tcase \"$1\" in\n+\t--exit-code)\n+\t\texit_code=t\n+\t\t;;\n+\t*)\n+\t\techo \"BUG: invalid $0 argument: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n if ! ls t/test-results/*.exit >/dev/null 2>/dev/null\n then\n \techo \"Build job failed before the tests could have been run\"\n \texit\n fi\n \n+failed=\n for TEST_EXIT in t/test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n \tthen\n+\t\tfailed=t\n \t\tTEST_NAME=\"${TEST_EXIT%.exit}\"\n \t\tTEST_NAME=\"${TEST_NAME##*/}\"\n \t\tTEST_OUT=\"${TEST_NAME}.out\"\n@@ -42,3 +59,11 @@ do\n \t\tesac\n \tfi\n done\n+\n+if test -n \"$failed\"\n+then\n+\tif test -n \"$exit_code\"\n+\tthen\n+\t\texit 1\n+\tfi\n+fi\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454134","messageId":"RFC-patch-v5-01.10-56910df26e7-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 01/10] CI: don't \"cd\" in ci/print-test-failures.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:25Z","receivedAt":"2022-04-21T18:36:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the logic in ci/print-test-failures.sh so that we don't need to\n\"cd\" at the top-level, we'll now only do so for the \"tar\" command.\n\nThis way we can remove some duplicate code added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01), i.e. not have both a $TEST_NAME and\n$test_name. The output is exactly the same as before,\ni.e. \"test-results/\" was included in the heading.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 29 ++++++++++++++++-------------\n 1 file changed, 16 insertions(+), 13 deletions(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex ec395c79ccd..f6736f424e0 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -8,33 +8,36 @@ set -e\n . ${0%/*}/lib-ci-type.sh\n . ${0%/*}/lib-tput.sh\n \n-cd t/\n-\n-if ! ls test-results/*.exit >/dev/null 2>/dev/null\n+if ! ls t/test-results/*.exit >/dev/null 2>/dev/null\n then\n \techo \"Build job failed before the tests could have been run\"\n \texit\n fi\n \n-for TEST_EXIT in test-results/*.exit\n+for TEST_EXIT in t/test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n \tthen\n-\t\tTEST_OUT=\"${TEST_EXIT%exit}out\"\n+\t\tTEST_NAME=\"${TEST_EXIT%.exit}\"\n+\t\tTEST_NAME=\"${TEST_NAME##*/}\"\n+\t\tTEST_OUT=\"${TEST_NAME}.out\"\n+\t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n+\n \t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n+\t\techo \"$(tput setaf 1)test-results/${TEST_OUT}...$(tput sgr0)\"\n \t\techo \"------------------------------------------------------------------------\"\n-\t\tcat \"${TEST_OUT}\"\n+\t\tcat \"t/test-results/${TEST_OUT}\"\n \n-\t\ttest_name=\"${TEST_EXIT%.exit}\"\n-\t\ttest_name=\"${test_name##*/}\"\n-\t\ttrash_dir=\"trash directory.$test_name\"\n+\t\ttrash_dir=\"trash directory.$TEST_NAME\"\n \t\tcase \"$CI_TYPE\" in\n \t\tgithub-actions)\n-\t\t\tmkdir -p failed-test-artifacts\n+\t\t\tmkdir -p t/failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-\t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n-\t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n+\t\t\tcp \"t/test-results/${TEST_OUT}\" t/failed-test-artifacts/\n+\t\t\t(\n+\t\t\t\tcd t &&\n+\t\t\t\ttar czf failed-test-artifacts/\"$TEST_NAME\".trash.tar.gz \"$trash_dir\"\n+\t\t\t)\n \t\t\t;;\n \t\tesac\n \tfi\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454135","messageId":"RFC-patch-v5-03.10-577a5be34f4-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 03/10] CI: don't include \"test-results/\" in ci/print-test-failures.sh output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:27Z","receivedAt":"2022-04-21T18:36:49Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the ci/print-test-failures.sh output introduced in\n657343a602e (travis-ci: move Travis CI code into dedicated scripts,\n2017-09-10) to stop including \"test-results/\" in the heading, it was\nmore of an artifact of how the iteration was being done in that\ninitial version than anything else.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex d00cd0e4944..23324021f13 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -41,7 +41,7 @@ do\n \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n \n \t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)test-results/${TEST_OUT}...$(tput sgr0)\"\n+\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n \t\techo \"------------------------------------------------------------------------\"\n \t\tcat \"t/test-results/${TEST_OUT}\"\n \n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454136","messageId":"RFC-patch-v5-04.10-1482f840f64-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 04/10] CI: stop setting FAILED_TEST_ARTIFACTS N times","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:28Z","receivedAt":"2022-04-21T18:36:51Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The FAILED_TEST_ARTIFACTS variable introduced in f72f328bc57 (ci: let\nGitHub Actions upload failed tests' directories, 2020-04-11) is only\nused once in the main.yml, there is no need to set it N times if we\nhave N failing tests.\n\nSee also 92bf1b60673 (ci: avoid `set-env` construct in\nprint-test-failures.sh, 2020-11-17) which moved it to using\n$GITHUB_ENV, we'll now check if it's set like ci/lib.sh, this makes it\neasier to test this script locally.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 6 +++++-\n 1 file changed, 5 insertions(+), 1 deletion(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 23324021f13..27df5081f8b 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -49,7 +49,6 @@ do\n \t\tcase \"$CI_TYPE\" in\n \t\tgithub-actions)\n \t\t\tmkdir -p t/failed-test-artifacts\n-\t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"t/test-results/${TEST_OUT}\" t/failed-test-artifacts/\n \t\t\t(\n \t\t\t\tcd t &&\n@@ -62,6 +61,11 @@ done\n \n if test -n \"$failed\"\n then\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n+\tfi\n+\n \tif test -n \"$exit_code\"\n \tthen\n \t\texit 1\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454137","messageId":"RFC-patch-v5-05.10-4291892fbd3-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 05/10] ci: make it easier to find failed tests' logs in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:29Z","receivedAt":"2022-04-21T18:36:58Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhen investigating a test failure, the time that matters most is the\ntime it takes from getting aware of the failure to displaying the output\nof the failing test case.\n\nYou currently have to know a lot of implementation details when\ninvestigating test failures in the CI runs. The first step is easy: the\nfailed job is marked quite clearly, but when opening it, the failed step\nis expanded, which in our case is the one running\n`ci/run-build-and-tests.sh`. This step, most notably, only offers a\nhigh-level view of what went wrong: it prints the output of `prove`\nwhich merely tells the reader which test script failed.\n\nThe actually interesting part is in the detailed log of said failed\ntest script. But that log is shown in the CI run's step that runs\n`ci/print-test-failures.sh`. And that step is _not_ expanded in the web\nUI by default. It is even marked as \"successful\", which makes it very\neasy to miss that there is useful information hidden in there.\n\nLet's help the reader by showing the failed tests' detailed logs in the\nstep that is expanded automatically, i.e. directly after the test suite\nfailed.\n\nThis also helps the situation where the _build_ failed and the\n`print-test-failures` step was executed under the assumption that the\n_test suite_ failed, and consequently failed to find any failed tests.\n\nAn alternative way to implement this patch would be to source\n`ci/print-test-failures.sh` in the `handle_test_failures` function to\nshow these logs. However, over the course of the next few commits, we\nwant to introduce some grouping which would be harder to achieve that\nway (for example, we do want a leaner, and colored, preamble for each\nfailed test script, and it would be trickier to accommodate the lack of\nnested groupings in GitHub workflows' output).\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 20 ++++----------------\n ci/print-test-failures.sh  | 32 ++++++++++++++++++++++++++++----\n 2 files changed, 32 insertions(+), 20 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 6835e942280..aa31c78d4c2 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -129,11 +129,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -218,11 +214,7 @@ jobs:\n       shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && make -C t -e\n-    - name: ci/print-test-failures.sh\n-      if: failure()\n-      shell: bash\n-      run: ci/print-test-failures.sh\n+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -265,10 +257,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success()\n-    - run: ci/print-test-failures.sh\n-      if: failure()\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v2\n@@ -302,10 +292,8 @@ jobs:\n     - run: make\n     - run: ci/lib.sh --test\n       if: success() && matrix.vector.skip-tests != 'yes'\n-    - run: make test\n+    - run: make test || ci/print-test-failures-github.sh\n       if: success() && matrix.vector.skip-tests != 'yes'\n-    - run: ci/print-test-failures.sh\n-      if: failure() && matrix.vector.skip-tests != 'yes'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 27df5081f8b..814c7799b68 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -8,13 +8,32 @@ set -e\n . ${0%/*}/lib-ci-type.sh\n . ${0%/*}/lib-tput.sh\n \n-exit_code=\n+case \"$CI_TYPE\" in\n+github-actions)\n+\texit_code=t\n+\tgithub_workflow_markup=t\n+\t;;\n+*)\n+\texit_code=\n+\tgithub_workflow_markup=\n+\t;;\n+esac\n+\n while test $# != 0\n do\n \tcase \"$1\" in\n \t--exit-code)\n \t\texit_code=t\n \t\t;;\n+\t--no-exit-code)\n+\t\texit_code=\n+\t\t;;\n+\t--github-workflow-markup)\n+\t\tgithub_workflow_markup=t\n+\t\t;;\n+\t--no-github-workflow-markup)\n+\t\tgithub_workflow_markup=\n+\t\t;;\n \t*)\n \t\techo \"BUG: invalid $0 argument: $1\" >&2\n \t\texit 1\n@@ -40,9 +59,14 @@ do\n \t\tTEST_OUT=\"${TEST_NAME}.out\"\n \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n \n-\t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n-\t\techo \"------------------------------------------------------------------------\"\n+\t\tif test -n \"$github_workflow_markup\"\n+\t\tthen\n+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n+\t\telse\n+\t\t\techo \"------------------------------------------------------------------------\"\n+\t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n+\t\t\techo \"------------------------------------------------------------------------\"\n+\t\tfi\n \t\tcat \"t/test-results/${TEST_OUT}\"\n \n \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454138","messageId":"RFC-patch-v5-06.10-d9b7d5ddf5a-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 06/10] tests: refactor --write-junit-xml code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:30Z","receivedAt":"2022-04-21T18:37:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe code writing JUnit XML is interspersed directly with all the code in\n`t/test-lib.sh`, and it is therefore not only ill-separated, but\nintroducing yet another output format would make the situation even\nworse.\n\nLet's introduce an abstraction layer by hiding the JUnit XML code behind\nfour new functions that are supposed to be called before and after each\ntest and test case.\n\nThis is not just an academic exercise, refactoring for refactoring's\nsake. We _actually_ want to introduce such a new output format, to\nmake it substantially easier to diagnose test failures in our GitHub\nworkflow, therefore we do need this refactoring.\n\nThis commit is best viewed with `git show --color-moved\n--color-moved-ws=allow-indentation-change <commit>`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++\n t/test-lib.sh       | 124 ++++++-------------------------------------\n 2 files changed, 142 insertions(+), 108 deletions(-)\n create mode 100644 t/test-lib-junit.sh\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nnew file mode 100644\nindex 00000000000..9d55d74d764\n--- /dev/null\n+++ b/t/test-lib-junit.sh\n@@ -0,0 +1,126 @@\n+# Library of functions to format test scripts' output in JUnit XML\n+# format, to support Git's test suite result to be presented in an\n+# easily digestible way on Azure Pipelines.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when the user asks\n+# for JUnit XML; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n+\tmkdir -p \"$junit_xml_dir\"\n+\tjunit_xml_base=${1##*/}\n+\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n+\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n+\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n+\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n+\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n+\tjunit_suite_start=$(test-tool date getnanos)\n+\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\tthen\n+\t\tGIT_TEST_TEE_OFFSET=0\n+\tfi\n+}\n+\n+start_test_case_output () {\n+\tjunit_start=$(test-tool date getnanos)\n+}\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tok)\n+\t\tset \"$*\"\n+\t\t;;\n+\tfailure)\n+\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n+\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\t\t   then\n+\t\t\t\ttest-tool path-utils skip-n-bytes \\\n+\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\t\t\t   else\n+\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n+\t\t\t   fi)\")\"\n+\t\tjunit_insert=\"$junit_insert</failure>\"\n+\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\tthen\n+\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n+\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n+\t\tfi\n+\t\tset \"$1\" \"      $junit_insert\"\n+\t\t;;\n+\tfixed)\n+\t\tset \"$* (breakage fixed)\"\n+\t\t;;\n+\tbroken)\n+\t\tset \"$* (known breakage)\"\n+\t\t;;\n+\tskip)\n+\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n+\t\t;;\n+\tesac\n+\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tshift\n+\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n+\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n+\t\tdate getnanos $junit_start)\\\"\"\n+\twrite_junit_xml \"$(printf '%s\\n' \\\n+\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n+\tjunit_have_testcase=t\n+}\n+\n+finalize_test_output () {\n+\tif test -n \"$junit_xml_path\"\n+\tthen\n+\t\ttest -n \"$junit_have_testcase\" || {\n+\t\t\tjunit_start=$(test-tool date getnanos)\n+\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n+\t\t}\n+\n+\t\t# adjust the overall time\n+\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n+\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n+\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n+\t\t\t-e '/^ *<\\/testsuite/d' \\\n+\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n+\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n+\n+\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n+\t\twrite_junit_xml=\n+\tfi\n+}\n+\n+write_junit_xml () {\n+\tcase \"$1\" in\n+\t--truncate)\n+\t\t>\"$junit_xml_path\"\n+\t\tjunit_have_testcase=\n+\t\tshift\n+\t\t;;\n+\tesac\n+\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n+}\n+\n+xml_attr_encode () {\n+\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+}\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 531cef097db..62a57b00730 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -137,6 +137,12 @@ mark_option_requires_arg () {\n \tstore_arg_to=$2\n }\n \n+# These functions can be overridden e.g. to output JUnit XML\n+start_test_output () { :; }\n+start_test_case_output () { :; }\n+finalize_test_case_output () { :; }\n+finalize_test_output () { :; }\n+\n parse_option () {\n \tlocal opt=\"$1\"\n \n@@ -196,7 +202,7 @@ parse_option () {\n \t\ttee=t\n \t\t;;\n \t--write-junit-xml)\n-\t\twrite_junit_xml=t\n+\t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n \t--stress)\n \t\tstress=t ;;\n@@ -663,7 +669,7 @@ exec 6<&0\n exec 7>&2\n \n _error_exit () {\n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \tGIT_EXIT_OK=t\n \texit 1\n }\n@@ -773,35 +779,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$*\"\n-\tfi\n+\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n }\n \n test_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n-\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\t\t   then\n-\t\t\t\ttest-tool path-utils skip-n-bytes \\\n-\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n-\t\t\t   else\n-\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n-\t\t\t   fi)\")\"\n-\t\tjunit_insert=\"$junit_insert</failure>\"\n-\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\tthen\n-\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n-\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n-\t\tfi\n-\t\twrite_junit_xml_testcase \"$1\" \"      $junit_insert\"\n-\tfi\n+\tfinalize_test_case_output failure \"$@\"\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -814,19 +798,13 @@ test_failure_ () {\n }\n \n test_known_broken_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (breakage fixed)\"\n-\tfi\n+\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n }\n \n test_known_broken_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (known breakage)\"\n-\tfi\n+\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n }\n@@ -1103,10 +1081,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_start=$(test-tool date getnanos)\n-\tfi\n+\tstart_test_case_output\n }\n \n test_finish_ () {\n@@ -1157,12 +1132,7 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tif test -n \"$write_junit_xml\"\n-\t\tthen\n-\t\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n-\t\t\twrite_junit_xml_testcase \"$1\" \\\n-\t\t\t\t\"      <skipped message=\\\"$message\\\" />\"\n-\t\tfi\n+\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n@@ -1178,53 +1148,6 @@ test_at_end_hook_ () {\n \t:\n }\n \n-write_junit_xml () {\n-\tcase \"$1\" in\n-\t--truncate)\n-\t\t>\"$junit_xml_path\"\n-\t\tjunit_have_testcase=\n-\t\tshift\n-\t\t;;\n-\tesac\n-\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n-}\n-\n-xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n-}\n-\n-write_junit_xml_testcase () {\n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n-\tshift\n-\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n-\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n-\t\tdate getnanos $junit_start)\\\"\"\n-\twrite_junit_xml \"$(printf '%s\\n' \\\n-\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n-\tjunit_have_testcase=t\n-}\n-\n-finalize_junit_xml () {\n-\tif test -n \"$write_junit_xml\" && test -n \"$junit_xml_path\"\n-\tthen\n-\t\ttest -n \"$junit_have_testcase\" || {\n-\t\t\tjunit_start=$(test-tool date getnanos)\n-\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n-\t\t}\n-\n-\t\t# adjust the overall time\n-\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n-\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n-\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n-\t\t\t-e '/^ *<\\/testsuite/d' \\\n-\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n-\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n-\n-\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n-\t\twrite_junit_xml=\n-\tfi\n-}\n-\n test_atexit_cleanup=:\n test_atexit_handler () {\n \t# In a succeeding test script 'test_atexit_handler' is invoked\n@@ -1247,7 +1170,7 @@ test_done () {\n \t# removed, so the commands can access pidfiles and socket files.\n \ttest_atexit_handler\n \n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \n \tif test -z \"$HARNESS_ACTIVE\"\n \tthen\n@@ -1538,22 +1461,7 @@ fi\n # in subprocesses like git equals our $PWD (for pathname comparisons).\n cd -P \"$TRASH_DIRECTORY\" || exit 1\n \n-if test -n \"$write_junit_xml\"\n-then\n-\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n-\tmkdir -p \"$junit_xml_dir\"\n-\tjunit_xml_base=${0##*/}\n-\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n-\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n-\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n-\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n-\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n-\tjunit_suite_start=$(test-tool date getnanos)\n-\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\tthen\n-\t\tGIT_TEST_TEE_OFFSET=0\n-\tfi\n-fi\n+start_test_output \"$0\"\n \n # Convenience\n # A regexp to match 5 and 35 hexdigits\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454139","messageId":"RFC-patch-v5-07.10-2d233bbdc22-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 07/10] test(junit): avoid line feeds in XML attributes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:31Z","receivedAt":"2022-04-21T18:37:02Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn the test case's output, we do want newline characters, but in the XML\nattributes we do not want them.\n\nHowever, the `xml_attr_encode` function always adds a Line Feed at the\nend (which are then encoded as `&#x0a;`, even for XML attributes.\n\nThis seems not to faze Azure Pipelines' XML parser, but it still is\nincorrect, so let's fix it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nindex 9d55d74d764..c959183c7e2 100644\n--- a/t/test-lib-junit.sh\n+++ b/t/test-lib-junit.sh\n@@ -50,7 +50,7 @@ finalize_test_case_output () {\n \t\t;;\n \tfailure)\n \t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode --no-lf \"$1\")\\\">\"\n \t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n \t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n \t\t\t   then\n@@ -74,12 +74,12 @@ finalize_test_case_output () {\n \t\tset \"$* (known breakage)\"\n \t\t;;\n \tskip)\n-\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tmessage=\"$(xml_attr_encode --no-lf \"$skipped_reason\")\"\n \t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n \t\t;;\n \tesac\n \n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode --no-lf \"$this_test.$test_count $1\")\\\"\"\n \tshift\n \tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n \tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n@@ -122,5 +122,11 @@ write_junit_xml () {\n }\n \n xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tif test \"x$1\" = \"x--no-lf\"\n+\tthen\n+\t\tshift\n+\t\tprintf '%s' \"$*\" | test-tool xml-encode\n+\telse\n+\t\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tfi\n }\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454141","messageId":"RFC-patch-v5-09.10-877edff3b4d-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 09/10] ci: use `--github-workflow-markup` in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:33Z","receivedAt":"2022-04-21T18:37:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\n[Ævar: due to re-structuring on top of my series the {begin,end}_group\nin CI isn't needed at all to get \"group\" output for the test\nsuite. This commit includes the now-squashed \"ci/run-build-and-tests:\nadd some structure to the GitHub workflow output\":]\n\nThe current output of Git's GitHub workflow can be quite confusing,\nespecially for contributors new to the project.\n\nTo make it more helpful, let's introduce some collapsible grouping.\nInitially, readers will see the high-level view of what actually\nhappened (did the build fail, or the test suite?). To drill down, the\nrespective group can be expanded.\n\nNote: sadly, workflow output currently cannot contain any nested groups\n(see https://github.com/actions/runner/issues/802 for details),\ntherefore we take pains to ensure to end any previous group before\nstarting a new one.\n\n[Ævar: The above comment isn't true anymore, as that limitation has\nbeen removed by basing this on my patches to run \"make\" and \"make\ntest\" directly from the top-level of main.yml.\n\nThose are now effectively their own \"group\", effectively giving this\nstage another group \"level\" to use. This means that the equivalent of\n\"make test\" won't be on the same level as an individual test failure.\n\nWe no longer take any pains to ensure balanced group output as a\nresult (which was a caveat the previous ci/lib.sh implementation had\nto deal with., We just need to \"cat\" the generated *.markup]\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 2 +-\n ci/print-test-failures.sh | 3 ++-\n 2 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 80e89f89b7f..422399b1305 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -189,7 +189,7 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n case \"$CI_TYPE\" in\n github-actions)\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 814c7799b68..2dda16a0d97 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -62,12 +62,13 @@ do\n \t\tif test -n \"$github_workflow_markup\"\n \t\tthen\n \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n+\t\t\tcat \"t/test-results/$TEST_MARKUP\"\n \t\telse\n \t\t\techo \"------------------------------------------------------------------------\"\n \t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n \t\t\techo \"------------------------------------------------------------------------\"\n+\t\t\tcat \"t/test-results/${TEST_OUT}\"\n \t\tfi\n-\t\tcat \"t/test-results/${TEST_OUT}\"\n \n \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n \t\tcase \"$CI_TYPE\" in\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454142","messageId":"RFC-patch-v5-08.10-5dd43a1624b-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 08/10] ci: optionally mark up output in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:32Z","receivedAt":"2022-04-21T18:37:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA couple of commands exist to spruce up the output in GitHub workflows:\nhttps://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions\n\nIn addition to the `::group::<label>`/`::endgroup::` commands (which we\nalready use to structure the output of the build step better), we also\nuse `::error::`/`::notice::` to draw the attention to test failures and\nto test cases that were expected to fail but didn't.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh              |  4 +--\n t/test-lib-github-workflow-markup.sh | 50 ++++++++++++++++++++++++++++\n t/test-lib.sh                        |  5 ++-\n 3 files changed, 56 insertions(+), 3 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 93c03380d44..af4831a54c6 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -795,7 +795,7 @@ test_verify_prereq () {\n }\n \n test_expect_failure () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-failure\"\n@@ -815,7 +815,7 @@ test_expect_failure () {\n }\n \n test_expect_success () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-success\"\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nnew file mode 100644\nindex 00000000000..d8dc969df4a\n--- /dev/null\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -0,0 +1,50 @@\n+# Library of functions to mark up test scripts' output suitable for\n+# pretty-printing it in GitHub workflows.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when run in GitHub\n+# workflows; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\ttest -n \"$GIT_TEST_TEE_OUTPUT_FILE\" ||\n+\tdie \"--github-workflow-markup requires --verbose-log\"\n+\tgithub_markup_output=\"${GIT_TEST_TEE_OUTPUT_FILE%.out}.markup\"\n+\t>$github_markup_output\n+\tGIT_TEST_TEE_OFFSET=0\n+}\n+\n+# No need to override start_test_case_output\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tfailure)\n+\t\techo >>$github_markup_output \"::error::failed: $this_test.$test_count $1\"\n+\t\t;;\n+\tfixed)\n+\t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n+\t\t;;\n+\tesac\n+\techo >>$github_markup_output \"::group::$test_case_result: $this_test.$test_count $*\"\n+\ttest-tool >>$github_markup_output path-utils skip-n-bytes \\\n+\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\techo >>$github_markup_output \"::endgroup::\"\n+}\n+\n+# No need to override finalize_test_output\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 62a57b00730..8a63b4b64c9 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -204,6 +204,9 @@ parse_option () {\n \t--write-junit-xml)\n \t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n+\t--github-workflow-markup)\n+\t\t. \"$TEST_DIRECTORY/test-lib-github-workflow-markup.sh\"\n+\t\t;;\n \t--stress)\n \t\tstress=t ;;\n \t--stress=*)\n@@ -1081,7 +1084,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tstart_test_case_output\n+\tstart_test_case_output \"$@\"\n }\n \n test_finish_ () {\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454143","messageId":"RFC-patch-v5-10.10-6b278194f9a-20220421T183001Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[RFC PATCH v5 10/10] ci: call `finalize_test_case_output` a little later","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T18:36:34Z","receivedAt":"2022-04-21T18:37:11Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe used to call that function already before printing the final verdict.\nHowever, now that we added grouping to the GitHub workflow output, we\nwill want to include even that part in the collapsible group for that\ntest case.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 8a63b4b64c9..1ceba46215f 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -782,13 +782,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n+\tfinalize_test_case_output ok \"$@\"\n }\n \n test_failure_ () {\n-\tfinalize_test_case_output failure \"$@\"\n+\tfailure_label=$1\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -798,18 +798,19 @@ test_failure_ () {\n \t\tsay_color error \"1..$test_count\"\n \t\t_error_exit\n \tfi\n+\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n }\n \n test_known_broken_ok_ () {\n-\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n+\tfinalize_test_case_output fixed \"$@\"\n }\n \n test_known_broken_failure_ () {\n-\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n+\tfinalize_test_case_output broken \"$@\"\n }\n \n test_debug () {\n@@ -1135,10 +1136,10 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n+\t\tfinalize_test_case_output skip \"$@\"\n \t\t;;\n \t*)\n \t\tfalse\n-- \n2.36.0.879.g3659959fcca\n\n"},{"id":"454159","messageId":"220421.8635i66wq6.gmgdl@evledraar.gmail.com","threadId":"57451","inReplyTo":"xmqqr15rpp9b.fsf@gitster.g","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-04-21T19:24:12Z","receivedAt":"2022-04-21T19:51:50Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Wed, Apr 20 2022, Junio C Hamano wrote:\n\n> Phillip Wood <phillip.wood123@gmail.com> writes:\n>\n>> ... There is a complication though in that Dscho's series\n>> adds github markup to the build output and this series separates the\n>> build from the tests which means that is not necessary. I think it\n>> should be easy enough to change Dscho's series so it only uses github\n>> markup for the tests which is the main improvement and just wait for\n>> the build and tests to be separated in this series (ideally they'd be\n>> a short easy to review series that did just that).\n>\n> OK, Dscho, Ævar, does that sound like a workable plan?  See a reroll\n> of Dscho's series (which Phillip considers \"should be easy enough\")\n> first, get it solid enough and merge down to 'next', and then see\n> the refactoring by Ævar on top, hopefully with a minumum churn that\n> makes it impossible for people to review?\n\nFirst. I see you re-queued a the v2 of Johannes's patches. I had some\noutstanding fixes for my series [2] + the derived version of his on top\n[3] which I thought I'd submit regardless.\n\nTo reply a bit to the thread at large, quoting Phillip:\n\nOn Wed, Apr 20 2022, Phillip Wood wrote:\n\n> It would certainly be nice to get Dscho's updates merged sooner rather\n> than later as I think they represent a more significant improvement\n> for CI users. There is a complication though in that Dscho's series\n> adds github markup to the build output and this series separates the\n> build from the tests which means that is not necessary. I think it\n> should be easy enough to change Dscho's series so it only uses github\n> markup for the tests which is the main improvement and just wait for\n> the build and tests to be separated in this series (ideally they'd be\n> a short easy to review series that did just that).\n\nPhillip: I'd be very happy to see a version of my [2] rebased on [2] (or\n[3]), rather than the other way around. I'm fairly sure that if you\nattempt to do so you won't find it to be all that easy.\n\nIf you do and come up with some version which Johannes is OK with I'd be\nvery happy with it. Without that I don't see how I wouldn't be in the\nsame rut of wanting to improve other parts of the CI and that being\nbrought up as a perceived blocker, without a suggested way forward (per\n[4]).\n\nBut as to a way forward. Even though my series is larger I still think a\nmuch better way forward is to do it first.\n\nThere's been some bugs here & there (all of which I believe are\nresolved), but I don't think anyone's spotted anything that's\nfundamentally wrong with that needs to be addressed in some open-ended\nway.\n\nWhereas Johannes's v2 changes some UX things arguably for the better,\nbut also introduces severe performance regressions in the UX. See [5]\nand [6]. I was routinely seeing e.g. ~5s loading times go to ~20s.\n\nNow, I'm not sure (I haven't re-done the measurements), but I have a\nhunch that basing it on top of my series made it much better.\n\nThat's because in Johannes's the GitHub folding JS needs to fold the\nequivalent of make+make test+his GitHub markup. If it's based my series\nthe the \"make\" steps are in their own \"step\", which it looks as though\nthe GitHub UX needs to do less work to fold/unfold.\n\n1. https://lore.kernel.org/git/pull.1117.v2.git.1646130289.gitgitgadget@gmail.com/\n2. https://lore.kernel.org/git/cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com/\n3. https://lore.kernel.org/git/RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com/\n4. https://lore.kernel.org/git/220421.86fsm66zmz.gmgdl@evledraar.gmail.com/\n5. https://lore.kernel.org/git/220220.86bkz1d7hm.gmgdl@evledraar.gmail.com/\n6. https://lore.kernel.org/git/220222.86tucr6kz5.gmgdl@evledraar.gmail.com/\n"},{"id":"454167","messageId":"xmqq35i6gpr9.fsf@gitster.g","threadId":"57451","inReplyTo":"220421.8635i66wq6.gmgdl@evledraar.gmail.com","subject":"Re: [PATCH v4 30/31] CI: have osx-gcc use gcc, not clang","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-21T20:12:10Z","receivedAt":"2022-04-21T20:12:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> First. I see you re-queued a the v2 of Johannes's patches. I had some\n> outstanding fixes for my series [2] + the derived version of his on top\n> [3] which I thought I'd submit regardless.\n\nI do not mind flip-flopping on alternate days for a week or so.\n\nQuite honestly I do not care which ones come first all that much.\nAll I care about is (1) we keep CI functional and (2) we do not\nbutcher Makefile too badly in the process.  Part of \"functional\" is\n\"not unusably slow\".\n\nMaking the CI process less locked into a particular vendor and\nallowing the build/test with a configuration as similar as what is\nrun on CI locally are nice to have that can come at the same time,\nbut I wouldn't shed tears if we defer them to later, as long as they\neventually materialize.\n\nIf you can fix Dscho's series by adding a series on top, that sounds\nlike one approach of lessor resistance.\n"},{"id":"454346","messageId":"20220423201129.34133-1-carenas@gmail.com","threadId":"57451","inReplyTo":"patch-v5-10.29-07e36035a1e-20220421T181526Z-avarab@gmail.com","subject":"[PATCH] fixup! CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2022-04-23T20:11:29Z","receivedAt":"2022-04-23T20:11:53Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"Once the code was moved into an ubuntu specific branch, it doesn't make\nsense anymore to refer to logic that only applies to a different branch\n\nCleanup the comment to allow for the implementation to change without\nmaking it stale, and while at it rename the variable used to track the\nP4 version to something slightly less confusing.\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n ci/install-dependencies.sh | 8 +++-----\n 1 file changed, 3 insertions(+), 5 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 098baeef3fb..7bea45fd339 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -23,11 +23,9 @@ esac\n case \"$runs_on_pool\" in\n ubuntu-latest)\n \t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n+\t# The OS X build installs much more recent versions\n \t# Keep that in mind when you encounter a broken OS X build!\n-\tLINUX_P4_VERSION=\"16.2\"\n+\tP4_AT_LINUX_VERSION=\"16.2\"\n \tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n \n \tP4_PATH=\"$HOME/custom/p4\"\n@@ -39,7 +37,7 @@ ubuntu-latest)\n \t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n \tfi\n \n-\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tP4WHENCE=http://filehost.perforce.com/perforce/r$P4_AT_LINUX_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n \n \tsudo apt-get -q update\n-- \n2.36.0.266.g59f845bde02\n\n"},{"id":"454347","messageId":"xmqqo80r1kid.fsf@gitster.g","threadId":"57451","inReplyTo":"20220423201129.34133-1-carenas@gmail.com","subject":"Re: [PATCH] fixup! CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-04-23T22:51:22Z","receivedAt":"2022-04-23T22:59:45Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Carlo Marcelo Arenas Belón  <carenas@gmail.com> writes:\n\n> Once the code was moved into an ubuntu specific branch, it doesn't make\n> sense anymore to refer to logic that only applies to a different branch\n>\n> Cleanup the comment to allow for the implementation to change without\n> making it stale, and while at it rename the variable used to track the\n> P4 version to something slightly less confusing.\n>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n>  ci/install-dependencies.sh | 8 +++-----\n>  1 file changed, 3 insertions(+), 5 deletions(-)\n\nOK.  The place we run wget from is\n\n    $P4WHENCE/bin.linux26x86_64/{p4,p4d}\n\nfor Linux.  And P4WHENCE is defined to be\n\n    http://{filehost,cdist2}.perforce.com/perforce/r$LINUX_P4_VERSION\n\nUnfortunately, what we grab are not these two files for macOS.\n\nhttps://cdist2.perforce.com/perforce/r21.2/bin.macosx1015x86_64/helix-core-server.tgz\n\nIf p4 and p4d were the only files that we grabbed for macOS, then\nwhat I wanted to suggest in the previous message would have worked,\ni.e. \n\nWe define, per $runs_on_pool, two variables:\n\n     P4VERSION (e.g. \"r16.2\", \"r21.2\")\n     P4ARCH (e.g. \"bin.macosx1015x86_64\", \"bin.linux26x86_64\")\n\nThen a single definition, after the \"case $runs_on_pool ... esac\",\nof a leading URL, i.e.\n\n     P4DIST=https://cdist2.perforce.com/perforce/$P4VERSION/$P4ARCH/\n\ncan be used to help two wget commands, i.e.\n\n     wget --quiet \"$P4DIST/p4\"\n     wget --quiet \"$P4DIST/p4d\"\n\nin install-dependencies.sh for both Linux-x86_64 and macOS.\n\nBut if we cannot unify the way the installation is done for macOS\nand Linux that way, I do not think renaming $LINUX_P4_VERSION to\nanother name is worth doing (notice that the point of the above\nexercise was to abstract these into just two variables, VERSION and\nARCH).\n\nBy the way, I spelunked https://filehost.perforce.com/perforce/ from\na browser to see how the files are layed out over there, not cdist2.\nI am guessing that \"filehost\" is the name they want end-users like us\nto use when downloading what they distribute?\n\n> diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\n> index 098baeef3fb..7bea45fd339 100755\n> --- a/ci/install-dependencies.sh\n> +++ b/ci/install-dependencies.sh\n> @@ -23,11 +23,9 @@ esac\n>  case \"$runs_on_pool\" in\n>  ubuntu-latest)\n>  \t# The Linux build installs the defined dependency versions below.\n> -\t# The OS X build installs much more recent versions, whichever\n> -\t# were recorded in the Homebrew database upon creating the OS X\n> -\t# image.\n> +\t# The OS X build installs much more recent versions\n>  \t# Keep that in mind when you encounter a broken OS X build!\n> -\tLINUX_P4_VERSION=\"16.2\"\n> +\tP4_AT_LINUX_VERSION=\"16.2\"\n>  \tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n>  \n>  \tP4_PATH=\"$HOME/custom/p4\"\n> @@ -39,7 +37,7 @@ ubuntu-latest)\n>  \t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n>  \tfi\n>  \n> -\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n> +\tP4WHENCE=http://filehost.perforce.com/perforce/r$P4_AT_LINUX_VERSION\n>  \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n>  \n>  \tsudo apt-get -q update\n"},{"id":"454349","messageId":"CAPUEspifNjJGaXZckBn16tfiR07gfEKZt2-Euz=+3Mt0rWZL_A@mail.gmail.com","threadId":"57451","inReplyTo":"xmqqo80r1kid.fsf@gitster.g","subject":"Re: [PATCH] fixup! CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2022-04-23T23:47:13Z","receivedAt":"2022-04-23T23:47:28Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Sat, Apr 23, 2022 at 3:59 PM Junio C Hamano <gitster@pobox.com> wrote:\n>\n> If p4 and p4d were the only files that we grabbed for macOS, then\n> what I wanted to suggest in the previous message would have worked,\n\ntrue, but it can still work by making them both use the same version\n(which would be likely a CI variable) and pull the three files from\nthat directory (which was my end objective as shown) in :\n\n  https://github.com/carenas/git/commit/4fd79fa1770bc9e8e57074dbac4e44de173aeb75\n\n> By the way, I spelunked https://filehost.perforce.com/perforce/ from\n> a browser to see how the files are layed out over there, not cdist2.\n> I am guessing that \"filehost\" is the name they want end-users like us\n> to use when downloading what they distribute?\n\nI presume that was the URL they were using when this code was written,\nFWIW brew uses cdist2, and that is what I get after going to their\nwebsite at the end after clicking through their download forms so I\nassume it is less likely to break as well.\n\nagree though that renaming the variable could be avoided but it looks\nnicer as an intermediate state, and we might even keep it if having\ntwo different versions is preferred :\n\n  https://github.com/carenas/git/commit/b6699fa3f082ef6d0e8c32718ce5142612003de8\n\nCarlo\n"},{"id":"454350","messageId":"CAPUEspibJOiMksnEQTNUiVMp0q7VrArtvL5ZnQFQ=vSr+gzqYw@mail.gmail.com","threadId":"57451","inReplyTo":"xmqqo80r1kid.fsf@gitster.g","subject":"Re: [PATCH] fixup! CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2022-04-24T00:25:35Z","receivedAt":"2022-04-24T00:25:50Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Sat, Apr 23, 2022 at 3:59 PM Junio C Hamano <gitster@pobox.com> wrote:\n> But if we cannot unify the way the installation is done for macOS\n> and Linux that way, I do not think renaming $LINUX_P4_VERSION to\n> another name is worth doing (notice that the point of the above\n> exercise was to abstract these into just two variables, VERSION and\n> ARCH).\n\nBTW, I was intentionally holding those changes for the same reason; if\nrenaming the variable causes any pain (my guess was that it will be\nunlikely since the code got moved already at that point, and so\nrenaming it at the same time would be unlikely to cause further\nconflicts) then it shouldn't be done now (or maybe ever).\n\nand those changes should only be done after all the refactoring going\non now is gone, and only if discussed first with a lengthy period of\nRFC to make sure we get it right and go quickly.\n\nOf course, the final version of it will be unlikely to NOT have a\nsingle function that does the right thing based on those two variables\nand those patches were ever going to be sent as RFC.\n\nCarlo\n"},{"id":"456007","messageId":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com","subject":"[PATCH v6 00/29] CI: run \"make\" in CI \"steps\", improve UX","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:39Z","receivedAt":"2022-05-25T10:04:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This series changes CI \"step\" targets that are shellscripts that do N\nthings to instead be single command invocations at the \"step\" level,\ndriven by the CI recipe itself.\n\nTo do that we need to pass state that we previously re-setup for every\n\"step\" via $GITHUB_ENV, whose state we then helpfully show (this is just\na standard GitHub CI feature) in a drop-down at the start of every\n\"step\".\n\nI.e. at the tip of this series you can reliably look at that\n$GITHUB_ENV view to see what the full and relevant environment was for\nthat \"make\", \"make test\" or whatever.\n\nThe only changes since v5 are to rebase this on an updated \"master\",\nwhich had some small fixes in the ci/ directory. For the last\niteration see:\nhttps://lore.kernel.org/git/cover-v5-00.29-00000000000-20220421T181526Z-avarab@gmail.com/\n\nI'll follow this up with a re-roll of\nhttps://lore.kernel.org/git/RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com/\nwhich is a replacement for\nhttps://lore.kernel.org/git/pull.1117.v3.git.1653171536.gitgitgadget@gmail.com/\nbased on this topic.\n\nTo view the CI output differences this topic makes see these two runs:\n\n  master: https://github.com/avar/git/actions/runs/2377697338\n  this: https://github.com/avar/git/actions/runs/2377257487\n\nThese runs have a commit on top to trigger CI build and test failures\nin various areas. One example is here:\n\n master: https://github.com/avar/git/runs/6573059000?check_suite_focus=true\n this: https://github.com/avar/git/runs/6571804790?check_suite_focus=true\n\nThis shows that we fail on \"make\" instead of a monolothic\n\"ci/run-build-and-test.sh\" step. Furthermore we can see that a\npreceding \"ci/lib.sh --build\" step has been added to set & export (via\n$GITHUB_ENV) the full set of variables \"make\" will use in the failing\nstep. Those are then visible at (click to expand it):\n\n  https://github.com/avar/git/runs/6571804790?check_suite_focus=true#step:5:1\n\nFor every step we now do the same, i.e. it's immediately obvious what\nparameters go into running that step. The last step in this series\nthen makes it easy to run builds and tests \"like CI\" using the same\ntooling:\n\n\t$ ci/lib.sh \n\terror: must set a CI jobname in the environment\n\tusage: jobname=<job-name> [runs_on_pool=<pool-name>] ci/lib.sh (--build | --test)\n\n\tRunning ci/lib.sh outside of CI? You can use ci/lib.sh to set up your\n\tenvironment like a given CI job. E.g.:\n\n\t        # run \"make all test\" like the \"linux-leaks\" job\n\t        (eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n\n\t        # run \"make all test\" like the \"linux-musl\" job\n\t        (eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n\n\t        # run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n\t        make && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n\n\t        # run \"make test\" like the \"linux-sha256\" job\n\t        make && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n\n\tNote that some of these (e.g. the linux-musl one) may not work as\n\texpected due to the CI job configuring a platform that may not match\n\tyours.\n\nAs noted in the usage this can then be directly eval'd:\n\n\t$ jobname=osx-gcc ci/lib.sh --build 2>/dev/null \n\tMAKEFLAGS=\"j8 DEVELOPER=1 SKIP_DASHED_BUILT_INS=YesPlease PYTHON_PATH=/usr/bin/python3 CC=gcc\"\n\texport MAKEFLAGS\n\nOf course YMMV when doing so, running that on my Linux box won't\nmagically give me an OSX environment. But it's very useful to be able\nto to e.g.:\n\n\tjobname=linux-TEST-vars ci/lib.sh --test\n\nWhich allows myself and others to tweak our local build scripts to\ntest things locally with setups that mirror these CI setups as far as\nGIT_TEST_* etc. parameters are concerned.\n\nÆvar Arnfjörð Bjarmason (29):\n  CI: run \"set -ex\" early in ci/lib.sh\n  CI: make \"$jobname\" explicit, remove fallback\n  CI: remove more dead Travis CI support\n  CI: remove dead \"tree skipping\" code\n  CI: remove unused Azure ci/* code\n  CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n  CI: don't have \"git grep\" invoke a pager in tree content check\n  CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n  CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n  CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n  CI: consistently use \"export\" in ci/lib.sh\n  CI: export variables via a wrapper\n  CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n  CI: make ci/{lib,install-dependencies}.sh POSIX-compatible\n  CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n  CI: invoke \"make artifacts-tar\" directly in windows-build\n  CI: split up and reduce \"ci/test-documentation.sh\"\n  CI: combine ci/install{,-docker}-dependencies.sh\n  CI: move \"env\" definitions into ci/lib.sh\n  ci/run-test-slice.sh: replace shelling out with \"echo\"\n  CI: pre-select test slice in Windows & VS tests\n  CI: only invoke ci/lib.sh as \"steps\" in main.yml\n  CI: narrow down variable definitions in --build and --test\n  CI: add more variables to MAKEFLAGS, except under vs-build\n  CI: set CC in MAKEFLAGS directly, don't add it to the environment\n  CI: set SANITIZE=leak in MAKEFLAGS directly\n  CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n  CI: don't use \"set -x\" in \"ci/lib.sh\" output\n  CI: make it easy to use ci/*.sh outside of CI\n\n .github/workflows/main.yml            | 101 +++---\n Makefile                              |  31 +-\n ci/check-directional-formatting.bash  |   2 +-\n ci/check-unignored-build-artifacts.sh |  20 ++\n ci/install-dependencies.sh            |  82 +++--\n ci/install-docker-dependencies.sh     |  22 --\n ci/lib-ci-type.sh                     |   6 +\n ci/lib-online_cpus.sh                 |  26 ++\n ci/lib-tput.sh                        |   5 +\n ci/lib.sh                             | 424 ++++++++++++++++----------\n ci/make-test-artifacts.sh             |  12 -\n ci/mount-fileshare.sh                 |  25 --\n ci/print-test-failures.sh             |  53 +---\n ci/run-build-and-tests.sh             |  54 ----\n ci/run-docker-build.sh                |  66 ----\n ci/run-docker.sh                      |  47 ---\n ci/run-static-analysis.sh             |  32 --\n ci/run-test-slice.sh                  |  17 --\n ci/select-test-slice.sh               |  13 +\n ci/test-documentation.sh              |  37 +--\n ci/util/extract-trash-dirs.sh         |  50 ---\n shared.mak                            |   1 +\n 22 files changed, 508 insertions(+), 618 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/install-docker-dependencies.sh\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-online_cpus.sh\n create mode 100644 ci/lib-tput.sh\n delete mode 100755 ci/make-test-artifacts.sh\n delete mode 100755 ci/mount-fileshare.sh\n delete mode 100755 ci/run-build-and-tests.sh\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/run-static-analysis.sh\n delete mode 100755 ci/run-test-slice.sh\n create mode 100755 ci/select-test-slice.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\nRange-diff against v5:\n 1:  84d8098e365 =  1:  25cb08ad06c CI: run \"set -ex\" early in ci/lib.sh\n 2:  3f5c071b0f6 =  2:  1be7910c728 CI: make \"$jobname\" explicit, remove fallback\n 3:  c64845a4efb !  3:  234e248e831 CI: remove more dead Travis CI support\n    @@ ci/lib.sh: then\n     -\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n     -\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n      \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n      \tDONT_SKIP_TAGS=t\n     @@ ci/lib.sh: then\n      \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n 4:  45856e67d5d !  4:  36a6287ee9b CI: remove dead \"tree skipping\" code\n    @@ ci/lib.sh: then\n     -\tCI_BRANCH=\"$GITHUB_REF\"\n     -\tCI_COMMIT=\"$GITHUB_SHA\"\n     -\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n     -\tDONT_SKIP_TAGS=t\n     -\n     -\tcache_dir=\"$HOME/none\"\n 5:  d4671148eb7 !  5:  66b0a383daf CI: remove unused Azure ci/* code\n    @@ ci/install-dependencies.sh: macos-latest)\n     -\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n     -\tbrew install $BREW_INSTALL_PACKAGES\n      \tbrew link --force gettext\n    - \tbrew install --cask --no-quarantine perforce || {\n    - \t\t# Update the definitions and try again\n    + \tmkdir -p $HOME/bin\n    + \t(\n     @@ ci/install-dependencies.sh: Documentation)\n      \tsudo apt-get -q update\n      \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n    @@ ci/lib.sh: export TERM=${TERM:-dumb}\n     +if test \"$GITHUB_ACTIONS\" = \"true\"\n      then\n      \tCI_TYPE=github-actions\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n     \n      ## ci/mount-fileshare.sh (deleted) ##\n     @@\n 6:  45ea80d0495 !  6:  d96333c1bd8 CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS\n    @@ ci/lib.sh: check_unignored_build_artifacts ()\n      if test \"$GITHUB_ACTIONS\" = \"true\"\n      then\n      \tCI_TYPE=github-actions\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n      \n     -\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n     +\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n 7:  a264b40ba0d =  7:  d0780ab4a96 CI: don't have \"git grep\" invoke a pager in tree content check\n 8:  4a58f7be8d4 =  8:  84e368736e2 CI: have \"static-analysis\" run a \"make ci-static-analysis\" target\n 9:  78c0c81af43 =  9:  1a9c98b909c CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"\n10:  07e36035a1e ! 10:  e208a9ab1e2 CI: move p4 and git-lfs variables to ci/install-dependencies.sh\n    @@ ci/install-dependencies.sh\n      \n      . ${0%/*}/lib.sh\n      \n    --P4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n    +-P4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n     -LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n      UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n       tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n    @@ ci/install-dependencies.sh\n     +\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n     +\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n     +\n    -+\tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n    ++\tP4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n     +\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n     +\n      \tsudo apt-get -q update\n11:  272bd590a95 ! 11:  9655bae9e21 CI: consistently use \"export\" in ci/lib.sh\n    @@ ci/lib.sh: export TERM=${TERM:-dumb}\n      if test \"$GITHUB_ACTIONS\" = \"true\"\n      then\n     @@ ci/lib.sh: then\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n      \n      \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n     -\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n12:  ea35327e24c ! 12:  2da0aa1d40e CI: export variables via a wrapper\n    @@ ci/lib.sh: check_unignored_build_artifacts ()\n      NPROC=10\n     @@ ci/lib.sh: then\n      \tCI_TYPE=github-actions\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n      \n     -\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n     +\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n13:  f6ff81f48ab ! 13:  6e97633652e CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly\n    @@ ci/install-dependencies.sh: ubuntu-latest)\n     +\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n     +\tfi\n      \n    - \tP4WHENCE=http://filehost.perforce.com/perforce/r$LINUX_P4_VERSION\n    + \tP4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n      \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n     \n      ## ci/lib.sh ##\n14:  533dbc50c4f = 14:  0488e29859b CI: make ci/{lib,install-dependencies}.sh POSIX-compatible\n15:  6044c2b383f = 15:  f7ac6c33044 CI: check ignored unignored build artifacts in \"win[+VS] build\" too\n16:  4d1a9f88c32 = 16:  f89346f11eb CI: invoke \"make artifacts-tar\" directly in windows-build\n17:  5c8f464a60f = 17:  7fa9c69e3ca CI: split up and reduce \"ci/test-documentation.sh\"\n18:  a218be76819 ! 18:  7925b2610fc CI: combine ci/install{,-docker}-dependencies.sh\n    @@ ci/install-dependencies.sh: linux-gcc-default)\n     +\t;;\n      esac\n      \n    - if type p4d >/dev/null && type p4 >/dev/null\n    + if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1\n     \n      ## ci/install-docker-dependencies.sh (deleted) ##\n     @@\n19:  83e21b4f501 = 19:  b00abc07637 CI: move \"env\" definitions into ci/lib.sh\n20:  fd0e1610577 = 20:  bb5960355fe ci/run-test-slice.sh: replace shelling out with \"echo\"\n21:  0c7cd9d64ba = 21:  1eeb2e8e7f0 CI: pre-select test slice in Windows & VS tests\n22:  1b077665352 ! 22:  39979d9887d CI: only invoke ci/lib.sh as \"steps\" in main.yml\n    @@ ci/lib.sh: setenv () {\n     -\tCI_TYPE=github-actions\n     +case \"$CI_TYPE\" in\n     +github-actions)\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n      \n      \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n     @@ ci/lib.sh: then\n23:  1867da7eddb = 23:  e2b3bf032d6 CI: narrow down variable definitions in --build and --test\n24:  a4e3a9d2c28 ! 24:  c6f47d52823 CI: add more variables to MAKEFLAGS, except under vs-build\n    @@ ci/lib.sh: COMMON_MAKEFLAGS=--jobs=$NPROC\n     +\n      case \"$CI_TYPE\" in\n      github-actions)\n    - \tCC=\"${CC:-gcc}\"\n    + \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n     @@ ci/lib.sh: github-actions)\n      \t;;\n      esac\n25:  48d99cee809 ! 25:  377460e8024 CI: set CC in MAKEFLAGS directly, don't add it to the environment\n    @@ ci/install-dependencies.sh: UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl\n      ubuntu-latest)\n      \t# The Linux build installs the defined dependency versions below.\n     @@ ci/install-dependencies.sh: macos-latest)\n    - \t} ||\n    - \tbrew install homebrew/cask/perforce\n    + \tPATH=\"$PATH:${HOME}/bin\"\n    + \texport PATH\n      \n     -\tif test -n \"$CC_PACKAGE\"\n     +\tif test -n \"$BREW_CC_PACKAGE\"\n    @@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n      \n      case \"$CI_TYPE\" in\n      github-actions)\n    --\tCC=\"${CC:-gcc}\"\n    +-\tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n     -\n      \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n      \tGIT_TEST_OPTS=\"--verbose-log -x\"\n26:  07a6c087297 = 26:  98e320d5e67 CI: set SANITIZE=leak in MAKEFLAGS directly\n27:  50f21ffdffe = 27:  282b7c89a4f CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case\n28:  e35dff2bef3 = 28:  7a208927819 CI: don't use \"set -x\" in \"ci/lib.sh\" output\n29:  13d8c6997c3 = 29:  4d8a8f3be07 CI: make it easy to use ci/*.sh outside of CI\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456008","messageId":"patch-v6-01.29-25cb08ad06c-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 01/29] CI: run \"set -ex\" early in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:40Z","receivedAt":"2022-05-25T10:04:46Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change ci/lib.sh to run \"set -ex\" before it does anything else, before\nthis we were omitting a few \"export\" commands in our trace output that\nhappened before we enabled tracing.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++------\n 1 file changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 86e37da9bc5..57121dd664a 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,11 @@\n # Library of functions shared by all CI scripts\n \n+# Set 'exit on error' for all CI scripts to let the caller know that\n+# something went wrong.\n+# Set tracing executed commands, primarily setting environment variables\n+# and installing dependencies.\n+set -ex\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -85,12 +91,6 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n-set -ex\n-\n if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456009","messageId":"patch-v6-02.29-1be7910c728-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 02/29] CI: make \"$jobname\" explicit, remove fallback","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:41Z","receivedAt":"2022-05-25T10:04:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the $jobname fallback last adjusted in b011fabd6e0 (ci/lib.sh:\nencapsulate Travis-specific things, 2019-01-27).\n\nThis makes all of our CI jobs have an explicit $jobname, and removes\nthe special-case of the Windows jobs implicitly setting one (that they\ndon't currently use). In subsequent commits we'll use this new\n$jobname explicitly.\n\nThis is a follow-up to my 25715419bf4 (CI: don't run \"make test\" twice\nin one job, 2021-11-23), since then all the jobs except the Windows\njobs have had an explicit $jobname.\n\nIn the case of the Windows jobs we were using a jobname of windows-gcc\nfor both, due to picking \"gcc\" as a default fallback for \"$CC\" in\nci/lib.sh.\n\nSince we'll need this to run ci/lib.sh it makes sense to move the\ncheck to the top of the file. Subsequent commits will add more such\nassertions to it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  8 ++++++++\n ci/lib.sh                  | 12 +++++++-----\n 2 files changed, 15 insertions(+), 5 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c35200defb9..309b9141249 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -79,6 +79,8 @@ jobs:\n \n   windows-build:\n     name: win build\n+    env:\n+      jobname: windows-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     runs-on: windows-latest\n@@ -100,6 +102,8 @@ jobs:\n         path: artifacts\n   windows-test:\n     name: win test\n+    env:\n+      jobname: windows-test\n     runs-on: windows-latest\n     needs: [windows-build]\n     strategy:\n@@ -131,6 +135,8 @@ jobs:\n         path: ${{env.FAILED_TEST_ARTIFACTS}}\n   vs-build:\n     name: win+VS build\n+    env:\n+      jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n     env:\n@@ -183,6 +189,8 @@ jobs:\n         path: artifacts\n   vs-test:\n     name: win+VS test\n+    env:\n+      jobname: vs-test\n     runs-on: windows-latest\n     needs: vs-build\n     strategy:\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 57121dd664a..3061de96d8f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -6,6 +6,13 @@\n # and installing dependencies.\n set -ex\n \n+# Starting assertions\n+if test -z \"$jobname\"\n+then\n+\techo \"error: must set a CI jobname in the environment\" >&2\n+\texit 1\n+fi\n+\n skip_branch_tip_with_tag () {\n \t# Sometimes, a branch is pushed at the same time the tag that points\n \t# at the same commit as the tip of the branch is pushed, and building\n@@ -146,11 +153,6 @@ test -n \"${DONT_SKIP_TAGS-}\" ||\n skip_branch_tip_with_tag\n skip_good_tree\n \n-if test -z \"$jobname\"\n-then\n-\tjobname=\"$CI_OS_NAME-$CC\"\n-fi\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456010","messageId":"patch-v6-05.29-66b0a383daf-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 05/29] CI: remove unused Azure ci/* code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:44Z","receivedAt":"2022-05-25T10:04:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove Azure-specific code that's been unused since 6081d3898fe (ci:\nretire the Azure Pipelines definition, 2020-04-11). As noted in a\nlarger removal of all of the Azure-supporting code in [1] (although\nthat missed some of this) there is more of it in-tree, but let's focus\non only the ci/* code for now.\n\nThis is needed because in subsequent commits this unused code would\neither need to be changed to accommodate changes in ci/*, or be\nremoved.\n\nAs we'll see in those subsequent commits the end-state we're heading\ntowards will actually make it easier to add new CI types in the\nfuture, even though the only one we're left with now is the GitHub\nCI. I.e. the \"ci/*\" framework will be made to do less, not more. We'll\nbe offloading more of what it does to our generic build and test\nsystem.\n\nWhile I'm at it (since the line needs to be touched anyway) change an\nodd 'if test true == \"$GITHUB_ACTIONS\"' to the more usual style used\nin other places of 'if test \"$GITHUB_ACTIONS\" = \"true\"'.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh |  3 ---\n ci/lib.sh                  | 13 +------------\n ci/mount-fileshare.sh      | 25 -------------------------\n ci/print-test-failures.sh  |  4 ----\n 4 files changed, 1 insertion(+), 44 deletions(-)\n delete mode 100755 ci/mount-fileshare.sh\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 107757a1fea..4fa3e282dda 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -34,8 +34,6 @@ macos-latest)\n \texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n-\ttest -z \"$BREW_INSTALL_PACKAGES\" ||\n-\tbrew install $BREW_INSTALL_PACKAGES\n \tbrew link --force gettext\n \tmkdir -p $HOME/bin\n \t(\n@@ -71,7 +69,6 @@ Documentation)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install asciidoc xmlto docbook-xsl-ns make\n \n-\ttest -n \"$ALREADY_HAVE_ASCIIDOCTOR\" ||\n \tsudo gem install --version 1.5.8 asciidoctor\n \t;;\n linux-gcc-default)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex e04b53b428d..ebb9461ff42 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -29,18 +29,7 @@ export TERM=${TERM:-dumb}\n # Clear MAKEFLAGS that may come from the outside world.\n export MAKEFLAGS=\n \n-if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n-then\n-\tCI_TYPE=azure-pipelines\n-\t# We are running in Azure Pipelines\n-\tCC=\"${CC:-gcc}\"\n-\n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest Windows_NT != \"$AGENT_OS\" ||\n-\tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-elif test true = \"$GITHUB_ACTIONS\"\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\ndiff --git a/ci/mount-fileshare.sh b/ci/mount-fileshare.sh\ndeleted file mode 100755\nindex 26b58a80960..00000000000\n--- a/ci/mount-fileshare.sh\n+++ /dev/null\n@@ -1,25 +0,0 @@\n-#!/bin/sh\n-\n-die () {\n-\techo \"$*\" >&2\n-\texit 1\n-}\n-\n-test $# = 4 ||\n-die \"Usage: $0 <share> <username> <password> <mountpoint>\"\n-\n-mkdir -p \"$4\" || die \"Could not create $4\"\n-\n-case \"$(uname -s)\" in\n-Linux)\n-\tsudo mount -t cifs -o vers=3.0,username=\"$2\",password=\"$3\",dir_mode=0777,file_mode=0777,serverino \"$1\" \"$4\"\n-\t;;\n-Darwin)\n-\tpass=\"$(echo \"$3\" | sed -e 's/\\//%2F/g' -e 's/+/%2B/g')\" &&\n-\tmount -t smbfs,soft \"smb://$2:$pass@${1#//}\" \"$4\"\n-\t;;\n-*)\n-\tdie \"No support for $(uname -s)\"\n-\t;;\n-esac ||\n-die \"Could not mount $4\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 740ebb7c529..47e2ea1ad10 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -30,10 +30,6 @@ do\n \t\ttest_name=\"${test_name##*/}\"\n \t\ttrash_dir=\"trash directory.$test_name\"\n \t\tcase \"$CI_TYPE\" in\n-\t\tazure-pipelines)\n-\t\t\tmkdir -p failed-test-artifacts\n-\t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456011","messageId":"patch-v6-03.29-234e248e831-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 03/29] CI: remove more dead Travis CI support","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:42Z","receivedAt":"2022-05-25T10:04:58Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove code that I missed in 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23). This code was only called from or used by the\nnow-removed .travis.yml, or needed by the Travis CI environment.\n\nFor the symlinking in ci/run-build-and-tests.sh: Back when\n3c93b829205 (travis-ci: build Git during the 'script' phase,\n2018-01-08) and 4b060a4d973 (ci: use a junction on Windows instead of\na symlink, 2019-01-27) adjusted this \"ln\" command, the Windows build\nwould use ci/run-build-and-tests.sh.\n\nAs seen in 889cacb6897 (ci: configure GitHub Actions for CI/PR,\n2020-04-11) the current windows build uses a different entry point\nunder the GitHub CI, which doesn't use this .prove caching. Namely\n\"ci/run-test-slice.sh\".\n\nWe can be certain that it's never used in \"ci/run-test-slice.sh\"\nbecause to have a \".prove\" file we'd need to use \"--state=save\", which\nwe only do in the dead Azure codepath in ci/lib.sh. If it were used it\nwould do the wrong thing, because the different test slices would each\ntry to clobber the same \"t/.prove\" file.\n\nIf a subsequent run then used the \"--state=failed,slow,save\" it would\ndefeat the purpose of \"ci/run-test-slice.sh\", since all slices would\nthen run all tests. I.e. behavior of prove's \"--state\" options is to\nselect tests to run from the provided \"--state\" file, in addition to\nthose specified on the command-line.\n\nFor ci/run-docker{,-build}.sh: It was likewise last referenced in the\n.travis.yml removed in my 4a6e4b96026. The current \"dockerized\" run in\n\".github/workflows/main.yml\" calls the same entry points as the main\n\"regular\" job.\n\nFor \"ci/print-test-failures.sh\" the creation of the tarball added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01) has been dead since my 4a6e4b96026,\nwhich removed the fall-through case from the \"case/esac\" statement.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                     | 10 ++----\n ci/print-test-failures.sh     | 39 ---------------------\n ci/run-build-and-tests.sh     |  5 ---\n ci/run-docker-build.sh        | 66 -----------------------------------\n ci/run-docker.sh              | 47 -------------------------\n ci/run-test-slice.sh          |  5 ---\n ci/util/extract-trash-dirs.sh | 50 --------------------------\n 7 files changed, 2 insertions(+), 220 deletions(-)\n delete mode 100755 ci/run-docker-build.sh\n delete mode 100755 ci/run-docker.sh\n delete mode 100755 ci/util/extract-trash-dirs.sh\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 3061de96d8f..2e60c0a71b5 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -106,9 +106,6 @@ then\n \tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n \tCI_JOB_ID=\"$BUILD_BUILDID\"\n \tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n-\tCI_OS_NAME=\"$(echo \"$AGENT_OS\" | tr A-Z a-z)\"\n-\ttest darwin != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$(expr \"$BUILD_REPOSITORY_URI\" : '.*/\\([^/]*/[^/]*\\)$')\"\n \tCC=\"${CC:-gcc}\"\n \n \t# use a subdirectory of the cache dir (because the file share is shared\n@@ -118,16 +115,13 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows_nt != \"$CI_OS_NAME\" ||\n+\ttest Windows_NT != \"$AGENT_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n \tCI_BRANCH=\"$GITHUB_REF\"\n \tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_OS_NAME=\"$(echo \"$RUNNER_OS\" | tr A-Z a-z)\"\n-\ttest macos != \"$CI_OS_NAME\" || CI_OS_NAME=osx\n-\tCI_REPO_SLUG=\"$GITHUB_REPOSITORY\"\n \tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \tDONT_SKIP_TAGS=t\n@@ -137,7 +131,7 @@ then\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n-\ttest windows != \"$CI_OS_NAME\" ||\n+\ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 57277eefcd0..740ebb7c529 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -16,15 +16,6 @@ then\n \texit\n fi\n \n-case \"$jobname\" in\n-osx-clang|osx-gcc)\n-\t# base64 in OSX doesn't wrap its output at 76 columns by\n-\t# default, but prints a single, very long line.\n-\tbase64_opts=\"-b 76\"\n-\t;;\n-esac\n-\n-combined_trash_size=0\n for TEST_EXIT in test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n@@ -42,47 +33,17 @@ do\n \t\tazure-pipelines)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\tmv \"$trash_dir\" failed-test-artifacts\n-\t\t\tcontinue\n \t\t\t;;\n \t\tgithub-actions)\n \t\t\tmkdir -p failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n-\t\t\tcontinue\n \t\t\t;;\n \t\t*)\n \t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \t\t\texit 1\n \t\t\t;;\n \t\tesac\n-\t\ttrash_tgz_b64=\"trash.$test_name.base64\"\n-\t\tif [ -d \"$trash_dir\" ]\n-\t\tthen\n-\t\t\ttar czp \"$trash_dir\" |base64 $base64_opts >\"$trash_tgz_b64\"\n-\n-\t\t\ttrash_size=$(wc -c <\"$trash_tgz_b64\")\n-\t\t\tif [ $trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\t# larger than 1MB\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, it's too big$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\n-\t\t\tnew_combined_trash_size=$(($combined_trash_size + $trash_size))\n-\t\t\tif [ $new_combined_trash_size -gt 1048576 ]\n-\t\t\tthen\n-\t\t\t\techo \"$(tput setaf 1)Didn't include the trash directory of '$test_name' in the trace log, there is plenty of trash in there already.$(tput sgr0)\"\n-\t\t\t\tcontinue\n-\t\t\tfi\n-\t\t\tcombined_trash_size=$new_combined_trash_size\n-\n-\t\t\t# DO NOT modify these two 'echo'-ed strings below\n-\t\t\t# without updating 'ci/util/extract-trash-dirs.sh'\n-\t\t\t# as well.\n-\t\t\techo \"$(tput setaf 1)Start of trash directory of '$test_name':$(tput sgr0)\"\n-\t\t\tcat \"$trash_tgz_b64\"\n-\t\t\techo \"$(tput setaf 1)End of trash directory of '$test_name'$(tput sgr0)\"\n-\t\tfi\n \tfi\n done\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 280dda7d285..0a1ec8c2bae 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\ndiff --git a/ci/run-docker-build.sh b/ci/run-docker-build.sh\ndeleted file mode 100755\nindex 6cd832efb9c..00000000000\n--- a/ci/run-docker-build.sh\n+++ /dev/null\n@@ -1,66 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git inside container\n-#\n-# Usage:\n-#   run-docker-build.sh <host-user-id>\n-#\n-\n-set -ex\n-\n-if test $# -ne 1 || test -z \"$1\"\n-then\n-\techo >&2 \"usage: run-docker-build.sh <host-user-id>\"\n-\texit 1\n-fi\n-\n-case \"$jobname\" in\n-linux32)\n-\tswitch_cmd=\"linux32 --32bit i386\"\n-\t;;\n-linux-musl)\n-\tswitch_cmd=\n-\tuseradd () { adduser -D \"$@\"; }\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-\"${0%/*}/install-docker-dependencies.sh\"\n-\n-# If this script runs inside a docker container, then all commands are\n-# usually executed as root. Consequently, the host user might not be\n-# able to access the test output files.\n-# If a non 0 host user id is given, then create a user \"ci\" with that\n-# user id to make everything accessible to the host user.\n-HOST_UID=$1\n-if test $HOST_UID -eq 0\n-then\n-\t# Just in case someone does want to run the test suite as root.\n-\tCI_USER=root\n-else\n-\tCI_USER=ci\n-\tif test \"$(id -u $CI_USER 2>/dev/null)\" = $HOST_UID\n-\tthen\n-\t\techo \"user '$CI_USER' already exists with the requested ID $HOST_UID\"\n-\telse\n-\t\tuseradd -u $HOST_UID $CI_USER\n-\tfi\n-fi\n-\n-# Build and test\n-command $switch_cmd su -m -l $CI_USER -c \"\n-\tset -ex\n-\texport DEVELOPER='$DEVELOPER'\n-\texport DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET'\n-\texport GIT_PROVE_OPTS='$GIT_PROVE_OPTS'\n-\texport GIT_TEST_OPTS='$GIT_TEST_OPTS'\n-\texport GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB'\n-\texport MAKEFLAGS='$MAKEFLAGS'\n-\texport cache_dir='$cache_dir'\n-\tcd /usr/src/git\n-\ttest -n '$cache_dir' && ln -s '$cache_dir/.prove' t/.prove\n-\tmake\n-\tmake test\n-\"\ndiff --git a/ci/run-docker.sh b/ci/run-docker.sh\ndeleted file mode 100755\nindex af89d1624a4..00000000000\n--- a/ci/run-docker.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Download and run Docker image to build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-case \"$jobname\" in\n-linux32)\n-\tCI_CONTAINER=\"daald/ubuntu32:xenial\"\n-\t;;\n-linux-musl)\n-\tCI_CONTAINER=alpine\n-\t;;\n-*)\n-\texit 1\n-\t;;\n-esac\n-\n-docker pull \"$CI_CONTAINER\"\n-\n-# Use the following command to debug the docker build locally:\n-# <host-user-id> must be 0 if podman is used as drop-in replacement for docker\n-# $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/sh \"$CI_CONTAINER\"\n-# root@container:/# export jobname=<jobname>\n-# root@container:/# /usr/src/git/ci/run-docker-build.sh <host-user-id>\n-\n-container_cache_dir=/tmp/container-cache\n-\n-docker run \\\n-\t--interactive \\\n-\t--env DEVELOPER \\\n-\t--env DEFAULT_TEST_TARGET \\\n-\t--env GIT_PROVE_OPTS \\\n-\t--env GIT_TEST_OPTS \\\n-\t--env GIT_TEST_CLONE_2GB \\\n-\t--env MAKEFLAGS \\\n-\t--env jobname \\\n-\t--env cache_dir=\"$container_cache_dir\" \\\n-\t--volume \"${PWD}:/usr/src/git\" \\\n-\t--volume \"$cache_dir:$container_cache_dir\" \\\n-\t\"$CI_CONTAINER\" \\\n-\t/usr/src/git/ci/run-docker-build.sh $(id -u $USER)\n-\n-check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex f8c2c3106a2..b9a682b4bcd 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,11 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-case \"$CI_OS_NAME\" in\n-windows*) cmd //c mklink //j t\\\\.prove \"$(cygpath -aw \"$cache_dir/.prove\")\";;\n-*) ln -s \"$cache_dir/.prove\" t/.prove;;\n-esac\n-\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\ndiff --git a/ci/util/extract-trash-dirs.sh b/ci/util/extract-trash-dirs.sh\ndeleted file mode 100755\nindex 8e67bec21a2..00000000000\n--- a/ci/util/extract-trash-dirs.sh\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-#!/bin/sh\n-\n-error () {\n-\techo >&2 \"error: $@\"\n-\texit 1\n-}\n-\n-find_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*Start\\ of\\ trash\\ directory\\ of\\ \\'t[0-9][0-9][0-9][0-9]-*\\':*)\n-\t\t\ttest_name=\"${line#*\\'}\"\n-\t\t\ttest_name=\"${test_name%\\'*}\"\n-\n-\t\t\treturn 0\n-\t\tesac\n-\tdone\n-\n-\treturn 1\n-}\n-\n-extract_embedded_trash () {\n-\twhile read -r line\n-\tdo\n-\t\tcase \"$line\" in\n-\t\t*End\\ of\\ trash\\ directory\\ of\\ \\'$test_name\\'*)\n-\t\t\treturn\n-\t\t\t;;\n-\t\t*)\n-\t\t\tprintf '%s\\n' \"$line\"\n-\t\t\t;;\n-\t\tesac\n-\tdone\n-\n-\terror \"unexpected end of input\"\n-}\n-\n-# Raw logs from Linux build jobs have CRLF line endings, while OSX\n-# build jobs mostly have CRCRLF, except an odd line every now and\n-# then that has CRCRCRLF.  'base64 -d' from 'coreutils' doesn't like\n-# CRs and complains about \"invalid input\", so remove all CRs at the\n-# end of lines.\n-sed -e 's/\\r*$//' | \\\n-while find_embedded_trash\n-do\n-\techo \"Extracting trash directory of '$test_name'\"\n-\n-\textract_embedded_trash |base64 -d |tar xzp\n-done\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456012","messageId":"patch-v6-07.29-d0780ab4a96-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 07/29] CI: don't have \"git grep\" invoke a pager in tree content check","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:46Z","receivedAt":"2022-05-25T10:05:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix the omission of not adding \"-P\" (a.k.a. \"--no-pager\") to the \"git\"\ninvocation that spaws \"git grep\", added in 0e7696c64db (ci: disallow\ndirectional formatting, 2021-11-04).\n\nThis didn't matter for the GitHub CI, but does when running the check\nlocally. A subsequent commit will start invoking it via a new check\nfrom the top-level Makefile, and without this we'd visibly spawn a\npager when doing so.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-directional-formatting.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/check-directional-formatting.bash b/ci/check-directional-formatting.bash\nindex e6211b141aa..de8e6e486f0 100755\n--- a/ci/check-directional-formatting.bash\n+++ b/ci/check-directional-formatting.bash\n@@ -23,5 +23,5 @@\n # U+2066..U+2069: LRI, RLI, FSI and PDI\n regex='(\\u202a|\\u202b|\\u202c|\\u202d|\\u202e|\\u2066|\\u2067|\\u2068|\\u2069)'\n \n-! LC_CTYPE=C git grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n+! LC_CTYPE=C git -P grep -El \"$(LC_CTYPE=C.UTF-8 printf \"$regex\")\" \\\n \t-- ':(exclude,attr:binary)' ':(exclude)*.po'\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456013","messageId":"patch-v6-04.29-36a6287ee9b-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 04/29] CI: remove dead \"tree skipping\" code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:43Z","receivedAt":"2022-05-25T10:05:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the code related to skipping CI runs if the tree was\nsuccessfully tested before. With the GitHub CI this is done with the\n\"ci-config\" step, see e76eec35540 (ci: allow per-branch config for\nGitHub Actions, 2020-05-07) and 7d78d5fc1a9 (ci: skip GitHub workflow\nruns for already-tested commits/trees, 2020-10-08).\n\nThis code hasn't been used since 4a6e4b96026 (CI: remove Travis CI\nsupport, 2021-11-23), and before that for the retired Azure pipeline\nsupport removed in 6081d3898fe (ci: retire the Azure Pipelines\ndefinition, 2020-04-11).\n\nThis change is needed because this and subsequent commits are turning\n\"ci/lib.sh\" into a dumber library that'll only be tasked with setting\nvariables for CI jobs, or for specific steps within those jobs. Now we\ndon't need to worry about it potentially skipping the run on its own.\n\nThis change also removes a subtle potential logic error introduced in\n0e7696c64db (ci: disallow directional formatting, 2021-11-04). The\n\"ci/check-directional-formatting.bash\" script would have been made to\nrun after the \"save_good_tree\" in invoked in\n\"ci/run-static-analysis.sh\". So if e.g. the \"make coccicheck\" failed\nwe'd still mark the tree as good.\n\nI.e. the addition of \"ci/check-directional-formatting.bash\" didn't\ntake into account that the various users of the \"save_good_tree\"\nfunction in ci/*.sh made a hard assumption that they're the only\nci/*.sh script that's being run (and they use \"set -e\").\n\nThis is entirely academic since we weren't actually running this code,\nbut is something to be careful of if anyone ever needs to resurrect\nparts of this.\n\nFinally, the cache_dir=\"$HOME/none\" added in a3f2eec862b (ci/lib:\nallow running in GitHub Actions, 2020-04-08) for the GitHub CI can be\nremoved. It appears to have been added to appease the subsequent\n'mkdir -p \"$cache_dir\"', which wasn't needed in GitHub CI.\n\n1. https://lore.kernel.org/git/patch-1.1-eec0a8c3164-20211217T000418Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 91 ---------------------------------------\n ci/run-build-and-tests.sh |  2 -\n ci/run-static-analysis.sh |  2 -\n ci/test-documentation.sh  |  2 -\n 4 files changed, 97 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 2e60c0a71b5..e04b53b428d 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,75 +13,6 @@ then\n \texit 1\n fi\n \n-skip_branch_tip_with_tag () {\n-\t# Sometimes, a branch is pushed at the same time the tag that points\n-\t# at the same commit as the tip of the branch is pushed, and building\n-\t# both at the same time is a waste.\n-\t#\n-\t# When the build is triggered by a push to a tag, $CI_BRANCH will\n-\t# have that tagname, e.g. v2.14.0.  Let's see if $CI_BRANCH is\n-\t# exactly at a tag, and if so, if it is different from $CI_BRANCH.\n-\t# That way, we can tell if we are building the tip of a branch that\n-\t# is tagged and we can skip the build because we won't be skipping a\n-\t# build of a tag.\n-\n-\tif TAG=$(git describe --exact-match \"$CI_BRANCH\" 2>/dev/null) &&\n-\t\ttest \"$TAG\" != \"$CI_BRANCH\"\n-\tthen\n-\t\techo \"$(tput setaf 2)Tip of $CI_BRANCH is exactly at $TAG$(tput sgr0)\"\n-\t\texit 0\n-\tfi\n-}\n-\n-# Save some info about the current commit's tree, so we can skip the build\n-# job if we encounter the same tree again and can provide a useful info\n-# message.\n-save_good_tree () {\n-\techo \"$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID\" >>\"$good_trees_file\"\n-\t# limit the file size\n-\ttail -1000 \"$good_trees_file\" >\"$good_trees_file\".tmp\n-\tmv \"$good_trees_file\".tmp \"$good_trees_file\"\n-}\n-\n-# Skip the build job if the same tree has already been built and tested\n-# successfully before (e.g. because the branch got rebased, changing only\n-# the commit messages).\n-skip_good_tree () {\n-\tif test true = \"$GITHUB_ACTIONS\"\n-\tthen\n-\t\treturn\n-\tfi\n-\n-\tif ! good_tree_info=\"$(grep \"^$(git rev-parse $CI_COMMIT^{tree}) \" \"$good_trees_file\")\"\n-\tthen\n-\t\t# Haven't seen this tree yet, or no cached good trees file yet.\n-\t\t# Continue the build job.\n-\t\treturn\n-\tfi\n-\n-\techo \"$good_tree_info\" | {\n-\t\tread tree prev_good_commit prev_good_job_number prev_good_job_id\n-\n-\t\tif test \"$CI_JOB_ID\" = \"$prev_good_job_id\"\n-\t\tthen\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit has already been built and tested successfully by this build job.\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\telse\n-\t\t\tcat <<-EOF\n-\t\t\t$(tput setaf 2)Skipping build job for commit $CI_COMMIT.$(tput sgr0)\n-\t\t\tThis commit's tree has already been built and tested successfully in build job $prev_good_job_number for commit $prev_good_commit.\n-\t\t\tThe log of that build job is available at $SYSTEM_TASKDEFINITIONSURI$SYSTEM_TEAMPROJECT/_build/results?buildId=$prev_good_job_id\n-\t\t\tTo force a re-build delete the branch's cache and then hit 'Restart job'.\n-\t\t\tEOF\n-\t\tfi\n-\t}\n-\n-\texit 0\n-}\n-\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -102,16 +33,8 @@ if test -n \"$SYSTEM_COLLECTIONURI\" || test -n \"$SYSTEM_TASKDEFINITIONSURI\"\n then\n \tCI_TYPE=azure-pipelines\n \t# We are running in Azure Pipelines\n-\tCI_BRANCH=\"$BUILD_SOURCEBRANCH\"\n-\tCI_COMMIT=\"$BUILD_SOURCEVERSION\"\n-\tCI_JOB_ID=\"$BUILD_BUILDID\"\n-\tCI_JOB_NUMBER=\"$BUILD_BUILDNUMBER\"\n \tCC=\"${CC:-gcc}\"\n \n-\t# use a subdirectory of the cache dir (because the file share is shared\n-\t# among *all* phases)\n-\tcache_dir=\"$HOME/test-cache/$SYSTEM_PHASENAME\"\n-\n \texport GIT_PROVE_OPTS=\"--timer --jobs 10 --state=failed,slow,save\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x --write-junit-xml\"\n \tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n@@ -120,13 +43,7 @@ then\n elif test true = \"$GITHUB_ACTIONS\"\n then\n \tCI_TYPE=github-actions\n-\tCI_BRANCH=\"$GITHUB_REF\"\n-\tCI_COMMIT=\"$GITHUB_SHA\"\n-\tCI_JOB_ID=\"$GITHUB_RUN_ID\"\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n-\tDONT_SKIP_TAGS=t\n-\n-\tcache_dir=\"$HOME/none\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n@@ -139,14 +56,6 @@ else\n \texit 1\n fi\n \n-good_trees_file=\"$cache_dir/good-trees\"\n-\n-mkdir -p \"$cache_dir\"\n-\n-test -n \"${DONT_SKIP_TAGS-}\" ||\n-skip_branch_tip_with_tag\n-skip_good_tree\n-\n export DEVELOPER=1\n export DEFAULT_TEST_TARGET=prove\n export GIT_TEST_CLONE_2GB=true\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 0a1ec8c2bae..e5a21985b44 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -45,5 +45,3 @@ esac\n # start running tests.\n make $MAKE_TARGETS\n check_unignored_build_artifacts\n-\n-save_good_tree\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\nindex 65bcebda41a..5a87b1cac96 100755\n--- a/ci/run-static-analysis.sh\n+++ b/ci/run-static-analysis.sh\n@@ -28,5 +28,3 @@ fi\n \n make hdr-check ||\n exit 1\n-\n-save_good_tree\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex de41888430a..9e0652c30dd 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -41,5 +41,3 @@ grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n check_unignored_build_artifacts\n-\n-save_good_tree\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456014","messageId":"patch-v6-09.29-1a9c98b909c-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 09/29] CI: have \"static-analysis\" run \"check-builtins\", not \"documentation\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:48Z","receivedAt":"2022-05-25T10:05:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the \"make check-builtins\" check from the \"documentation\" job to\nthe \"static-analysis\" job.\n\nThe \"check-builtins\" target added in c74390e4a1d (cherry is built-in,\ndo not ship git-cherry.sh, 2006-11-05) is unrelated to the\ndocumentation, so it's odd that b98712b9aa9 (travis-ci: build\ndocumentation, 2016-05-04) added it to the \"documentation\" job.\n\nLet's just move it to the \"ci-static-analysis\" target, and while we're\nat it improve the output with $(QUIET_CHECK).\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile                 | 3 ++-\n ci/test-documentation.sh | 1 -\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 9ae7e1a373e..3398d3f2e56 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3405,7 +3405,7 @@ check-docs::\n ### Make sure built-ins do not have dups and listed in git.c\n #\n check-builtins::\n-\t./check-builtins.sh\n+\t$(QUIET_CHECK)./check-builtins.sh\n \n ### Test suite coverage testing\n #\n@@ -3495,5 +3495,6 @@ ci-check-directional-formatting:\n \n .PHONY: ci-static-analysis\n ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-builtins\n ci-static-analysis: check-coccicheck\n ci-static-analysis: hdr-check\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 9e0652c30dd..41e2b126311 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -14,7 +14,6 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-builtins\n make check-docs\n \n # Build docs with AsciiDoc\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456015","messageId":"patch-v6-10.29-e208a9ab1e2-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 10/29] CI: move p4 and git-lfs variables to ci/install-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:49Z","receivedAt":"2022-05-25T10:05:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the declaration of variables that are only used by the\n\"ubuntu-latest\" block in \"ci/install-dependencies.sh\" there from\n\"ci/lib.sh\".\n\nThis makes the code easier to follow, and changes \"ci/lib.sh\" to a\nlibrary that only exports CI variables for general use, we didn't need\nto export these $P4_PATH and $GIT_LFS_PATH variables.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 17 +++++++++++++++--\n ci/lib.sh                  | 12 ------------\n 2 files changed, 15 insertions(+), 14 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 4fa3e282dda..41a9185bb1e 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -5,14 +5,27 @@\n \n . ${0%/*}/lib.sh\n \n-P4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n-LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n+\t# The Linux build installs the defined dependency versions below.\n+\t# The OS X build installs much more recent versions, whichever\n+\t# were recorded in the Homebrew database upon creating the OS X\n+\t# image.\n+\t# Keep that in mind when you encounter a broken OS X build!\n+\tLINUX_P4_VERSION=\"16.2\"\n+\tLINUX_GIT_LFS_VERSION=\"1.5.2\"\n+\n+\tP4_PATH=\"$HOME/custom/p4\"\n+\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n+\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\n+\tP4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n+\tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\n+\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5f95f55a147..e789cd2a1cd 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -67,18 +67,6 @@ ubuntu-latest)\n \tfi\n \n \texport GIT_TEST_HTTPD=true\n-\n-\t# The Linux build installs the defined dependency versions below.\n-\t# The OS X build installs much more recent versions, whichever\n-\t# were recorded in the Homebrew database upon creating the OS X\n-\t# image.\n-\t# Keep that in mind when you encounter a broken OS X build!\n-\texport LINUX_P4_VERSION=\"16.2\"\n-\texport LINUX_GIT_LFS_VERSION=\"1.5.2\"\n-\n-\tP4_PATH=\"$HOME/custom/p4\"\n-\tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456016","messageId":"patch-v6-11.29-9655bae9e21-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 11/29] CI: consistently use \"export\" in ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:50Z","receivedAt":"2022-05-25T10:05:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/lib.sh\" script co consistently use \"export\", for\ne.g. MAKEFLAGS we were exporting it, and then assigning to it, let's\ndo it the other way around.\n\nRight now this doesn't matter, since we in\ne.g. \"ci/install-dependencies.sh\" source this file, and don't use\nsomething like \"env(1)\" to retrieve these variables. But in a\nsubsequent commit we'll \"export\" these variables through a wrapper (to\nadditionally write them to a GitHub CI-specific $GITHUB_ENV\nfile). This change makes that subsequent change easier to read, as it\nwon't need to do any control flow refactoring.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 7 ++++---\n 1 file changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex e789cd2a1cd..1b5b805c5ca 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -30,7 +30,7 @@ export TERM=${TERM:-dumb}\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n@@ -38,9 +38,10 @@ then\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \n \texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n-\texport GIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n+\texport GIT_TEST_OPTS\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n@@ -94,4 +95,4 @@ linux-leaks)\n \t;;\n esac\n \n-MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456017","messageId":"patch-v6-26.29-98e320d5e67-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 26/29] CI: set SANITIZE=leak in MAKEFLAGS directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:05Z","receivedAt":"2022-05-25T10:05:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As in the preceding commit's change to do likewise for CC, let's not\nset SANITIZE in the environment. When I added the \"linux-leaks\" job in\nin 956d2e4639b (tests: add a test mode for SANITIZE=leak, run it in\nCI, 2021-09-23) I missed that I could do that.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8d19ca5ced8..b6e7a6647bb 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -225,7 +225,7 @@ linux-musl)\n \t;;\n linux-leaks)\n \tCC=gcc\n-\tsetenv --build SANITIZE leak\n+\tMAKEFLAGS=\"$MAKEFLAGS SANITIZE=leak\"\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456018","messageId":"patch-v6-24.29-c6f47d52823-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 24/29] CI: add more variables to MAKEFLAGS, except under vs-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:03Z","receivedAt":"2022-05-25T10:05:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"It's clearer that \"DEVELOPER\" is a flag that affects the Makefile\nitself in particular if it's put into \"MAKEFLAGS than\" if it\ngenerically sits in the environment. Let's move both it and\n\"SKIP_DASHED_BUILT_INS\" to \"MAKEFLAGS\".\n\nWe can't do this under vs-build, since that invokes cmake. Let's have\nonly that job set these in the environment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 96919882c11..16bac966d76 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -89,6 +89,13 @@ COMMON_MAKEFLAGS=--jobs=$NPROC\n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n \n+# Use common options for \"make\" (cmake in \"vs-build\" below uses the\n+# intermediate variables directly)\n+DEVELOPER=1\n+MAKEFLAGS=\"$MAKEFLAGS DEVELOPER=$DEVELOPER\"\n+SKIP_DASHED_BUILT_INS=YesPlease\n+MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n+\n case \"$CI_TYPE\" in\n github-actions)\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n@@ -105,10 +112,8 @@ github-actions)\n \t;;\n esac\n \n-setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\n setenv --test GIT_TEST_CLONE_2GB true\n-setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -145,6 +150,9 @@ windows-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n vs-build)\n+\tsetenv --build DEVELOPER $DEVELOPER\n+\tsetenv --build SKIP_DASHED_BUILT_INS $SKIP_DASHED_BUILT_INS\n+\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456019","messageId":"patch-v6-25.29-377460e8024-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 25/29] CI: set CC in MAKEFLAGS directly, don't add it to the environment","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:04Z","receivedAt":"2022-05-25T10:05:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Rather than pass a \"$CC\" in the environment to be picked up in\nci/lib.sh let's instead have ci/lib.sh itself add it directly to\nMAKEFLAGS. For \"$CC_PACKAGE\" its setting and use can stay within\nci/install-dependencies.sh.\n\nSetting CC=gcc by default made for confusing trace output, and since a\npreceding change to carry it and others over across \"steps\" in the\nGitHub CI it's been even more misleading.  E.g. the \"win+VS build\" job\nconfusingly has CC=gcc set, even though it builds with MSVC.\n\nLet's instead rely on the Makefile default of CC=cc, and only override\nit for those jobs where it's needed. This does mean that we'll need to\nset it for the \"pedantic\" job, which previously relied on the default\nCC=gcc in case \"clang\" become the default on that platform.\n\nThis partially reverts my 707d2f2fe86 (CI: use \"$runs_on_pool\", not\n\"$jobname\" to select packages & config, 2021-11-23), i.e. we're now\naiming to only set those variables specific jobs need.\n\nSince we don't need to make this generic enough to handle \"gcc-9\"\nturning into \"gcc@9\" for \"brew install\" let's remove what was\noriginally a bash-specific replacement in 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), and which a preceding commit changed to a \"tr\"\ninvocation.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 13 -------------\n ci/install-dependencies.sh | 18 ++++++++++++++----\n ci/lib.sh                  | 23 ++++++++++++++++++++---\n 3 files changed, 34 insertions(+), 20 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex bb62b4ff725..6835e942280 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -238,37 +238,24 @@ jobs:\n       matrix:\n         vector:\n           - jobname: linux-clang\n-            cc: clang\n             pool: ubuntu-latest\n           - jobname: linux-sha256\n-            cc: clang\n             os: ubuntu\n             pool: ubuntu-latest\n           - jobname: linux-gcc\n-            cc: gcc\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: linux-TEST-vars\n-            cc: gcc\n             os: ubuntu\n-            cc_package: gcc-8\n             pool: ubuntu-latest\n           - jobname: osx-clang\n-            cc: clang\n             pool: macos-latest\n           - jobname: osx-gcc\n-            cc: gcc\n-            cc_package: gcc-9\n             pool: macos-latest\n           - jobname: linux-gcc-default\n-            cc: gcc\n             pool: ubuntu-latest\n           - jobname: linux-leaks\n-            cc: gcc\n             pool: ubuntu-latest\n     env:\n-      CC: ${{matrix.vector.cc}}\n-      CC_PACKAGE: ${{matrix.vector.cc_package}}\n       jobname: ${{matrix.vector.jobname}}\n       runs_on_pool: ${{matrix.vector.pool}}\n     runs-on: ${{matrix.vector.pool}}\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 9ee52769cbe..b2be92f4370 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -9,6 +9,17 @@ UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\n  libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl\"\n \n+CC_PACKAGE=\n+BREW_CC_PACKAGE=\n+case \"$jobname\" in\n+linux-gcc | linux-TEST-vars)\n+\tCC_PACKAGE=gcc-8\n+\t;;\n+osx-gcc)\n+\tBREW_CC_PACKAGE=gcc@9\n+\t;;\n+esac\n+\n case \"$runs_on_pool\" in\n ubuntu-latest)\n \t# The Linux build installs the defined dependency versions below.\n@@ -69,11 +80,10 @@ macos-latest)\n \tPATH=\"$PATH:${HOME}/bin\"\n \texport PATH\n \n-\tif test -n \"$CC_PACKAGE\"\n+\tif test -n \"$BREW_CC_PACKAGE\"\n \tthen\n-\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n-\t\tbrew install \"$BREW_PACKAGE\"\n-\t\tbrew link \"$BREW_PACKAGE\"\n+\t\tbrew install \"$BREW_CC_PACKAGE\"\n+\t\tbrew link \"$BREW_CC_PACKAGE\"\n \tfi\n \t;;\n esac\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 16bac966d76..8d19ca5ced8 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -79,6 +79,9 @@ setenv () {\n \tfi\n }\n \n+# Clear variables that may come from the outside world.\n+CC=\n+\n # How many jobs to run in parallel?\n NPROC=10\n \n@@ -98,8 +101,6 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n \n case \"$CI_TYPE\" in\n github-actions)\n-\tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n-\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n@@ -171,9 +172,14 @@ vs-test)\n \tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n+linux-gcc-default)\n+\tCC=gcc\n+\t;;\n linux-TEST-vars)\n+\tCC=gcc\n \tsetenv --test GIT_TEST_SPLIT_INDEX yes\n \tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n \tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n@@ -188,13 +194,22 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n+osx-gcc)\n+\tCC=gcc\n+\t;;\n+osx-clang)\n+\tCC=clang\n+\t;;\n linux-clang)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n+\tCC=clang\n \tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n+\tCC=gcc\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n \tsetenv --build DEVOPTS pedantic\n@@ -209,9 +224,11 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n+\tCC=gcc\n \tsetenv --build SANITIZE leak\n \tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+MAKEFLAGS=\"$MAKEFLAGS${CC:+ CC=$CC}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456020","messageId":"patch-v6-27.29-282b7c89a4f-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 27/29] CI: set PYTHON_PATH setting for osx-{clang,gcc} into \"$jobname\" case","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:06Z","receivedAt":"2022-05-25T10:05:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Move the setting of \"PYTHON_PATH=[...]\" to the \"$jobname\" case\nstatement. This partially backs out of my 707d2f2fe86 (CI: use\n\"$runs_on_pool\", not \"$jobname\" to select packages & config,\n2021-11-23), now that we have a \"osx-{clang,gcc}\" anyway for setting\n\"$CC\" we might as well do away with this part of the \"$runs_on_pool\"\ncase.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 10 ++--------\n 1 file changed, 2 insertions(+), 8 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex b6e7a6647bb..f2f75901a9c 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -132,14 +132,6 @@ ubuntu-latest)\n \n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n-macos-latest)\n-\tif test \"$jobname\" = osx-gcc\n-\tthen\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n-\telse\n-\t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n-\tfi\n-\t;;\n esac\n \n case \"$jobname\" in\n@@ -195,9 +187,11 @@ linux-TEST-vars)\n \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n osx-gcc)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \tCC=gcc\n \t;;\n osx-clang)\n+\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python2)\"\n \tCC=clang\n \t;;\n linux-clang)\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456021","messageId":"patch-v6-28.29-7a208927819-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 28/29] CI: don't use \"set -x\" in \"ci/lib.sh\" output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:07Z","receivedAt":"2022-05-25T10:05:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the \"set -x\" from the \"ci/lib.sh\" output. Before preceding\ncommits the logic in that file was much more complex, and likely to\nfail in some scenarios.\n\nNow we only task \"ci/lib.sh\" with setting various variables for\nsubsequent steps in our jobs, so we can start emitting more tailored\ndebugging output, which makes what it's doing easier to read.\n\nThis change also changes the output of the \"ci/print-test-failures.sh\"\nscript, since it's the only other user of \"ci/lib-ci-type.sh\". In that\ncase it's also helpful to know what \"$CI_TYPE\" we're using, as that\nscript doesn't \"set -x\" and will act differently depending on the\n$CI_TYPE.\n\nIt's useful when developing this script to see what variables\nit *doesn't* set, but such output isn't useful to users, so let's hide\nthe \"SKIP\" output behind a --debug option.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 35 ++++++++++++++++++++++++++++++++---\n 1 file changed, 32 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex f2f75901a9c..9e38c893890 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,5 +1,5 @@\n #!/bin/sh\n-set -ex\n+set -e\n \n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n@@ -7,15 +7,22 @@ set -ex\n # Parse options\n mode_build=\n mode_test=\n+mode_debug=\n while test $# != 0\n do\n \tcase \"$1\" in\n \t--build)\n+\t\techo \"MODE: $1\" >&2\n \t\tmode_build=t\n \t\t;;\n \t--test)\n+\t\techo \"MODE: $1\" >&2\n \t\tmode_test=t\n \t\t;;\n+\t--debug)\n+\t\techo \"DEBUG: $1\" >&2\n+\t\tmode_debug=t\n+\t\t;;\n \t-*)\n \t\techo \"error: invalid option: $1\" >&2\n \t\texit 1\n@@ -41,21 +48,32 @@ then\n \texit 1\n fi\n \n+# Show our configuration\n+echo \"CONFIG: CI_TYPE=$CI_TYPE\" >&2\n+echo \"CONFIG: jobname=$jobname\" >&2\n+echo \"CONFIG: runs_on_pool=$runs_on_pool\" >&2\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n+fi\n+echo >&2\n+\n # Helper functions\n setenv () {\n+\tskip=\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n \t\t\tif test -z \"$mode_build\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t--test)\n \t\t\tif test -z \"$mode_test\"\n \t\t\tthen\n-\t\t\t\treturn 0\n+\t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t-*)\n@@ -73,10 +91,21 @@ setenv () {\n \tval=$2\n \tshift 2\n \n+\tif test -n \"$skip\"\n+\tthen\n+\t\tif test -n \"$mode_debug\"\n+\t\tthen\n+\t\t\techo \"SKIP: '$key=$val'\" >&2\n+\t\tfi\n+\t\treturn 0\n+\tfi\n+\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n \tfi\n+\n+\techo \"SET: '$key=$val'\" >&2\n }\n \n # Clear variables that may come from the outside world.\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456022","messageId":"patch-v6-29.29-4d8a8f3be07-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 29/29] CI: make it easy to use ci/*.sh outside of CI","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:08Z","receivedAt":"2022-05-25T10:05:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the ci/.sh scripts have lost most of their\nCI-specific assumptions. Let's go even further and explicitly support\nrunning ci/lib.sh outside of CI.\n\nThis was possible before by faking up enough CI-specific variables,\nbut as shown in the new \"help\" output being added here using the\nci/lib.sh to provide \"CI-like\" has now become trivial.\n\nThe ci/print-test-failures.sh scripts can now be used outside of CI as\nwell, the only GitHub CI-specific part is now guarded by a check that\nwe'll pass if outside of GitHub CI.\n\nThere's also a special-case here to not clobber $MAKEFLAGS in the\nenvironment if we're outside of CI, in case the user has e.g. \"jN\" or\nother flags to \"make\" that they'd prefer configured already.\n\nUsing \"ci/lib.sh\" as a stand-alone script is much more useful if it\ndoesn't hardcode NPROC=10, let's provide a poor shellscript\nreplacement for the online_cpus() we have in thread-utils.c to cover\nthe most common OS's.\n\nHelped-by: Eric Sunshine <sunshine@sunshineco.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib-ci-type.sh         |  3 --\n ci/lib-online_cpus.sh     | 26 +++++++++++++\n ci/lib.sh                 | 80 ++++++++++++++++++++++++++++++++++-----\n ci/print-test-failures.sh |  4 --\n 4 files changed, 96 insertions(+), 17 deletions(-)\n create mode 100644 ci/lib-online_cpus.sh\n\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nindex 6f01fd9e5d9..09acab7aaec 100644\n--- a/ci/lib-ci-type.sh\n+++ b/ci/lib-ci-type.sh\n@@ -3,7 +3,4 @@\n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n-else\n-\techo \"Could not identify CI type\" >&2\n-\texit 1\n fi\ndiff --git a/ci/lib-online_cpus.sh b/ci/lib-online_cpus.sh\nnew file mode 100644\nindex 00000000000..7cf0cd042fa\n--- /dev/null\n+++ b/ci/lib-online_cpus.sh\n@@ -0,0 +1,26 @@\n+#!/bin/sh\n+\n+# TODO: Ideally we'd compile t/helper/test-online-cpus.c early, but\n+# that currently presents a chicken & egg problem. We need this before\n+# we build (much of) anything.\n+online_cpus() {\n+\tNPROC=\n+\n+\tif command -v nproc >/dev/null\n+\tthen\n+\t\t# GNU coreutils\n+\t\tNPROC=$(nproc)\n+\telif command -v sysctl >/dev/null\n+\tthen\n+\t\t# BSD & Mac OS X\n+\t\tNPROC=$(sysctl -n hw.ncpu)\n+\telif test -n \"$NUMBER_OF_PROCESSORS\"\n+\tthen\n+\t\t# Windows\n+\t\tNPROC=\"$NUMBER_OF_PROCESSORS\"\n+\telse\n+\t\tNPROC=1\n+\tfi\n+\n+\techo $NPROC\n+}\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 9e38c893890..80e89f89b7f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,16 +1,55 @@\n #!/bin/sh\n set -e\n \n+# Usage\n+CI_TYPE_HELP_COMMANDS='\n+\t# run \"make all test\" like the \"linux-leaks\" job\n+\t(eval $(jobname=linux-leaks ci/lib.sh --all) && make test)\n+\n+\t# run \"make all test\" like the \"linux-musl\" job\n+\t(eval $(jobname=linux-musl ci/lib.sh --all) && make test)\n+\n+\t# run \"make test\" like the \"linux-TEST-vars\" job (uses various GIT_TEST_* modes)\n+\tmake && (eval $(jobname=linux-TEST-vars ci/lib.sh --test) && make test)\n+\n+\t# run \"make test\" like the \"linux-sha256\" job\n+\tmake && (eval $(jobname=linux-sha256 ci/lib.sh --test) && make test)\n+'\n+\n+CI_TYPE_HELP=\"\n+Running $0 outside of CI? You can use ci/lib.sh to set up your\n+environment like a given CI job. E.g.:\n+$CI_TYPE_HELP_COMMANDS\n+Note that some of these (e.g. the linux-musl one) may not work as\n+expected due to the CI job configuring a platform that may not match\n+yours.\"\n+\n+usage() {\n+\techo \"usage: jobname=<job-name> [runs_on_pool=<pool-name>] $0 (--build | --test)\" >&2\n+\tif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$CI_TYPE_HELP\" >&2\n+\tfi\n+\texit 1\n+}\n+\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n # Parse options\n+mode_all=\n mode_build=\n mode_test=\n mode_debug=\n while test $# != 0\n do\n \tcase \"$1\" in\n+\t--all)\n+\t\techo \"MODE: $1\" >&2\n+\t\tmode_all=t\n+\t\tmode_build=t\n+\t\tmode_test=t\n+\t\t;;\n \t--build)\n \t\techo \"MODE: $1\" >&2\n \t\tmode_build=t\n@@ -25,11 +64,11 @@ do\n \t\t;;\n \t-*)\n \t\techo \"error: invalid option: $1\" >&2\n-\t\texit 1\n+\t\tusage\n \t\t;;\n \t*)\n \t\techo \"error: invalid argument: $1\" >&2\n-\t\texit 1\n+\t\tusage\n \t\t;;\n \tesac\n \tshift\n@@ -39,13 +78,13 @@ done\n if test -z \"$jobname\"\n then\n \techo \"error: must set a CI jobname in the environment\" >&2\n-\texit 1\n+\tusage\n fi\n \n-if test \"$mode_test$mode_build\" != \"t\"\n+if test \"$mode_test$mode_build\" != \"t\" && test -z \"$mode_all\"\n then\n \techo \"error: need one mode, e.g. --build or --test\" >&2\n-\texit 1\n+\tusage\n fi\n \n # Show our configuration\n@@ -65,13 +104,13 @@ setenv () {\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n-\t\t\tif test -z \"$mode_build\"\n+\t\t\tif test -z \"$mode_build$mode_all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n \t\t\t;;\n \t\t--test)\n-\t\t\tif test -z \"$mode_test\"\n+\t\t\tif test -z \"$mode_test$mode_all\"\n \t\t\tthen\n \t\t\t\tskip=t\n \t\t\tfi\n@@ -103,6 +142,10 @@ setenv () {\n \tif test -n \"$GITHUB_ENV\"\n \tthen\n \t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\telif test -z \"$CI_TYPE\"\n+\tthen\n+\t\techo \"$key=\\\"$val\\\"\"\n+\t\techo \"export $key\"\n \tfi\n \n \techo \"SET: '$key=$val'\" >&2\n@@ -113,10 +156,25 @@ CC=\n \n # How many jobs to run in parallel?\n NPROC=10\n+case \"$CI_TYPE\" in\n+'')\n+\t. ${0%/*}/lib-online_cpus.sh\n+\tNPROC=$(online_cpus)\n+\n+\tif test -n \"$MAKEFLAGS\"\n+\tthen\n+\t\tCOMMON_MAKEFLAGS=\"$MAKEFLAGS\"\n+\telse\n+\t\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\tfi\n+\t;;\n+*)\n+\t# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+\t# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+\tCOMMON_MAKEFLAGS=--jobs=$NPROC\n+\t;;\n+esac\n \n-# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n-# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n-COMMON_MAKEFLAGS=--jobs=$NPROC\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=$COMMON_MAKEFLAGS\n@@ -136,6 +194,8 @@ github-actions)\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n \t;;\n+'')\n+\t;;\n *)\n \techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 29f8c332eca..ec395c79ccd 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -36,10 +36,6 @@ do\n \t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n \t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n \t\t\t;;\n-\t\t*)\n-\t\t\techo \"Unhandled CI type: $CI_TYPE\" >&2\n-\t\t\texit 1\n-\t\t\t;;\n \t\tesac\n \tfi\n done\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456023","messageId":"patch-v6-06.29-d96333c1bd8-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 06/29] CI/lib.sh: stop adding leading whitespace to $MAKEFLAGS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:45Z","receivedAt":"2022-05-25T10:06:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a8c51f77d16 (ci: clear and mark MAKEFLAGS exported just once,\n2019-02-07) the assignment of MAKEFLAGS was done up-front to\nfuture-proof this code for the bug fixed in 406f93ae488 (ci: make sure\nwe build Git parallel, 2019-02-07).\n\nBut since 4a6e4b96026 (CI: remove Travis CI support, 2021-11-23) the\n--jobs=10 has been an invariant here, so let's assign --jobs=$NPROC to\nthe MAKEFLAGS right away, this gets rid of the leading whitespace from\nthe $MAKEFLAGS variable, as it would previously be empty on the first\nassignment.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex ebb9461ff42..5f95f55a147 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -26,17 +26,19 @@ check_unignored_build_artifacts ()\n # GitHub Action doesn't set TERM, which is required by tput\n export TERM=${TERM:-dumb}\n \n+# How many jobs to run in parallel?\n+NPROC=10\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-export MAKEFLAGS=\n+export MAKEFLAGS=--jobs=$NPROC\n \n if test \"$GITHUB_ACTIONS\" = \"true\"\n then\n \tCI_TYPE=github-actions\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs 10\"\n+\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n \texport GIT_TEST_OPTS=\"--verbose-log -x\"\n-\tMAKEFLAGS=\"$MAKEFLAGS --jobs=10\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n else\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456024","messageId":"patch-v6-08.29-84e368736e2-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 08/29] CI: have \"static-analysis\" run a \"make ci-static-analysis\" target","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:47Z","receivedAt":"2022-05-25T10:06:56Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Make it easier to run the CI logic locally by creating\n\"ci-static-analysis\" target.\n\nNow the \"check-coccicheck\" logic added in 0860a7641ba (travis-ci: fail\nif Coccinelle static analysis found something to transform,\n2018-07-23) can be easily tested outside of CI, and likewise the\nsanity check added in 0e7696c64db (ci: disallow directional\nformatting, 2021-11-04).\n\nThese targets could be improved, the \"hdr-check\" target will re-do all\nof its work every time it's run, and could with a change similar to my\nc234e8a0ecf (Makefile: make the \"sparse\" target non-.PHONY,\n2021-09-23). The same goes for the new\n\"ci-check-directional-formatting\" target.\n\nBut without those improvements being able to easily run a 1=1\nequivalent of the checks we do in CI during a local build is already\nan improvement. Subsequent commits will expand on this ability.\n\nThis change will also make the CI check faster, since we can take\nadvantage of parallelism. The \"make coccicheck\" takes a very long\ntime, and at the tail end we might only have one job pegging 100% of\none CPU core for a long time. Now any extra cores will be free to run\nthe rest of the targets under \"ci-static-analysis\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  3 +--\n Makefile                   | 28 ++++++++++++++++++++++++++++\n ci/run-static-analysis.sh  | 30 ------------------------------\n shared.mak                 |  1 +\n 4 files changed, 30 insertions(+), 32 deletions(-)\n delete mode 100755 ci/run-static-analysis.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 309b9141249..ad752010102 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -317,8 +317,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-static-analysis.sh\n-    - run: ci/check-directional-formatting.bash\n+    - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\ndiff --git a/Makefile b/Makefile\nindex 61aadf3ce88..9ae7e1a373e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3034,6 +3034,20 @@ coccicheck: $(addsuffix .patch,$(filter-out %.pending.cocci,$(wildcard contrib/c\n # See contrib/coccinelle/README\n coccicheck-pending: $(addsuffix .patch,$(wildcard contrib/coccinelle/*.pending.cocci))\n \n+.PHONY: check-coccicheck\n+check-coccicheck: coccicheck\n+\t$(QUIET_CHECK)for cocci_patch in contrib/coccinelle/*.patch; do \\\n+\t\tif test -s \"$$cocci_patch\"; then \\\n+\t\t\techo \"Coccinelle suggests the following changes in '$$cocci_patch':\"; \\\n+\t\t\tcat \"$$cocci_patch\"; \\\n+\t\t\tfail=UnfortunatelyYes; \\\n+\t\tfi \\\n+\tdone; \\\n+\tif test -n \"$$fail\"; then \\\n+\t\techo \"error: Coccinelle suggested some changes\"; \\\n+\t\texit 1; \\\n+\tfi\n+\n .PHONY: coccicheck coccicheck-pending\n \n ### Installation rules\n@@ -3469,3 +3483,17 @@ $(FUZZ_PROGRAMS): all\n \t\t$(XDIFF_OBJS) $(EXTLIBS) git.o $@.o $(LIB_FUZZING_ENGINE) -o $@\n \n fuzz-all: $(FUZZ_PROGRAMS)\n+\n+### CI \"check\" targets\n+#\n+# These targets are run from the CI, see .github/workflows/main.yml,\n+# but can also be run manually to run the same assertions locally.\n+\n+.PHONY: ci-check-directional-formatting\n+ci-check-directional-formatting:\n+\t$(QUIET_CHECK)ci/check-directional-formatting.bash\n+\n+.PHONY: ci-static-analysis\n+ci-static-analysis: ci-check-directional-formatting\n+ci-static-analysis: check-coccicheck\n+ci-static-analysis: hdr-check\ndiff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh\ndeleted file mode 100755\nindex 5a87b1cac96..00000000000\n--- a/ci/run-static-analysis.sh\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-#!/bin/sh\n-#\n-# Perform various static code analysis checks\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-make coccicheck\n-\n-set +x\n-\n-fail=\n-for cocci_patch in contrib/coccinelle/*.patch\n-do\n-\tif test -s \"$cocci_patch\"\n-\tthen\n-\t\techo \"$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)\"\n-\t\tcat \"$cocci_patch\"\n-\t\tfail=UnfortunatelyYes\n-\tfi\n-done\n-\n-if test -n \"$fail\"\n-then\n-\techo \"$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)\"\n-\texit 1\n-fi\n-\n-make hdr-check ||\n-exit 1\ndiff --git a/shared.mak b/shared.mak\nindex 50d4596f0d6..83e0aa16e7d 100644\n--- a/shared.mak\n+++ b/shared.mak\n@@ -68,6 +68,7 @@ ifndef V\n \tQUIET_HDR      = @echo '   ' HDR $(<:hcc=h);\n \tQUIET_RC       = @echo '   ' RC $@;\n \tQUIET_SPATCH   = @echo '   ' SPATCH $<;\n+\tQUIET_CHECK    = @echo '   ' CHECK $@;\n \n ## Used in \"Documentation/Makefile\"\n \tQUIET_ASCIIDOC\t= @echo '   ' ASCIIDOC $@;\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456025","messageId":"patch-v6-12.29-2da0aa1d40e-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 12/29] CI: export variables via a wrapper","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:51Z","receivedAt":"2022-05-25T10:06:59Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add and use a \"setenv\" wrapper to export the variables set in\nci/lib.sh.\n\nFor now this merely adds debugging information about what variables\nare set, but in a subsequent commit we'll expand this to set variables\nin $GITHUB_ENV instead of the environment, and thus carry variable\nsettings between steps in a job.\n\nWe'll also eventually be interested in what type of variable we're\nsetting, and when it needs to be used, because we'll prominently\nexpose what variables we set in what CI \"step\", so having only the\nones we actually use will improve readability.\n\nTo that end call the \"setenv\" function with optional \"--build\",\n\"--test\" and \"--all\" parameters to indicate whether they're needed for\nbuilding, testing or both.\n\nWe currently ignore the \"varname\" parameter, but will make use of it in a\nsubsequent commit. Adding it here reduces the needless churn, as we\nwon't need to change all these lines again for that subsequent change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 | 51 ++++++++++++++++++++++++++++++---------\n ci/run-build-and-tests.sh | 34 +++++++++++++-------------\n 2 files changed, 57 insertions(+), 28 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 1b5b805c5ca..71e6d6e08e7 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -13,6 +13,35 @@ then\n \texit 1\n fi\n \n+# Helper functions\n+setenv () {\n+\twhile test $# != 0\n+\tdo\n+\t\tcase \"$1\" in\n+\t\t--build)\n+\t\t\t;;\n+\t\t--test)\n+\t\t\t;;\n+\t\t--all)\n+\t\t\t;;\n+\t\t-*)\n+\t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n+\t\t\texit 1\n+\t\t\t;;\n+\t\t*)\n+\t\t\tbreak\n+\t\t\t;;\n+\t\tesac\n+\t\tshift\n+\tdone\n+\n+\tkey=$1\n+\tval=$2\n+\tshift 2\n+\n+\teval \"export $key=\\\"$val\\\"\"\n+}\n+\n check_unignored_build_artifacts ()\n {\n \t! git ls-files --other --exclude-standard --error-unmatch \\\n@@ -24,7 +53,7 @@ check_unignored_build_artifacts ()\n }\n \n # GitHub Action doesn't set TERM, which is required by tput\n-export TERM=${TERM:-dumb}\n+setenv TERM ${TERM:-dumb}\n \n # How many jobs to run in parallel?\n NPROC=10\n@@ -37,21 +66,21 @@ then\n \tCI_TYPE=github-actions\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \n-\texport GIT_PROVE_OPTS=\"--timer --jobs $NPROC\"\n+\tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n \tGIT_TEST_OPTS=\"--verbose-log -x\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n-\texport GIT_TEST_OPTS\n+\tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n else\n \techo \"Could not identify CI type\" >&2\n \tenv >&2\n \texit 1\n fi\n \n-export DEVELOPER=1\n-export DEFAULT_TEST_TARGET=prove\n-export GIT_TEST_CLONE_2GB=true\n-export SKIP_DASHED_BUILT_INS=YesPlease\n+setenv --build DEVELOPER 1\n+setenv --test DEFAULT_TEST_TARGET prove\n+setenv --test GIT_TEST_CLONE_2GB true\n+setenv --build SKIP_DASHED_BUILT_INS YesPlease\n \n case \"$runs_on_pool\" in\n ubuntu-latest)\n@@ -67,7 +96,7 @@ ubuntu-latest)\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python2\"\n \tfi\n \n-\texport GIT_TEST_HTTPD=true\n+\tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n \tif [ \"$jobname\" = osx-gcc ]\n@@ -90,9 +119,9 @@ linux-musl)\n \tMAKEFLAGS=\"$MAKEFLAGS GIT_TEST_UTF8_LOCALE=C.UTF-8\"\n \t;;\n linux-leaks)\n-\texport SANITIZE=leak\n-\texport GIT_TEST_PASSING_SANITIZE_LEAK=true\n+\tsetenv --build SANITIZE leak\n+\tsetenv --test GIT_TEST_PASSING_SANITIZE_LEAK true\n \t;;\n esac\n \n-export MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex e5a21985b44..35d45a9373e 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -9,33 +9,33 @@ export MAKE_TARGETS=\"all test\"\n \n case \"$jobname\" in\n linux-gcc)\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n linux-TEST-vars)\n-\texport GIT_TEST_SPLIT_INDEX=yes\n-\texport GIT_TEST_MERGE_ALGORITHM=recursive\n-\texport GIT_TEST_FULL_IN_PACK_ARRAY=true\n-\texport GIT_TEST_OE_SIZE=10\n-\texport GIT_TEST_OE_DELTA_SIZE=5\n-\texport GIT_TEST_COMMIT_GRAPH=1\n-\texport GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=1\n-\texport GIT_TEST_MULTI_PACK_INDEX=1\n-\texport GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP=1\n-\texport GIT_TEST_ADD_I_USE_BUILTIN=1\n-\texport GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=master\n-\texport GIT_TEST_WRITE_REV_INDEX=1\n-\texport GIT_TEST_CHECKOUT_WORKERS=2\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n \t;;\n linux-clang)\n-\texport GIT_TEST_DEFAULT_HASH=sha1\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n \t;;\n linux-sha256)\n-\texport GIT_TEST_DEFAULT_HASH=sha256\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n \t;;\n pedantic)\n \t# Don't run the tests; we only care about whether Git can be\n \t# built.\n-\texport DEVOPTS=pedantic\n+\tsetenv --build DEVOPTS pedantic\n \texport MAKE_TARGETS=all\n \t;;\n esac\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456026","messageId":"patch-v6-17.29-7fa9c69e3ca-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 17/29] CI: split up and reduce \"ci/test-documentation.sh\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:56Z","receivedAt":"2022-05-25T10:07:06Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the \"ci/test-documentation.sh\" script to run the bash-specific\nparts in as one command in the CI job itself, and to run the two \"make\ndoc\" commands at the top-level.\n\nIt'll now be obvious from the title of the step if we failed in the\nasciidoc or asciidoctor step.\n\nSince the \"check_unignored_build_artifacts()\" function is now only\nused in \"ci/check-unignored-build-artifacts.sh\" move that function\nthere.\n\nThe recipe for the job in \".github/workflows/main.yml\" is now a bit\nverbose because it's effectively the same job twice, with a \"make\nclean\" in-between. It would be better for the verbosity to run it via\na matrix as done in the alternate approach in [1] does, but then we'd\nsacrifice overall CPU time for the brevity. It might still be worth\ndoing, but let's go for this simpler approach for now.\n\n1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 16 +++++++++++++-\n ci/check-unignored-build-artifacts.sh | 10 +++++++++\n ci/lib.sh                             | 10 ---------\n ci/test-documentation.sh              | 31 +++++++++------------------\n 4 files changed, 35 insertions(+), 32 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ca993afd098..88eb2ef2dad 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -365,4 +365,18 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/test-documentation.sh\n+    - run: ci/lib.sh\n+    - run: make check-docs\n+    - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh AsciiDoc\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+    - run: make clean\n+    - run: \"make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n+      shell: bash\n+    - run: ci/test-documentation.sh Asciidoctor\n+      if: success()\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 56d04b0db9a..0bc04f32804 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -5,4 +5,14 @@\n \n . ${0%/*}/lib.sh\n \n+check_unignored_build_artifacts ()\n+{\n+\t! git ls-files --other --exclude-standard --error-unmatch \\\n+\t\t-- ':/*' 2>/dev/null ||\n+\t{\n+\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n+\t\tfalse\n+\t}\n+}\n+\n check_unignored_build_artifacts\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 8df133b840b..5141de85024 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -47,16 +47,6 @@ setenv () {\n \tfi\n }\n \n-check_unignored_build_artifacts ()\n-{\n-\t! git ls-files --other --exclude-standard --error-unmatch \\\n-\t\t-- ':/*' 2>/dev/null ||\n-\t{\n-\t\techo \"$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)\"\n-\t\tfalse\n-\t}\n-}\n-\n # GitHub Action doesn't set TERM, which is required by tput\n setenv TERM ${TERM:-dumb}\n \ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 6b5cce03bd7..b8a6a6f664e 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -1,10 +1,12 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n-# Perform sanity checks on documentation and build it.\n+# Perform sanity checks on \"make doc\" output and built documentation\n #\n \n . ${0%/*}/lib.sh\n \n+generator=$1\n+\n filter_log () {\n \tsed -e '/^GIT_VERSION = /d' \\\n \t    -e \"/constant Gem::ConfigMap is deprecated/d\" \\\n@@ -14,28 +16,15 @@ filter_log () {\n \t    \"$1\"\n }\n \n-make check-docs\n-\n-# Build docs with AsciiDoc\n-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n-cat stderr.raw\n-filter_log stderr.raw >stderr.log\n-test ! -s stderr.log\n-test -s Documentation/git.html\n-test -s Documentation/git.xml\n-test -s Documentation/git.1\n-grep '<meta name=\"generator\" content=\"AsciiDoc ' Documentation/git.html\n-\n-rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-\n-# Build docs with AsciiDoctor\n-make clean\n-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\n cat stderr.raw\n filter_log stderr.raw >stderr.log\n test ! -s stderr.log\n test -s Documentation/git.html\n-grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n+if test \"$generator\" = \"Asciidoctor\"\n+then\n+\ttest -s Documentation/git.xml\n+\ttest -s Documentation/git.1\n+fi\n+grep \"<meta name=\\\"generator\\\" content=\\\"$generator \" Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456027","messageId":"patch-v6-15.29-f7ac6c33044-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 15/29] CI: check ignored unignored build artifacts in \"win[+VS] build\" too","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:54Z","receivedAt":"2022-05-25T10:07:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Use the newly created \"ci/check-unignored-build-artifacts.sh\" script\nin the \"win build\" and \"win+VS build\" steps too. These steps weren't\ndoing this sanity check of untracked files against .gitignore before,\nbut as the check passes for them let's keep doing that extra sanity\ncheck.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 6 ++++++\n 1 file changed, 6 insertions(+)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 57b2db06923..c97fbd0f0b3 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -93,6 +93,9 @@ jobs:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n       run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n@@ -180,6 +183,9 @@ jobs:\n       run: |\n         mkdir -p artifacts &&\n         eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n+    - run: ci/check-unignored-build-artifacts.sh\n+      if: success()\n+      shell: bash\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456028","messageId":"patch-v6-16.29-f89346f11eb-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 16/29] CI: invoke \"make artifacts-tar\" directly in windows-build","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:55Z","receivedAt":"2022-05-25T10:07:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the windows-build job to invoke the \"make artifacts-tar\" step\ndirectly, instead of calling a \"ci/make-test-artifacts.sh\" script.\n\nThe script was needed because \"ci/lib.sh\" would set up various\nenvironment variables for us, but now we can instead use the\n\"ci/lib.sh\" in its script mode.\n\nThe \"mkdir -p\" added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) isn't needed, the same commit added that \"mkdir\n-p\" to the \"artifacts-tar\" rule itself, so we can have \"make\" create\nthe directory for us.\n\nThis also has the benefit of making the \"build\" step less chatty,\nsince it won't start with the verbose \"set -x\" output, that's now\ncontained in the \"ci/lib.sh\" step.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml |  5 ++++-\n ci/make-test-artifacts.sh  | 10 ----------\n 2 files changed, 4 insertions(+), 11 deletions(-)\n delete mode 100755 ci/make-test-artifacts.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex c97fbd0f0b3..ca993afd098 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -87,12 +87,15 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: build\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n         NO_PERL: 1\n-      run: . /etc/profile && ci/make-test-artifacts.sh artifacts\n+      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n       shell: bash\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\ndeleted file mode 100755\nindex 45298562982..00000000000\n--- a/ci/make-test-artifacts.sh\n+++ /dev/null\n@@ -1,10 +0,0 @@\n-#!/bin/sh\n-#\n-# Build Git and store artifacts for testing\n-#\n-\n-mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n-\n-. ${0%/*}/lib.sh\n-\n-make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456029","messageId":"patch-v6-18.29-7925b2610fc-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 18/29] CI: combine ci/install{,-docker}-dependencies.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:57Z","receivedAt":"2022-05-25T10:07:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Combine the \"ci/install-dependencies.sh\" and\n\"ci/install-docker-dependencies.sh\" into one script. The \"case\"\nstatement in the latter only cared about \"$jobname\", and can be folded\ninto the same \"case\" statement in the former.\n\nThe reason they split up is historical, until a preceding commit\n\"ci/lib.sh\" required \"bash\", which might not have been available in\n\"docker\".\n\nThis also fixes issue in \"ci/install-docker-dependencies.sh\" where\nwe'd hide errors due to not using \"set -e\". Now that we include\n\"ci/lib.sh\" we won't have that potential issue.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml        |  2 +-\n ci/install-dependencies.sh        | 15 +++++++++++++++\n ci/install-docker-dependencies.sh | 22 ----------------------\n 3 files changed, 16 insertions(+), 23 deletions(-)\n delete mode 100755 ci/install-docker-dependencies.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 88eb2ef2dad..42944020436 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -311,7 +311,7 @@ jobs:\n     container: ${{matrix.vector.image}}\n     steps:\n     - uses: actions/checkout@v1\n-    - run: ci/install-docker-dependencies.sh\n+    - run: ci/install-dependencies.sh\n     - run: ci/lib.sh\n     - run: make\n     - run: make test\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 3e05d38d4ab..cc7fd3bd7f8 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -99,6 +99,21 @@ linux-gcc-default)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install $UBUNTU_COMMON_PKGS\n \t;;\n+linux32)\n+\tlinux32 --32bit i386 sh -c '\n+\t\tapt update >/dev/null &&\n+\t\tapt install -y build-essential libcurl4-openssl-dev \\\n+\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n+\t'\n+\t;;\n+linux-musl)\n+\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n+\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n+\t;;\n+pedantic)\n+\tdnf -yq update >/dev/null &&\n+\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n+\t;;\n esac\n \n if type p4d >/dev/null 2>&1 && type p4 >/dev/null 2>&1\ndiff --git a/ci/install-docker-dependencies.sh b/ci/install-docker-dependencies.sh\ndeleted file mode 100755\nindex 78b7e326da6..00000000000\n--- a/ci/install-docker-dependencies.sh\n+++ /dev/null\n@@ -1,22 +0,0 @@\n-#!/bin/sh\n-#\n-# Install dependencies required to build and test Git inside container\n-#\n-\n-case \"$jobname\" in\n-linux32)\n-\tlinux32 --32bit i386 sh -c '\n-\t\tapt update >/dev/null &&\n-\t\tapt install -y build-essential libcurl4-openssl-dev \\\n-\t\t\tlibssl-dev libexpat-dev gettext python >/dev/null\n-\t'\n-\t;;\n-linux-musl)\n-\tapk add --update build-base curl-dev openssl-dev expat-dev gettext \\\n-\t\tpcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null\n-\t;;\n-pedantic)\n-\tdnf -yq update >/dev/null &&\n-\tdnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null\n-\t;;\n-esac\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456030","messageId":"patch-v6-14.29-0488e29859b-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 14/29] CI: make ci/{lib,install-dependencies}.sh POSIX-compatible","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:53Z","receivedAt":"2022-05-25T10:07:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the unportable constructs in the \"ci/install-dependencies.sh\"\nscripts to use POSIX replacements, and have it run under \"/bin/sh\"\ninstead of \"/usr/bin/env bash\". We needed to:\n\n* Replace pushd/popd with a sub-shell.\n* Change \"mkdir --parents\" to \"mkdir -p\".\n* Use POSIX \"export\" syntax.\n\nThis is in preparation for combining this script and\n\"ci/install-docker-dependencies.sh\", which doesn't have access to\n\"bash\".\n\nWhile we're at it change \"if [\" to \"if test\" in ci/lib.sh. This isn't\nstrictly speaking a case of POSIX-incompatibility, but that syntax was\nbeing used there because this code was using idiomatic bash\nconstructs. Let's have it use our usual style of \"if test\" instead.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/install-dependencies.sh | 27 +++++++++++++++++----------\n ci/lib.sh                  |  4 ++--\n 2 files changed, 19 insertions(+), 12 deletions(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 5d50604e724..3e05d38d4ab 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -1,4 +1,4 @@\n-#!/usr/bin/env bash\n+#!/bin/sh\n #\n # Install dependencies required to build and test Git on Linux and macOS\n #\n@@ -21,7 +21,8 @@ ubuntu-latest)\n \n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n-\texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tPATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\texport PATH\n \tif test -n \"$GITHUB_PATH\"\n \tthen\n \t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n@@ -33,22 +34,28 @@ ubuntu-latest)\n \tsudo apt-get -q update\n \tsudo apt-get -q -y install language-pack-is libsvn-perl apache2 \\\n \t\t$UBUNTU_COMMON_PKGS $CC_PACKAGE\n-\tmkdir --parents \"$P4_PATH\"\n-\tpushd \"$P4_PATH\"\n+\tmkdir -p \"$P4_PATH\"\n+\t(\n+\t\tcd \"$P4_PATH\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4d\"\n \t\twget --quiet \"$P4WHENCE/bin.linux26x86_64/p4\"\n \t\tchmod u+x p4d\n \t\tchmod u+x p4\n-\tpopd\n-\tmkdir --parents \"$GIT_LFS_PATH\"\n-\tpushd \"$GIT_LFS_PATH\"\n+\t)\n+\tmkdir -p \"$GIT_LFS_PATH\"\n+\t(\n+\t\tcd \"$GIT_LFS_PATH\"\n \t\twget --quiet \"$LFSWHENCE/git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\ttar --extract --gunzip --file \"git-lfs-linux-amd64-$LINUX_GIT_LFS_VERSION.tar.gz\"\n \t\tcp git-lfs-$LINUX_GIT_LFS_VERSION/git-lfs .\n-\tpopd\n+\t)\n \t;;\n macos-latest)\n-\texport HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1\n+\tHOMEBREW_NO_AUTO_UPDATE=1\n+\texport HOMEBREW_NO_AUTO_UPDATE\n+\tHOMEBREW_NO_INSTALL_CLEANUP=1\n+\texport HOMEBREW_NO_INSTALL_CLEANUP\n+\n \t# Uncomment this if you want to run perf tests:\n \t# brew install gnu-time\n \tbrew link --force gettext\n@@ -64,7 +71,7 @@ macos-latest)\n \n \tif test -n \"$CC_PACKAGE\"\n \tthen\n-\t\tBREW_PACKAGE=${CC_PACKAGE/-/@}\n+\t\tBREW_PACKAGE=$(echo $CC_PACKAGE | tr '-' '@')\n \t\tbrew install \"$BREW_PACKAGE\"\n \t\tbrew link \"$BREW_PACKAGE\"\n \tfi\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex d18ee1a91e7..8df133b840b 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -94,7 +94,7 @@ ubuntu-latest)\n \t\tbreak\n \tfi\n \n-\tif [ \"$jobname\" = linux-gcc ]\n+\tif test \"$jobname\" = linux-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=/usr/bin/python3\"\n \telse\n@@ -104,7 +104,7 @@ ubuntu-latest)\n \tsetenv --test GIT_TEST_HTTPD true\n \t;;\n macos-latest)\n-\tif [ \"$jobname\" = osx-gcc ]\n+\tif test \"$jobname\" = osx-gcc\n \tthen\n \t\tMAKEFLAGS=\"$MAKEFLAGS PYTHON_PATH=$(which python3)\"\n \telse\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456031","messageId":"patch-v6-20.29-bb5960355fe-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 20/29] ci/run-test-slice.sh: replace shelling out with \"echo\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:59Z","receivedAt":"2022-05-25T10:07:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Amend this code added in b819f1d2cec (ci: parallelize testing on\nWindows, 2019-01-29) to stop shelling out to \"tr\", all we're trying to\ndo here is to turn '\\n'-delimited output into a ' '-delimited list. To\ndo that we can just use \"echo\".\n\nNone of these files will contain the odd characters using \"echo\" might\nchoke on in the general case (i.e. '\\'-escapes and the like).\n\nThis has the added benefit of not adding a redundant ' ' to the end of\nthe T-parameter, which didn't matter in practice, but as we'll see in\na subsequent commit makes for slightly nicer output, as we'll show\nthis variable using a GitHub CI-native feature.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/run-test-slice.sh | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex 70326961454..1de6a18ca47 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -5,6 +5,6 @@\n \n . ${0%/*}/lib.sh\n \n-make --quiet -C t T=\"$(cd t &&\n-\t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n-\ttr '\\n' ' ')\"\n+tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n+\tt[0-9]*.sh))\n+make --quiet -C t T=\"$tests\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456032","messageId":"patch-v6-13.29-6e97633652e-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 13/29] CI: remove \"run-build-and-tests.sh\", run \"make [test]\" directly","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:52Z","receivedAt":"2022-05-25T10:07:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Remove the already thin \"ci/run-build-and-tests.sh\" wrapper and\ninstead make the CI run \"make\" or \"make test\" directly. By doing this\nwe'll be able to easily see at a glance whether our failure was in the\ncompilation or testing, whether that's via human eyes or improve\nmachine readability.\n\nWe also need to run our new \"ci/check-unignored-build-artifacts.sh\" on\nsuccess() in the CI now, just like we already had a step conditional\non failure() running ci/print-test-failures.sh.\n\nThe reason we used a \"ci/run-build-and-tests.sh\" wrapper in the first\nplace had to do with Travis CI-specific constraints that no longer\napply to us, as the Travis CI support has been removed.\n\nInstead we can configure the CI in an earlier step by running\n\"ci/lib.sh\", which under GitHub CI will write the environment\nvariables we need to the \"$GITHUB_ENV\" file.\n\nWe'll then have access to them in subsequent steps, and crucially\nthose variables will be prominently visible at the start of each step\nvia an expandable drop-down in the UI.drop-do.\n\nI.e. this changes the CI run from a top-down flow like (pseudocode):\n\n - job:\n   - step1:\n     - use ci/lib.sh to set env vars\n     - run a script like ci/run-build-and-tests.sh\n   - step2:\n     - if: failure()\n     - use ci/lib.sh to set env vars\n     - run ci/print-test-failures.sh\n\nTo:\n\n - job:\n   - step1:\n     - set variables in $GITHUB_ENV using ci/lib.sh\n   - step2:\n     - make\n   - step3:\n     - make test\n   - step4:\n     - if: failure()\n     - run ci/print-test-failures.sh\n   - step5:\n     - if: success()\n     - run ci/check-unignored-build-artifacts.sh\n\nThere is a proposal[2] to get some of the benefits of this approach by\nnot re-arranging our variable setup in this way, but to instead use\nthe GitHub CI grouping syntax to focus on the relevant parts of \"make\"\nor \"make test\" when we have failures.\n\nDoing it this way makes for better looking GitHub CI UI, and lays much\nbetter ground work for our CI going forward. Because:\n\n * The CI logic will be more portable to a future CI system, since a\n   common feature of them is to run various commands in sequence, but\n   a future system won't necessarily support the GitHub-specifics\n   syntax of \"grouping\" output within a \"step\".\n\n   Even if those systems don't support a \"$GITHUB_ENV\" emulating will\n   be much easier than to deal with some CI-specific grouping syntax.\n\n * At the start of every step the GitHub CI presents an expandable\n   list of environment variables from \"$GITHUB_ENV\". We'll now see\n   exactly what variables affected that step (although we currently\n   overshoot that a bit, and always define all variables).\n\n * CI failures will be easier to reproduce locally, as this makes the\n   relevant ci/* scripts something that sets up our environment, but\n   leaves \"make\" and \"make test\" working as they do locally.\n\n   To reproduce a run the user only needs to set the variables\n   discussed in the drop-down above, either manually or by running\n   \"ci/lib.sh\".\n\n * The output will be less verbose. The \"ci/lib.sh\" script uses \"set\n   -x\", and before this e.g. \"ci/static-analysis.sh\" would start with\n   40 lines of trace output, culminating in using \"export\" to export\n   the relevant environment variables.\n\n   Now that verbosity is in the earlier \"ci/lib.sh\" step, and not in\n   any subsequent one. The \"make\" targets then start out with the\n   relevant non-trace output right away.\n\n * If we do want to use the grouping syntax within a \"step\" it'll now\n   be easier to do so. It doesn't support nesting, so we'd have to\n   make a choice between using it for e.g. \"make\" v.s. \"make test\", or\n   individual test failures. See \"sadly\" in [3].\n\n1. https://lore.kernel.org/git/211120.86k0h30zuw.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/pull.1117.git.1643050574.gitgitgadget@gmail.com/\n3. https://lore.kernel.org/git/9333ba781b8240f704e739b00d274f8c3d887e39.1643050574.git.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml            | 14 ++++++--\n ci/check-unignored-build-artifacts.sh |  8 +++++\n ci/install-dependencies.sh            |  4 +++\n ci/lib.sh                             | 36 +++++++++++++++++++-\n ci/make-test-artifacts.sh             |  2 --\n ci/run-build-and-tests.sh             | 47 ---------------------------\n ci/run-test-slice.sh                  |  2 --\n ci/test-documentation.sh              |  1 -\n 8 files changed, 58 insertions(+), 56 deletions(-)\n create mode 100755 ci/check-unignored-build-artifacts.sh\n delete mode 100755 ci/run-build-and-tests.sh\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex ad752010102..57b2db06923 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -268,7 +268,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success()\n     - run: ci/print-test-failures.sh\n       if: failure()\n     - name: Upload failed tests' directories\n@@ -292,6 +295,7 @@ jobs:\n           image: daald/ubuntu32:xenial\n         - jobname: pedantic\n           image: fedora\n+          skip-tests: yes\n     env:\n       jobname: ${{matrix.vector.jobname}}\n     runs-on: ubuntu-latest\n@@ -299,9 +303,12 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-docker-dependencies.sh\n-    - run: ci/run-build-and-tests.sh\n+    - run: ci/lib.sh\n+    - run: make\n+    - run: make test\n+      if: success() && matrix.vector.skip-tests != 'yes'\n     - run: ci/print-test-failures.sh\n-      if: failure()\n+      if: failure() && matrix.vector.skip-tests != 'yes'\n     - name: Upload failed tests' directories\n       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n       uses: actions/upload-artifact@v1\n@@ -317,6 +324,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nnew file mode 100755\nindex 00000000000..56d04b0db9a\n--- /dev/null\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -0,0 +1,8 @@\n+#!/bin/sh\n+#\n+# Check whether the build created anything not in our .gitignore\n+#\n+\n+. ${0%/*}/lib.sh\n+\n+check_unignored_build_artifacts\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex 41a9185bb1e..5d50604e724 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -22,6 +22,10 @@ ubuntu-latest)\n \tP4_PATH=\"$HOME/custom/p4\"\n \tGIT_LFS_PATH=\"$HOME/custom/git-lfs\"\n \texport PATH=\"$GIT_LFS_PATH:$P4_PATH:$PATH\"\n+\tif test -n \"$GITHUB_PATH\"\n+\tthen\n+\t\techo \"$PATH\" >>\"$GITHUB_PATH\"\n+\tfi\n \n \tP4WHENCE=https://cdist2.perforce.com/perforce/r$LINUX_P4_VERSION\n \tLFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VERSION\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 71e6d6e08e7..d18ee1a91e7 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,3 +1,5 @@\n+#!/bin/sh\n+\n # Library of functions shared by all CI scripts\n \n # Set 'exit on error' for all CI scripts to let the caller know that\n@@ -39,7 +41,10 @@ setenv () {\n \tval=$2\n \tshift 2\n \n-\teval \"export $key=\\\"$val\\\"\"\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"$key=$val\" >>\"$GITHUB_ENV\"\n+\tfi\n }\n \n check_unignored_build_artifacts ()\n@@ -109,6 +114,35 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+linux-gcc)\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n+\t;;\n+linux-TEST-vars)\n+\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n+\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n+\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n+\tsetenv --test GIT_TEST_OE_SIZE 10\n+\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n+\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n+\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n+\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n+\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n+\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n+\t;;\n+linux-clang)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n+\t;;\n+linux-sha256)\n+\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n+\t;;\n+pedantic)\n+\t# Don't run the tests; we only care about whether Git can be\n+\t# built.\n+\tsetenv --build DEVOPTS pedantic\n+\t;;\n linux32)\n \tCC=gcc\n \t;;\ndiff --git a/ci/make-test-artifacts.sh b/ci/make-test-artifacts.sh\nindex 646967481f6..45298562982 100755\n--- a/ci/make-test-artifacts.sh\n+++ b/ci/make-test-artifacts.sh\n@@ -8,5 +8,3 @@ mkdir -p \"$1\" # in case ci/lib.sh decides to quit early\n . ${0%/*}/lib.sh\n \n make artifacts-tar ARTIFACTS_DIRECTORY=\"$1\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\ndeleted file mode 100755\nindex 35d45a9373e..00000000000\n--- a/ci/run-build-and-tests.sh\n+++ /dev/null\n@@ -1,47 +0,0 @@\n-#!/bin/sh\n-#\n-# Build and test Git\n-#\n-\n-. ${0%/*}/lib.sh\n-\n-export MAKE_TARGETS=\"all test\"\n-\n-case \"$jobname\" in\n-linux-gcc)\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n-\t;;\n-linux-TEST-vars)\n-\tsetenv --test GIT_TEST_SPLIT_INDEX yes\n-\tsetenv --test GIT_TEST_MERGE_ALGORITHM recursive\n-\tsetenv --test GIT_TEST_FULL_IN_PACK_ARRAY true\n-\tsetenv --test GIT_TEST_OE_SIZE 10\n-\tsetenv --test GIT_TEST_OE_DELTA_SIZE 5\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH 1\n-\tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n-\tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n-\tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n-\tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n-\tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n-\t;;\n-linux-clang)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha1\n-\t;;\n-linux-sha256)\n-\tsetenv --test GIT_TEST_DEFAULT_HASH sha256\n-\t;;\n-pedantic)\n-\t# Don't run the tests; we only care about whether Git can be\n-\t# built.\n-\tsetenv --build DEVOPTS pedantic\n-\texport MAKE_TARGETS=all\n-\t;;\n-esac\n-\n-# Any new \"test\" targets should not go after this \"make\", but should\n-# adjust $MAKE_TARGETS. Otherwise compilation-only targets above will\n-# start running tests.\n-make $MAKE_TARGETS\n-check_unignored_build_artifacts\ndiff --git a/ci/run-test-slice.sh b/ci/run-test-slice.sh\nindex b9a682b4bcd..70326961454 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/run-test-slice.sh\n@@ -8,5 +8,3 @@\n make --quiet -C t T=\"$(cd t &&\n \t./helper/test-tool path-utils slice-tests \"$1\" \"$2\" t[0-9]*.sh |\n \ttr '\\n' ' ')\"\n-\n-check_unignored_build_artifacts\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex 41e2b126311..6b5cce03bd7 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -39,4 +39,3 @@ test -s Documentation/git.html\n grep '<meta name=\"generator\" content=\"Asciidoctor ' Documentation/git.html\n \n rm -f stdout.log stderr.log stderr.raw\n-check_unignored_build_artifacts\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456033","messageId":"patch-v6-19.29-b00abc07637-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 19/29] CI: move \"env\" definitions into ci/lib.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:03:58Z","receivedAt":"2022-05-25T10:07:22Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Have the GitHub CI jobs use the \"ci/lib\".sh as a source of truth for\nenvironment variables that affect their builds and tests. This brings\nthem in line with the rest of the jobs, and make it easier to see the\nentire CI configuration per jobname at a glance.\n\nTo do this we need to add a ci/lib.sh \"step\" to the remaining jobs\nthat didn't have it added in preceding commits.\n\nThe Makefile parameters are luckily all accepted via the environment,\nso we can export these instead of adding them to MAKEFLAGS.\n\nLet's also use the documented GIT_CONIFG_* mechanism for setting\nconfig instead of the internal GIT_CONFIG_PARAMETERS variable. This\nadjusts code added in 889cacb6897 (ci: configure GitHub Actions for\nCI/PR, 2020-04-11), we could probably use the GIT_AUTHOR_NAME etc, but\nlet's keep setting this via config, just with the documented\nmechanism.\n\nBy setting \"ARTIFACTS_DIRECTORY=artifacts\" once we don't need to\nrepeat it in various places, let's get it from the environment\ninstead.\n\nFinally, the \"DEVELOPER: 1\" was only needed by the \"sparse\" job, which\nwasn't using \"ci/lib.sh\" (and which sets DEVELOPER=1). Let's instead\nhave the \"sparse\" job use the \"ci/lib.sh\" and remove DEVELOPER=1 from\n\".github/workflows/main.yml\".\n\nThis substantially speeds up the \"sparse\" job, since it'll now pick up\nthe \"--jobs\" setting in MAKEFLAGS that we use everywhere else. Before\nit ran in around 4m30s, now in around 2m30s.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 29 +++++++++++------------------\n ci/lib.sh                  | 21 +++++++++++++++++++++\n 2 files changed, 32 insertions(+), 18 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 42944020436..5f167ac5be6 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -2,9 +2,6 @@ name: CI\n \n on: [push, pull_request]\n \n-env:\n-  DEVELOPER: 1\n-\n jobs:\n   ci-config:\n     name: config\n@@ -93,8 +90,7 @@ jobs:\n       shell: bash\n       env:\n         HOME: ${{runner.workspace}}\n-        NO_PERL: 1\n-      run: . /etc/profile && make artifacts-tar ARTIFACTS_DIRECTORY=artifacts\n+      run: . /etc/profile && make artifacts-tar\n       if: success()\n     - run: ci/check-unignored-build-artifacts.sh\n       if: success()\n@@ -105,7 +101,7 @@ jobs:\n       uses: actions/upload-artifact@v2\n       with:\n         name: windows-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   windows-test:\n     name: win test\n     env:\n@@ -126,6 +122,8 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n@@ -145,9 +143,6 @@ jobs:\n       jobname: vs-build\n     needs: ci-config\n     if: needs.ci-config.outputs.enabled == 'yes'\n-    env:\n-      NO_PERL: 1\n-      GIT_CONFIG_PARAMETERS: \"'user.name=CI' 'user.email=ci@git'\"\n     runs-on: windows-latest\n     steps:\n     - uses: actions/checkout@v2\n@@ -171,6 +166,8 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n       run: |\n@@ -181,21 +178,16 @@ jobs:\n     - name: bundle artifact tar\n       shell: bash\n       env:\n-        MSVC: 1\n         VCPKG_ROOT: ${{github.workspace}}\\compat\\vcbuild\\vcpkg\n       run: |\n-        mkdir -p artifacts &&\n-        eval \"$(make -n artifacts-tar INCLUDE_DLLS_IN_ARTIFACTS=YesPlease ARTIFACTS_DIRECTORY=artifacts NO_GETTEXT=YesPlease 2>&1 | grep ^tar)\"\n-    - run: ci/check-unignored-build-artifacts.sh\n-      if: success()\n-      shell: bash\n+        eval \"$(make -n artifacts-tar 2>&1 | grep -e ^mkdir -e ^tar)\"\n     - name: zip up tracked files\n       run: git archive -o artifacts/tracked.tar.gz HEAD\n     - name: upload tracked files and build artifacts\n       uses: actions/upload-artifact@v2\n       with:\n         name: vs-artifacts\n-        path: artifacts\n+        path: ${{env.ARTIFACTS_DIRECTORY}}\n   vs-test:\n     name: win+VS test\n     env:\n@@ -216,10 +208,10 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n+    - run: ci/lib.sh\n+      shell: bash\n     - name: test\n       shell: bash\n-      env:\n-        NO_SVN_TESTS: 1\n       run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n     - name: ci/print-test-failures.sh\n       if: failure()\n@@ -354,6 +346,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n+    - run: ci/lib.sh\n     - run: make sparse\n   documentation:\n     name: documentation\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 5141de85024..de61914134e 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -104,6 +104,27 @@ macos-latest)\n esac\n \n case \"$jobname\" in\n+windows-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\t;;\n+vs-build)\n+\tsetenv --build NO_PERL NoThanks\n+\tsetenv --build NO_GETTEXT NoThanks\n+\tsetenv --build ARTIFACTS_DIRECTORY artifacts\n+\tsetenv --build INCLUDE_DLLS_IN_ARTIFACTS YesPlease\n+\tsetenv --build MSVC YesPlease\n+\n+\tsetenv --build GIT_CONFIG_COUNT 2\n+\tsetenv --build GIT_CONFIG_KEY_0 user.name\n+\tsetenv --build GIT_CONFIG_VALUE_0 CI\n+\tsetenv --build GIT_CONFIG_KEY_1 user.emailname\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\tsetenv --build GIT_CONFIG_VALUE_1 ci@git\n+\t;;\n+vs-test)\n+\tsetenv --test NO_SVN_TESTS YesPlease\n+\t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n \t;;\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456034","messageId":"patch-v6-21.29-1eeb2e8e7f0-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 21/29] CI: pre-select test slice in Windows & VS tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:00Z","receivedAt":"2022-05-25T10:07:25Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the tests have been changed to do their setup via\n$GITHUB_ENV in one step, and to then have subsequent steps that re-use\nthat environment.\n\nLet's change the \"test slice\" tests added in b819f1d2cec (ci:\nparallelize testing on Windows, 2019-01-29) to do the same. These\ntests select 10% of the tests to run in 10 \"test slices\". Now we'll\nselect those in a step that immediately precedes the testing step, and\nthen simply invoke \"make -C t -e\".\n\nThis has the advantage that the tests to be run are now listed in the\nstandard \"Run\" drop-down at the start of the \"test\" step.\n\nSince the \"T\" variable in \"t/Makefile\" doesn't normally accept\noverrides from the environment we need to invoke \"make\" with the \"-e\"\noption (a.k.a. \"--environment-overrides\"). We could also make $(T) in\nt/Makefile be a \"?=\" assigned variable, but this way works, and is\narguably clearer as it's more obvious that we're injecting a special\nlist of tests that override the normal behavior of that Makefile.\n\nNote that we cannot run the top-level \"make test\" here, because of how\nthe Windows CI builds git, i.e. either via CMake or some option that\nwould cause \"make test\" to recompile git itself. Instead we run \"make\n-C t [...]\".\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml                     | 10 ++++++++--\n ci/{run-test-slice.sh => select-test-slice.sh} |  7 +++++--\n 2 files changed, 13 insertions(+), 4 deletions(-)\n rename ci/{run-test-slice.sh => select-test-slice.sh} (50%)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 5f167ac5be6..83e0aa1f469 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -124,9 +124,12 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\n@@ -210,9 +213,12 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh\n       shell: bash\n+    - name: select tests\n+      run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n+      shell: bash\n     - name: test\n       shell: bash\n-      run: . /etc/profile && ci/run-test-slice.sh ${{matrix.nr}} 10\n+      run: . /etc/profile && make -C t -e\n     - name: ci/print-test-failures.sh\n       if: failure()\n       shell: bash\ndiff --git a/ci/run-test-slice.sh b/ci/select-test-slice.sh\nsimilarity index 50%\nrename from ci/run-test-slice.sh\nrename to ci/select-test-slice.sh\nindex 1de6a18ca47..f59d8cadda5 100755\n--- a/ci/run-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -1,10 +1,13 @@\n #!/bin/sh\n #\n-# Test Git in parallel\n+# Select a portion of the tests for testing Git in parallel\n #\n \n . ${0%/*}/lib.sh\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\n-make --quiet -C t T=\"$tests\"\n+if test -n \"$GITHUB_ENV\"\n+then\n+\techo T=\"$tests\" >>$GITHUB_ENV\n+fi\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456035","messageId":"patch-v6-22.29-39979d9887d-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 22/29] CI: only invoke ci/lib.sh as \"steps\" in main.yml","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:01Z","receivedAt":"2022-05-25T10:07:28Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the scripts in ci/ to stop using ci/lib.sh as a library, now\nthat the only thing it did for them was to \"set -ex\" and possibly set\nTERM=dumb.\n\nLet's create a ci/lib-tput.sh for those that need to use \"tput\"\ninstead, and have these scripts invoke \"set -ex\" themselves.\n\nThis makes their invocation a lot less verbose, since they'll be\nrelying on an earlier step in the CI job to have set the variables in\n$GITHUB_ENV, and won't be spewing their own trace output to set those\nvariables again.\n\nLet's also create a ci/lib-ci-type.sh, and have ci/lib.sh and\nci/print-test-failures.sh share the logic to discover the CI type. We\ncould have set the CI_TYPE in the environment with \"setenv\", but let's\navoid that verbosity for this purely internal variable.\n\nThe \"ci/lib.sh\" is now no longer a \"Library of functions shared by all\nCI scripts\", so let's remove that commentary, and the misleading\ncomment about \"set -ex\" being for \"installing dependencies\", we're now\nno longer using it in \"ci/install-dependencies.sh\" (but it does its\nown \"set -ex\").\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/check-unignored-build-artifacts.sh |  4 +++-\n ci/install-dependencies.sh            |  2 +-\n ci/lib-ci-type.sh                     |  9 +++++++++\n ci/lib-tput.sh                        |  5 +++++\n ci/lib.sh                             | 27 ++++++++++-----------------\n ci/print-test-failures.sh             |  6 +++---\n ci/select-test-slice.sh               |  2 +-\n ci/test-documentation.sh              |  2 +-\n 8 files changed, 33 insertions(+), 24 deletions(-)\n create mode 100644 ci/lib-ci-type.sh\n create mode 100644 ci/lib-tput.sh\n\ndiff --git a/ci/check-unignored-build-artifacts.sh b/ci/check-unignored-build-artifacts.sh\nindex 0bc04f32804..c27d6a97f45 100755\n--- a/ci/check-unignored-build-artifacts.sh\n+++ b/ci/check-unignored-build-artifacts.sh\n@@ -3,7 +3,9 @@\n # Check whether the build created anything not in our .gitignore\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n+\n+. ${0%/*}/lib-tput.sh\n \n check_unignored_build_artifacts ()\n {\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex cc7fd3bd7f8..9ee52769cbe 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -3,7 +3,7 @@\n # Install dependencies required to build and test Git on Linux and macOS\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n UBUNTU_COMMON_PKGS=\"make libssl-dev libcurl4-openssl-dev libexpat-dev\n  tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl\ndiff --git a/ci/lib-ci-type.sh b/ci/lib-ci-type.sh\nnew file mode 100644\nindex 00000000000..6f01fd9e5d9\n--- /dev/null\n+++ b/ci/lib-ci-type.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+\n+if test \"$GITHUB_ACTIONS\" = \"true\"\n+then\n+\tCI_TYPE=github-actions\n+else\n+\techo \"Could not identify CI type\" >&2\n+\texit 1\n+fi\ndiff --git a/ci/lib-tput.sh b/ci/lib-tput.sh\nnew file mode 100644\nindex 00000000000..b62ef13c44c\n--- /dev/null\n+++ b/ci/lib-tput.sh\n@@ -0,0 +1,5 @@\n+#!/bin/sh\n+\n+# GitHub Action doesn't set TERM, which is required by tput\n+TERM=${TERM:-dumb}\n+export TERM\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex de61914134e..15a0011f6aa 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -1,13 +1,9 @@\n #!/bin/sh\n-\n-# Library of functions shared by all CI scripts\n-\n-# Set 'exit on error' for all CI scripts to let the caller know that\n-# something went wrong.\n-# Set tracing executed commands, primarily setting environment variables\n-# and installing dependencies.\n set -ex\n \n+# Helper libraries\n+. ${0%/*}/lib-ci-type.sh\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -47,18 +43,14 @@ setenv () {\n \tfi\n }\n \n-# GitHub Action doesn't set TERM, which is required by tput\n-setenv TERM ${TERM:-dumb}\n-\n # How many jobs to run in parallel?\n NPROC=10\n \n # Clear MAKEFLAGS that may come from the outside world.\n MAKEFLAGS=--jobs=$NPROC\n \n-if test \"$GITHUB_ACTIONS\" = \"true\"\n-then\n-\tCI_TYPE=github-actions\n+case \"$CI_TYPE\" in\n+github-actions)\n \tCC=\"${CC_PACKAGE:-${CC:-gcc}}\"\n \n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n@@ -66,11 +58,12 @@ then\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n-else\n-\techo \"Could not identify CI type\" >&2\n-\tenv >&2\n+\t;;\n+*)\n+\techo \"Unhandled CI type: $CI_TYPE\" >&2\n \texit 1\n-fi\n+\t;;\n+esac\n \n setenv --build DEVELOPER 1\n setenv --test DEFAULT_TEST_TARGET prove\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 47e2ea1ad10..29f8c332eca 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -3,10 +3,10 @@\n # Print output of failing tests\n #\n \n-. ${0%/*}/lib.sh\n+set -e\n \n-# Tracing executed commands would produce too much noise in the loop below.\n-set +x\n+. ${0%/*}/lib-ci-type.sh\n+. ${0%/*}/lib-tput.sh\n \n cd t/\n \ndiff --git a/ci/select-test-slice.sh b/ci/select-test-slice.sh\nindex f59d8cadda5..eccf9a48104 100755\n--- a/ci/select-test-slice.sh\n+++ b/ci/select-test-slice.sh\n@@ -3,7 +3,7 @@\n # Select a portion of the tests for testing Git in parallel\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n tests=$(echo $(cd t && ./helper/test-tool path-utils slice-tests \"$1\" \"$2\" \\\n \tt[0-9]*.sh))\ndiff --git a/ci/test-documentation.sh b/ci/test-documentation.sh\nindex b8a6a6f664e..64ff212cdaa 100755\n--- a/ci/test-documentation.sh\n+++ b/ci/test-documentation.sh\n@@ -3,7 +3,7 @@\n # Perform sanity checks on \"make doc\" output and built documentation\n #\n \n-. ${0%/*}/lib.sh\n+set -ex\n \n generator=$1\n \n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456036","messageId":"patch-v6-23.29-e2b3bf032d6-20220525T094123Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com","subject":"[PATCH v6 23/29] CI: narrow down variable definitions in --build and --test","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T10:04:02Z","receivedAt":"2022-05-25T10:07:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In a preceding step the \"setvar\" function was made to take a\n\"--build\", \"--test\" or \"--all\" argument to indicate where the\nvariables it sets were used.\n\nLet's make use of that by having the relevant parts of\n\".github/workflows/main.yml\" invoke \"ci/lib.sh\" with those options.\n\nBy doing this the set of variables shown in build-only steps will be\nfewer, which makes diagnosing anything going on there easier, as we\nwon't have to look at a deluge of e.g. GIT_TEST_* variables.\n\nFor the \"pedantic\" job (which has no test phase) we won't run the\n\"ci/lib.sh --test\" step, which will be clearly visible as a skipped\nstep in the UX.\n\nSince we'll now always run \"--build\" for \"make\" and \"--test\" for \"make\ntest\" we can stop setting the \"fat\" MAKEFLAGS entirely on the \"test\"\nsteps, i.e. the one with PYTHON_PATH, CC etc. These will all be\ncarried over from the earlier --build step.\n\nThat won't be true in the case of the \"windows-test\" and \"vs-test\"\njobs, since they run separately from the corresponding \"build\"\nstep. So we'll need to make sure that we have the --jobs=N argument\nfor those.\n\nThis doesn't matter that much, as we'll still have --jobs=N in\nGIT_PROVE_OPTS. So the only thing we'll use it for is parallelism in\nthe t/Makefile before we get to running \"prove\". Still, it's good to\nbe consistent for good measure, and to run the t/Makefile itself in\nparallel.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 21 ++++++++-------\n ci/lib.sh                  | 52 +++++++++++++++++++++++++++++++++++---\n 2 files changed, 60 insertions(+), 13 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 83e0aa1f469..bb62b4ff725 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -84,7 +84,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: build\n       shell: bash\n@@ -122,7 +122,7 @@ jobs:\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -169,7 +169,7 @@ jobs:\n     - name: copy dlls to root\n       shell: cmd\n       run: compat\\vcbuild\\vcpkg_copy_dlls.bat release\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n       shell: bash\n     - name: generate Visual Studio solution\n       shell: bash\n@@ -211,7 +211,7 @@ jobs:\n     - name: extract tracked files and build artifacts\n       shell: bash\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --test\n       shell: bash\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n@@ -275,8 +275,9 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -310,8 +311,10 @@ jobs:\n     steps:\n     - uses: actions/checkout@v1\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make\n+    - run: ci/lib.sh --test\n+      if: success() && matrix.vector.skip-tests != 'yes'\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'yes'\n     - run: ci/print-test-failures.sh\n@@ -331,7 +334,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make ci-static-analysis\n   sparse:\n     needs: ci-config\n@@ -352,7 +355,7 @@ jobs:\n     - uses: actions/checkout@v2\n     - name: Install other dependencies\n       run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make sparse\n   documentation:\n     name: documentation\n@@ -364,7 +367,7 @@ jobs:\n     steps:\n     - uses: actions/checkout@v2\n     - run: ci/install-dependencies.sh\n-    - run: ci/lib.sh\n+    - run: ci/lib.sh --build\n     - run: make check-docs\n     - run: \"make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)\"\n       shell: bash\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 15a0011f6aa..96919882c11 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -4,6 +4,30 @@ set -ex\n # Helper libraries\n . ${0%/*}/lib-ci-type.sh\n \n+# Parse options\n+mode_build=\n+mode_test=\n+while test $# != 0\n+do\n+\tcase \"$1\" in\n+\t--build)\n+\t\tmode_build=t\n+\t\t;;\n+\t--test)\n+\t\tmode_test=t\n+\t\t;;\n+\t-*)\n+\t\techo \"error: invalid option: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\t*)\n+\t\techo \"error: invalid argument: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n # Starting assertions\n if test -z \"$jobname\"\n then\n@@ -11,16 +35,28 @@ then\n \texit 1\n fi\n \n+if test \"$mode_test$mode_build\" != \"t\"\n+then\n+\techo \"error: need one mode, e.g. --build or --test\" >&2\n+\texit 1\n+fi\n+\n # Helper functions\n setenv () {\n \twhile test $# != 0\n \tdo\n \t\tcase \"$1\" in\n \t\t--build)\n+\t\t\tif test -z \"$mode_build\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n \t\t\t;;\n \t\t--test)\n-\t\t\t;;\n-\t\t--all)\n+\t\t\tif test -z \"$mode_test\"\n+\t\t\tthen\n+\t\t\t\treturn 0\n+\t\t\tfi\n \t\t\t;;\n \t\t-*)\n \t\t\techo \"BUG: bad setenv() option '$1'\" >&2\n@@ -46,8 +82,12 @@ setenv () {\n # How many jobs to run in parallel?\n NPROC=10\n \n+# For \"--test\" we carry the MAKEFLAGS over from earlier steps, except\n+# in stand-alone jobs which will use $COMMON_MAKEFLAGS.\n+COMMON_MAKEFLAGS=--jobs=$NPROC\n+\n # Clear MAKEFLAGS that may come from the outside world.\n-MAKEFLAGS=--jobs=$NPROC\n+MAKEFLAGS=$COMMON_MAKEFLAGS\n \n case \"$CI_TYPE\" in\n github-actions)\n@@ -101,6 +141,9 @@ windows-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build ARTIFACTS_DIRECTORY artifacts\n \t;;\n+windows-test)\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n+\t;;\n vs-build)\n \tsetenv --build NO_PERL NoThanks\n \tsetenv --build NO_GETTEXT NoThanks\n@@ -117,6 +160,7 @@ vs-build)\n \t;;\n vs-test)\n \tsetenv --test NO_SVN_TESTS YesPlease\n+\tsetenv --test MAKEFLAGS \"$COMMON_MAKEFLAGS\"\n \t;;\n linux-gcc)\n \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME main\n@@ -162,4 +206,4 @@ linux-leaks)\n \t;;\n esac\n \n-setenv --all MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n+setenv --build MAKEFLAGS \"$MAKEFLAGS CC=${CC:-cc}\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456044","messageId":"patch-v6-01.14-c10a11fdae8-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 01/14] CI: don't \"cd\" in ci/print-test-failures.sh","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:50Z","receivedAt":"2022-05-25T11:26:29Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the logic in ci/print-test-failures.sh so that we don't need to\n\"cd\" at the top-level, we'll now only do so for the \"tar\" command.\n\nThis way we can remove some duplicate code added in\naea8879a6ac (travis-ci: include the trash directories of failed tests\nin the trace log, 2018-08-01), i.e. not have both a $TEST_NAME and\n$test_name. The output is exactly the same as before,\ni.e. \"test-results/\" was included in the heading.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 29 ++++++++++++++++-------------\n 1 file changed, 16 insertions(+), 13 deletions(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex ec395c79ccd..f6736f424e0 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -8,33 +8,36 @@ set -e\n . ${0%/*}/lib-ci-type.sh\n . ${0%/*}/lib-tput.sh\n \n-cd t/\n-\n-if ! ls test-results/*.exit >/dev/null 2>/dev/null\n+if ! ls t/test-results/*.exit >/dev/null 2>/dev/null\n then\n \techo \"Build job failed before the tests could have been run\"\n \texit\n fi\n \n-for TEST_EXIT in test-results/*.exit\n+for TEST_EXIT in t/test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n \tthen\n-\t\tTEST_OUT=\"${TEST_EXIT%exit}out\"\n+\t\tTEST_NAME=\"${TEST_EXIT%.exit}\"\n+\t\tTEST_NAME=\"${TEST_NAME##*/}\"\n+\t\tTEST_OUT=\"${TEST_NAME}.out\"\n+\t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n+\n \t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n+\t\techo \"$(tput setaf 1)test-results/${TEST_OUT}...$(tput sgr0)\"\n \t\techo \"------------------------------------------------------------------------\"\n-\t\tcat \"${TEST_OUT}\"\n+\t\tcat \"t/test-results/${TEST_OUT}\"\n \n-\t\ttest_name=\"${TEST_EXIT%.exit}\"\n-\t\ttest_name=\"${test_name##*/}\"\n-\t\ttrash_dir=\"trash directory.$test_name\"\n+\t\ttrash_dir=\"trash directory.$TEST_NAME\"\n \t\tcase \"$CI_TYPE\" in\n \t\tgithub-actions)\n-\t\t\tmkdir -p failed-test-artifacts\n+\t\t\tmkdir -p t/failed-test-artifacts\n \t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n-\t\t\tcp \"${TEST_EXIT%.exit}.out\" failed-test-artifacts/\n-\t\t\ttar czf failed-test-artifacts/\"$test_name\".trash.tar.gz \"$trash_dir\"\n+\t\t\tcp \"t/test-results/${TEST_OUT}\" t/failed-test-artifacts/\n+\t\t\t(\n+\t\t\t\tcd t &&\n+\t\t\t\ttar czf failed-test-artifacts/\"$TEST_NAME\".trash.tar.gz \"$trash_dir\"\n+\t\t\t)\n \t\t\t;;\n \t\tesac\n \tfi\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456045","messageId":"patch-v6-02.14-1d07ca58322-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 02/14] CI: don't include \"test-results/\" in ci/print-test-failures.sh output","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:51Z","receivedAt":"2022-05-25T11:26:30Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the ci/print-test-failures.sh output introduced in\n657343a602e (travis-ci: move Travis CI code into dedicated scripts,\n2017-09-10) to stop including \"test-results/\" in the heading, it was\nmore of an artifact of how the iteration was being done in that\ninitial version than anything else.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex f6736f424e0..1249bb0c0cf 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -24,7 +24,7 @@ do\n \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n \n \t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)test-results/${TEST_OUT}...$(tput sgr0)\"\n+\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n \t\techo \"------------------------------------------------------------------------\"\n \t\tcat \"t/test-results/${TEST_OUT}\"\n \n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456046","messageId":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com","subject":"[PATCH v6 00/14] CI: js/ci-github-workflow-markup rebased on \"use $GITHUB_ENV\"","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:49Z","receivedAt":"2022-05-25T11:26:33Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This non-RFC re-roll of [1] is based on the just-re-rolled [2]\n(hereafter \"base\") and proposes to replace [3]. It incorporates the\nrelevant parts of [3] that were new in that re-roll.\n\nBefore getting into the details it's helpful to open the following\nlinks:\n\n  master: https://github.com/avar/git/actions/runs/2377697338\n  js: https://github.com/avar/git/actions/runs/2377281297\n  base: https://github.com/avar/git/actions/runs/2377257487\n  this: https://github.com/avar/git/actions/runs/2383110429\n  this with 'raw': https://github.com/avar/git/actions/runs/2383134850\n\nThese are all versions of the relevant branches in play with the same\ncommit on top to trigger CI failures. The \"master\" and \"base\" are the\nsame as those noted in [2], the \"js\" is [3] (but rebased on master),\nand \"this\" is this topic. The \"this with 'raw'\" is this topic, but\nconfigured to omit the new GitHub CI Markdown output (see 13/14 and\n14/14).\n\nHaving these open allows us to compare the output and performance of\nthese different proposed CI topics. Here clicking on e.g. linux-sha256\n(which has a verbose test failure) will on these topics on in the\nChrome debugger[4].\n\n  master: https://github.com/avar/git/runs/6573058614?check_suite_focus=true\n  262 ms  Loading\n  3977 ms  Scripting\n  1632 ms  Rendering\n  641 ms  Painting\n  934 ms  System\n  920 ms  Idle\n  8366 ms  Total\n\n  js: https://github.com/avar/git/runs/6571972194?check_suite_focus=true\n  170 ms  Loading\n  12934 ms  Scripting\n  7364 ms  Rendering\n  6940 ms  Painting\n  5489 ms  System\n  5940 ms  Idle\n  38836 ms  Total\n\n  base: https://github.com/avar/git/runs/6571804381?check_suite_focus=true\n  215 ms  Loading\n  3270 ms  Scripting\n  1171 ms  Rendering\n  649 ms  Painting\n  941 ms  System\n  731 ms  Idle\n  6976 ms  Total\n\n  this: https://github.com/avar/git/runs/6588407676?check_suite_focus=true\n  201 ms  Loading\n  9192 ms  Scripting\n  6104 ms  Rendering\n  5553 ms  Painting\n  4684 ms  System\n  6184 ms  Idle\n  31917 ms  Total\n\n  this with 'raw': https://github.com/avar/git/runs/6588579493?check_suite_focus=true\n  173 ms  Loading\n  3036 ms  Scripting\n  1110 ms  Rendering\n  617 ms  Painting\n  1028 ms  System\n  714 ms  Idle\n  6678 ms  Total\n\nAs noted in previous performance testing [5] what these results\nindicate is that the more output you put under GitHub CI's \"groups\"\nthe slower it will get. With the \"js\" variant in particular it can be\nseen to struggle to render as you're watching it.\n\nIt's faster with \"this\" because there's less rendering to be done. Due\nto the changes in the \"base\" topic to make \"make\" and \"make test\"\ntop-level commands we can run there's less data in the step where we\nneed to print failures in detail.\n\nSo re: [6] this shows how the two serieses are complimentary and make\nthe overall CI UX better when combined than stand-alone.\n\nChanges since the RFC v5:\n\n * Incorporated the v3[3] of js/ci-github-workflow-markup.\n\n * Applied fix-up to get rid of broken\n   ci/print-test-failures-github.sh (which didn't exist anymore)\n\n * The v5 of this series had an issue where we'd \"zoom in\" on the\n   \"make test\" output, instead of the new GitHub CI markdown\n   output. We now combine the best of both worlds. We'll have a \"make\n   test\" and \"ci/print-test-failures.sh\" steps, both of which fail,\n   but we'll \"zoom in\" on the latter, which contains the new output.\n\n * As before this series applied some DRY principles to the code [7]\n   proposed to add, i.e. the \"handle_failed_tests\" was a\n   near-duplication of the code in\n   ci/print-test-failures-github.sh. The 01-03/14 here allow us to\n   unify the two & share the code instead.\n\n   My RFC v5 had some options we didn't need (--exit-code and\n   --no-exit-code) that I removed. It furthermore defaults to \"auto\"\n   discovering if we should emit the GitHub CI *.markup output based\n   on if we find those files in t/test-results, which as we'll see in\n   13-14/14 makes configuring the output simpler.\n\n * Due to the above and other changes here being smaller the \"ci: make\n   it easier to find failed tests' logs in the GitHub workflow\" here\n   is now a squashed version of changes done in several steps in\n   [3]. We now add the ability to emit GitHub CI markup in one commit,\n   and enable it in another.\n\n * In the latest \"js\" topic the \"ok\" tests were skipped, but we'd\n   still include \"skip\" tests, i.e. \"not ok .. TODO\" tests. These\n   should be considered \"ok\" for the purposes of the output, so a new\n   09/14 here excludes them too.\n\n * An updated commit message for 10/14 notes a subtle and presumably\n   unintended side-effect/bug in \"ci(github): avoid printing test case\n   preamble twice\" new in the v3 of [3]. In tweaking the *.markup\n   files we also change the output in the *.out files (i.e. the raw\n   logs).\n\n   You thus won't get the same output in *.out (the raw logs) with the\n   new output.\n\n * New 13/14 and 14/14 commits here make the CI output type\n   configurable using the same \"ci-config\" method we use for the\n   existing \"check-ref\". As explained in 14/14 this is what I'm using\n   to produce \"this with 'raw'\" output the same commit as \"this\". I\n   push to a branch whose name ends with \"_CI_OUT_RAW\".\n\n   This allows users (such as me, or per 13/14 probably SZEDER too) to\n   configure our output to avoid this GitHub markdown in our\n   ci-config.\n\n * As 13/14 argues for I think a better thing to do would be to avoid\n   14/14 for now and take this series without making the new \"github\"\n   output the default.\n\n   But in the interest of not conflating that with this proposed\n   re-roll 14/14 changes the default from \"raw\" to \"github\" again,\n   thus making the output [3] is proposing the default here too.\n\n   We can always revert 14/14 later if we think that was premature,\n   which as shown there is now a one-line change.\n\nTo continue from the last note above: This series also allows for\ncombining the new & old output in a way where we can have our cake &\neat it too. If we load the \"this\" output and \"zoom in\" on the failed\n\"make test\" step instead of the subsequent \"ci/print-test-failures.sh\"\nstep we'll load the page in around 1/6 the time, or:\n\n  this (zoomed in on 'make test'): https://github.com/avar/git/runs/6588407676?check_suite_focus=true#step:7:1437\n  149 ms  Loading\n  2559 ms  Scripting\n  934 ms  Rendering\n  591 ms  Painting\n  845 ms  System\n  605 ms  Idle\n  5684 ms  Total\n\nClicking on the \"ci/print-test-failures.sh\" will then take just as\nlong. I haven't implemented this as a configurable feature is just a\nmatter of making ci/print-test-failures.sh exit with 0 where it now\nexits with 1 (as we always \"zoom in\" on the last failed step, which\nthen will be \"make test\").\n\nFor Junio:\n\nIf you eject js/ci-github-workflow-markup you'll get a minor conflict\n(as before) with js/use-builtin-add-i, and a new conflict with\njx/l10n-workflow-change. The correct resolution is to \"git rm\nci/run-build-and-tests.sh ci/run-static-analysis.sh\" and apply this\ndiff on top:\n\n\tdiff --git a/Makefile b/Makefile\n\tindex b602bdaed4a..984b1a1905d 100644\n\t--- a/Makefile\n\t+++ b/Makefile\n\t@@ -3625,3 +3625,4 @@ ci-static-analysis: ci-check-directional-formatting\n\t ci-static-analysis: check-builtins\n\t ci-static-analysis: check-coccicheck\n\t ci-static-analysis: hdr-check\n\t+ci-static-analysis: check-pot\n\tdiff --git a/ci/lib.sh b/ci/lib.sh\n\tindex b148d3f209f..c6b17b4cb22 100755\n\t--- a/ci/lib.sh\n\t+++ b/ci/lib.sh\n\t@@ -282,7 +282,7 @@ linux-TEST-vars)\n\t \tsetenv --test GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS 1\n\t \tsetenv --test GIT_TEST_MULTI_PACK_INDEX 1\n\t \tsetenv --test GIT_TEST_MULTI_PACK_INDEX_WRITE_BITMAP 1\n\t-\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 1\n\t+\tsetenv --test GIT_TEST_ADD_I_USE_BUILTIN 0\n\t \tsetenv --test GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME master\n\t \tsetenv --test GIT_TEST_WRITE_REV_INDEX 1\n\t \tsetenv --test GIT_TEST_CHECKOUT_WORKERS 2\n\n\n1. https://lore.kernel.org/git/RFC-cover-v5-00.10-00000000000-20220421T183001Z-avarab@gmail.com/\n2. https://lore.kernel.org/git/cover-v6-00.29-00000000000-20220525T094123Z-avarab@gmail.com/\n3. https://lore.kernel.org/git/pull.1117.v3.git.1653171536.gitgitgadget@gmail.com/\n4. Version 101.0.4951.54 (Official Build) (64-bit). Opening the\n   debugger in an empty tab (F12), going to \"Performance\" and\n   recording a trace (Ctrl+E) (note: *not* Ctrl+Shift+E, as that would\n   end it after network load, but before rendering is done & the page\n   is ready to interact with).\n\n   The \"Total\" times here are \"real\" and don't very with how fast I am\n   to \"stop\" the trace (tested by leaving it lingering for a long\n   time).\n5. https://lore.kernel.org/git/220523.86ee0kzjix.gmgdl@evledraar.gmail.com/\n6. https://lore.kernel.org/git/nycvar.QRO.7.76.6.2205232040130.352@tvgsbejvaqbjf.bet/\n7. https://lore.kernel.org/git/417f702a2454316f0bdc5b66eb16751272ff2989.1653171536.git.gitgitgadget@gmail.com/\n\nJohannes Schindelin (6):\n  tests: refactor --write-junit-xml code\n  test(junit): avoid line feeds in XML attributes\n  ci: optionally mark up output in the GitHub workflow\n  ci(github): skip the logs of the successful test cases\n  ci(github): mention where the full logs can be found\n  ci: call `finalize_test_case_output` a little later\n\nVictoria Dye (1):\n  ci(github): avoid printing test case preamble twice\n\nÆvar Arnfjörð Bjarmason (7):\n  CI: don't \"cd\" in ci/print-test-failures.sh\n  CI: don't include \"test-results/\" in ci/print-test-failures.sh output\n  CI: stop setting FAILED_TEST_ARTIFACTS N times\n  ci: make it easier to find failed tests' logs in the GitHub workflow\n  ci(github): skip \"skip\" tests in --github-workflow-markup\n  CI: make --github-workflow-markup ci-config, off by default\n  CI: make the --github-workflow-markup \"github\" output the default\n\n .github/workflows/main.yml           |  24 +++++\n ci/lib.sh                            |  12 +++\n ci/print-test-failures.sh            | 100 ++++++++++++++++----\n t/test-lib-functions.sh              |   6 +-\n t/test-lib-github-workflow-markup.sh |  56 ++++++++++++\n t/test-lib-junit.sh                  | 132 +++++++++++++++++++++++++++\n t/test-lib.sh                        | 128 ++++----------------------\n 7 files changed, 332 insertions(+), 126 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n create mode 100644 t/test-lib-junit.sh\n\nRange-diff against v5:\n 1:  56910df26e7 =  1:  c10a11fdae8 CI: don't \"cd\" in ci/print-test-failures.sh\n 3:  577a5be34f4 =  2:  1d07ca58322 CI: don't include \"test-results/\" in ci/print-test-failures.sh output\n 4:  1482f840f64 !  3:  fdc5b534644 CI: stop setting FAILED_TEST_ARTIFACTS N times\n    @@ ci/print-test-failures.sh: do\n      \t\t\tcp \"t/test-results/${TEST_OUT}\" t/failed-test-artifacts/\n      \t\t\t(\n      \t\t\t\tcd t &&\n    -@@ ci/print-test-failures.sh: done\n    - \n    - if test -n \"$failed\"\n    - then\n    +@@ ci/print-test-failures.sh: do\n    + \t\tesac\n    + \tfi\n    + done\n    ++\n    ++if test -n \"$failed\"\n    ++then\n     +\tif test -n \"$GITHUB_ENV\"\n     +\tthen\n     +\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n     +\tfi\n    -+\n    - \tif test -n \"$exit_code\"\n    - \tthen\n    - \t\texit 1\n    ++fi\n 6:  d9b7d5ddf5a =  4:  a75846a12f2 tests: refactor --write-junit-xml code\n 7:  2d233bbdc22 =  5:  5b709dde86a test(junit): avoid line feeds in XML attributes\n 8:  5dd43a1624b =  6:  f5b39f1660d ci: optionally mark up output in the GitHub workflow\n 2:  caec0b1089a !  7:  e713ca6041b CI: add --exit-code to ci/print-test-failures.sh\n    @@ Metadata\n     Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## Commit message ##\n    -    CI: add --exit-code to ci/print-test-failures.sh\n    +    ci: make it easier to find failed tests' logs in the GitHub workflow\n     \n    -    The ci/print-test-failures.sh scripts will exit 0 when there's failed\n    -    tests, let's teach it --exit-code to have it exit non-zero in those\n    -    cases.\n    +    When investigating a test failure, the time that matters most is the\n    +    time it takes from getting aware of the failure to displaying the output\n    +    of the failing test case.\n     \n    +    You currently have to know a lot of implementation details when\n    +    investigating test failures in the CI runs. The first step is easy: the\n    +    failed job is marked quite clearly, but when opening it, the failed step\n    +    is expanded, which in our case is the one running\n    +    `make` or 'make test`. When failing in the latter we only show a\n    +    high-level view of what went wrong: it prints the output of `prove`\n    +    which merely tells the reader which test script failed, along with the failed\n    +    test numbers.\n    +\n    +    To diagnose those failures in detail the user has then had to know\n    +    that they should expand the subsequent \"Run ci/print-test-failures.sh\"\n    +    step. Because that step always exits successfully it's not expanded by\n    +    default (the GitHub CI only expands the last failing step), making it\n    +    easy to miss that there is useful information hidden in there.\n    +\n    +    This change does a couple of things to improve the situation:\n    +\n    +     * We now make use of the \"exit code\" feature of\n    +       ci/print-test-failures.sh added in a preceding commit, thus if \"make\n    +       test\" fails we'll pick up that we have failing tests, and fail in\n    +       ci/print-test-failures.sh too.\n    +\n    +       Note that we still exit successfully from ci/print-test-failures.sh\n    +       if we don't have logs of any failed tests in t/test-results. Thus\n    +       if we fail in \"make\" (i.e. when building), or even in \"make test\"\n    +       in a way that doesn't yield a failed test (e.g. the t/Makefile\n    +       itself failing) we'll correctly \"zoom in\" on the (hopefully\n    +       failing) \"make test\" instead.\n    +\n    +       As before if there was no previously failed step the\n    +       ci/print-test-failures.sh step is skipped entirely (see\n    +       .github/workflows/main.yml)\n    +\n    +       To make the script DWYM the ci/print-test-failures.sh defaults to\n    +       an \"auto\" mode. Thus since we turn on --github-workflow-markup in\n    +       ci/lib.sh we'll write *.markup files, and will pick up on that in\n    +       ci/print-test-failures.sh.\n    +\n    +       The \"$github_workflow_markup\" being \"auto\" (or \"t\") on failure is\n    +       also what makes us exit non-zero. We could also add\n    +       --[no-]exit-code arguments, but at this point we only need this for\n    +       the \"*.markup\" mode, so let's leave that for now.\n    +\n    +       By having this be \"auto\" well pick up on whatever the GIT_TEST_OPTS\n    +       setting is, which as we'll see in a subsequent commit will be\n    +       useful if we'd like to configure the CI to emit it only some of the\n    +       time.\n    +\n    +     * The ci/print-test-failures.sh now makes use of the GitHub markdown\n    +       introduced for t/test-lib.sh in the preceding commit. I.e. in GitHub\n    +       CI we'll now run with --github-workflow-markup in GIT_TEST_OPTS,\n    +       which causes our \"--verbose\" output in\n    +       \"t/test-results/$TEST_OUT.markup\" to be in the GitHub CI-specific\n    +       Markdown format.\n    +\n    +    The new output is easier to read since it makes use of collapsible grouping.\n    +    Initially, readers will see the high-level view of what actually happened.\n    +    To drill down, the \"group\" for the specific failing test(s) can be expanded.\n    +\n    +    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    + ## ci/lib.sh ##\n    +@@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    + case \"$CI_TYPE\" in\n    + github-actions)\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n    +-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    ++\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    + \ttest Windows != \"$RUNNER_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    + \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n    +\n      ## ci/print-test-failures.sh ##\n     @@ ci/print-test-failures.sh: set -e\n      . ${0%/*}/lib-ci-type.sh\n      . ${0%/*}/lib-tput.sh\n      \n    -+exit_code=\n    ++github_workflow_markup=auto\n    ++case \"$CI_TYPE\" in\n    ++github-actions)\n    ++\tgithub_workflow_markup=t\n    ++\t;;\n    ++esac\n    ++\n     +while test $# != 0\n     +do\n     +\tcase \"$1\" in\n    -+\t--exit-code)\n    -+\t\texit_code=t\n    ++\t--github-workflow-markup)\n    ++\t\tgithub_workflow_markup=t\n    ++\t\t;;\n    ++\t--no-github-workflow-markup)\n    ++\t\tgithub_workflow_markup=\n     +\t\t;;\n     +\t*)\n     +\t\techo \"BUG: invalid $0 argument: $1\" >&2\n    @@ ci/print-test-failures.sh: set -e\n      \t\tTEST_NAME=\"${TEST_EXIT%.exit}\"\n      \t\tTEST_NAME=\"${TEST_NAME##*/}\"\n      \t\tTEST_OUT=\"${TEST_NAME}.out\"\n    -@@ ci/print-test-failures.sh: do\n    - \t\tesac\n    + \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n    + \n    +-\t\techo \"------------------------------------------------------------------------\"\n    +-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    +-\t\techo \"------------------------------------------------------------------------\"\n    +-\t\tcat \"t/test-results/${TEST_OUT}\"\n    ++\t\tdo_markup=\n    ++\t\tcase \"$github_workflow_markup\" in\n    ++\t\tt)\n    ++\t\t\tdo_markup=t\n    ++\t\t\t;;\n    ++\t\tauto)\n    ++\t\t\tif test -f \"t/test-results/$TEST_MARKUP\"\n    ++\t\t\tthen\n    ++\t\t\t\tdo_markup=t\n    ++\t\t\tfi\n    ++\t\t\t;;\n    ++\t\tesac\n    ++\n    ++\t\tif test -n \"$do_markup\"\n    ++\t\tthen\n    ++\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n    ++\t\t\tcat \"t/test-results/$TEST_MARKUP\"\n    ++\t\telse\n    ++\t\t\techo \"------------------------------------------------------------------------\"\n    ++\t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    ++\t\t\techo \"------------------------------------------------------------------------\"\n    ++\t\t\tcat \"t/test-results/${TEST_OUT}\"\n    ++\t\tfi\n    + \n    + \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n    + \t\tcase \"$CI_TYPE\" in\n    +@@ ci/print-test-failures.sh: then\n    + \tthen\n    + \t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n      \tfi\n    - done\n     +\n    -+if test -n \"$failed\"\n    -+then\n    -+\tif test -n \"$exit_code\"\n    -+\tthen\n    ++\tcase \"$github_workflow_markup\" in\n    ++\tt|auto)\n     +\t\texit 1\n    -+\tfi\n    -+fi\n    ++\t\t;;\n    ++\t'')\n    ++\t\texit 0\n    ++\t\t;;\n    ++\tesac\n    + fi\n -:  ----------- >  8:  9c9fd24fffa ci(github): skip the logs of the successful test cases\n -:  ----------- >  9:  03d7b54d68b ci(github): skip \"skip\" tests in --github-workflow-markup\n -:  ----------- > 10:  90a152d79f9 ci(github): avoid printing test case preamble twice\n 9:  877edff3b4d ! 11:  68eed85162b ci: use `--github-workflow-markup` in the GitHub workflow\n    @@ Metadata\n     Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n     \n      ## Commit message ##\n    -    ci: use `--github-workflow-markup` in the GitHub workflow\n    +    ci(github): mention where the full logs can be found\n     \n    -    [Ævar: due to re-structuring on top of my series the {begin,end}_group\n    -    in CI isn't needed at all to get \"group\" output for the test\n    -    suite. This commit includes the now-squashed \"ci/run-build-and-tests:\n    -    add some structure to the GitHub workflow output\":]\n    -\n    -    The current output of Git's GitHub workflow can be quite confusing,\n    -    especially for contributors new to the project.\n    -\n    -    To make it more helpful, let's introduce some collapsible grouping.\n    -    Initially, readers will see the high-level view of what actually\n    -    happened (did the build fail, or the test suite?). To drill down, the\n    -    respective group can be expanded.\n    -\n    -    Note: sadly, workflow output currently cannot contain any nested groups\n    -    (see https://github.com/actions/runner/issues/802 for details),\n    -    therefore we take pains to ensure to end any previous group before\n    -    starting a new one.\n    -\n    -    [Ævar: The above comment isn't true anymore, as that limitation has\n    -    been removed by basing this on my patches to run \"make\" and \"make\n    -    test\" directly from the top-level of main.yml.\n    -\n    -    Those are now effectively their own \"group\", effectively giving this\n    -    stage another group \"level\" to use. This means that the equivalent of\n    -    \"make test\" won't be on the same level as an individual test failure.\n    -\n    -    We no longer take any pains to ensure balanced group output as a\n    -    result (which was a caveat the previous ci/lib.sh implementation had\n    -    to deal with., We just need to \"cat\" the generated *.markup]\n    +    The full logs are contained in the `failed-tests-*.zip` artifacts that\n    +    are attached to the failed CI run. Since this is not immediately\n    +    obvious to the well-disposed reader, let's mention it explicitly.\n     \n    +    Suggested-by: Victoria Dye <vdye@github.com>\n         Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n    - ## ci/lib.sh ##\n    -@@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    - case \"$CI_TYPE\" in\n    - github-actions)\n    - \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n    --\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    -+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    - \ttest Windows != \"$RUNNER_OS\" ||\n    - \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    - \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n    -\n      ## ci/print-test-failures.sh ##\n     @@ ci/print-test-failures.sh: do\n    - \t\tif test -n \"$github_workflow_markup\"\n    + \t\tif test -n \"$do_markup\"\n      \t\tthen\n      \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n    -+\t\t\tcat \"t/test-results/$TEST_MARKUP\"\n    ++\t\t\techo \"The full logs are in the artifacts attached to this run.\"\n    + \t\t\tcat \"t/test-results/$TEST_MARKUP\"\n      \t\telse\n      \t\t\techo \"------------------------------------------------------------------------\"\n    - \t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    - \t\t\techo \"------------------------------------------------------------------------\"\n    -+\t\t\tcat \"t/test-results/${TEST_OUT}\"\n    - \t\tfi\n    --\t\tcat \"t/test-results/${TEST_OUT}\"\n    - \n    - \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n    - \t\tcase \"$CI_TYPE\" in\n10:  6b278194f9a = 12:  11dab84b0dc ci: call `finalize_test_case_output` a little later\n 5:  4291892fbd3 ! 13:  fbe0d99c6b3 ci: make it easier to find failed tests' logs in the GitHub workflow\n    @@\n      ## Metadata ##\n    -Author: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n    +Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## Commit message ##\n    -    ci: make it easier to find failed tests' logs in the GitHub workflow\n    -\n    -    When investigating a test failure, the time that matters most is the\n    -    time it takes from getting aware of the failure to displaying the output\n    -    of the failing test case.\n    -\n    -    You currently have to know a lot of implementation details when\n    -    investigating test failures in the CI runs. The first step is easy: the\n    -    failed job is marked quite clearly, but when opening it, the failed step\n    -    is expanded, which in our case is the one running\n    -    `ci/run-build-and-tests.sh`. This step, most notably, only offers a\n    -    high-level view of what went wrong: it prints the output of `prove`\n    -    which merely tells the reader which test script failed.\n    -\n    -    The actually interesting part is in the detailed log of said failed\n    -    test script. But that log is shown in the CI run's step that runs\n    -    `ci/print-test-failures.sh`. And that step is _not_ expanded in the web\n    -    UI by default. It is even marked as \"successful\", which makes it very\n    -    easy to miss that there is useful information hidden in there.\n    -\n    -    Let's help the reader by showing the failed tests' detailed logs in the\n    -    step that is expanded automatically, i.e. directly after the test suite\n    -    failed.\n    -\n    -    This also helps the situation where the _build_ failed and the\n    -    `print-test-failures` step was executed under the assumption that the\n    -    _test suite_ failed, and consequently failed to find any failed tests.\n    -\n    -    An alternative way to implement this patch would be to source\n    -    `ci/print-test-failures.sh` in the `handle_test_failures` function to\n    -    show these logs. However, over the course of the next few commits, we\n    -    want to introduce some grouping which would be harder to achieve that\n    -    way (for example, we do want a leaner, and colored, preamble for each\n    -    failed test script, and it would be trickier to accommodate the lack of\n    -    nested groupings in GitHub workflows' output).\n    -\n    -    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n    +    CI: make --github-workflow-markup ci-config, off by default\n    +\n    +    In preceding commits the --github-workflow-markup output was made the\n    +    default under GitHub CI.\n    +\n    +    There's a few outstanding issues with that new output target however:\n    +\n    +    A. As noted in [1] it's much slower in some common cases, i.e. the\n    +       page rendering time (under Firefox & Chrome debugging) goes from ~20s\n    +       to on the order of 60-80s (less pronounced when not debugging, but\n    +       still in that ballpark). See also [2] for tests on an earlier iteration\n    +       of the series.\n    +\n    +    B. Preceding commits in this series to omit non-failing test output\n    +       may have mitigated that somewhat, i.e. skipping \"ok\" and \"skip\" tests\n    +       in the *.markup files (although [1] is a benchmark with that \"ok\"\n    +       change).\n    +\n    +       Per [3] there are some CI users that prefer to see only the full\n    +       verbose output, i.e. we can't in the general case assume that we\n    +       can emit only the trace output for the failing test, and that's\n    +       going to give us the information we need to debug the test. It\n    +       might be failing because of earlier setup, or from trace output\n    +       outside of any test (i.e. in the main body of the file).\n    +\n    +       Users such as [3] could still just consult the *.out output, but\n    +       then we'd make them download the archive instead of viewing the\n    +       output in the web UX.\n    +\n    +    C. Per B above and [3] an earlier change in this series modified\n    +       the *.out output to change the *.out output inadvertently while trying\n    +       to modify the *.markup output. See the commit message of \"ci(github):\n    +       avoid printing test case preamble twice\" earlier in this series.\n    +\n    +    It thus make sense for now to make the \"ci/print-test-failures.sh\"\n    +    output be the \"raw\" one. I.e. the *.out output we'd get before\n    +    --github-workflow-markup was implemented.\n    +\n    +    To make it use ci/print-test-failures.sh we can create a\n    +    \"ci/config/print-test-failures-output-type\" script on the \"ci-config\"\n    +    branch that does e.g.:\n    +\n    +            #!/bin/sh\n    +            echo github\n    +\n    +    That script will (like the existing \"check-ref\") get the ref as an\n    +    argument, so we can in the future turn this on experimentally for\n    +    \"seen\", and flip the default in the future. The script can also emit\n    +    nothing to get whatever our idea is of the default (currently \"raw\").\n    +\n    +    Note the corresponding change to ci/print-test-failures.sh, i.e. we'll\n    +    do the right thing vis-a-vis what we \"zoom in\" to depending on the\n    +    setting. If it's \"raw\" we'd like a failed \"make test\" to \"zoom in\" to\n    +    that step, if it's \"github\" we'd like the to open the subsequent\n    +    \"ci/print-test-failures.sh\" step instead.\n    +\n    +    1. https://lore.kernel.org/git/220523.86ee0kzjix.gmgdl@evledraar.gmail.com/\n    +    2. https://lore.kernel.org/git/220222.86tucr6kz5.gmgdl@evledraar.gmail.com/\n    +    3. https://lore.kernel.org/git/20210309175249.GE3590451@szeder.dev/\n    +\n         Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n     \n      ## .github/workflows/main.yml ##\n     @@ .github/workflows/main.yml: jobs:\n    +     runs-on: ubuntu-latest\n    +     outputs:\n    +       enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}\n    ++      print-test-failures-output-type: ${{ steps.print-test-failures-output-type.outputs.type }}\n    +     steps:\n    +       - name: try to clone ci-config branch\n    +         run: |\n    +@@ .github/workflows/main.yml: jobs:\n    +             config-repo &&\n    +           cd config-repo &&\n    +           git checkout HEAD -- ci/config || : ignore\n    ++      - id: print-test-failures-output-type\n    ++        name: check what output type ci/print-test-failures.sh uses\n    ++        run: |\n    ++          type_default=raw\n    ++          type=$type_default\n    ++\n    ++          if test -x config-repo/ci/config/print-test-failures-output-type\n    ++          then\n    ++            type=$(config-repo/ci/config/print-test-failures-output-type '${{ github.ref }}')\n    ++            if test -z \"$type\"\n    ++            then\n    ++              type=$type_default\n    ++            fi\n    ++          fi\n    ++          echo \"::set-output name=type::$type\"\n    +       - id: check-ref\n    +         name: check whether CI is enabled for ref\n    +         run: |\n    +@@ .github/workflows/main.yml: jobs:\n    +     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n    +     - run: ci/lib.sh --test\n            shell: bash\n    -     - name: test\n    ++      env:\n    ++        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n    +     - name: select tests\n    +       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n            shell: bash\n    --      run: . /etc/profile && make -C t -e\n    --    - name: ci/print-test-failures.sh\n    --      if: failure()\n    --      shell: bash\n    --      run: ci/print-test-failures.sh\n    -+      run: . /etc/profile && make -C t -e || ci/print-test-failures.sh\n    -     - name: Upload failed tests' directories\n    -       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n    -       uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n    +       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n    +     - run: ci/lib.sh --test\n            shell: bash\n    -     - name: test\n    ++      env:\n    ++        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n    +     - name: select tests\n    +       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n            shell: bash\n    --      run: . /etc/profile && make -C t -e\n    --    - name: ci/print-test-failures.sh\n    --      if: failure()\n    --      shell: bash\n    --      run: ci/print-test-failures.sh\n    -+      run: . /etc/profile && make -C t -e || ci/print-test-failures-github.sh\n    -     - name: Upload failed tests' directories\n    -       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n    -       uses: actions/upload-artifact@v2\n     @@ .github/workflows/main.yml: jobs:\n          - run: ci/lib.sh --build\n          - run: make\n          - run: ci/lib.sh --test\n    --    - run: make test\n    -+    - run: make test || ci/print-test-failures-github.sh\n    ++      env:\n    ++        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n    +     - run: make test\n            if: success()\n    --    - run: ci/print-test-failures.sh\n    --      if: failure()\n    -     - name: Upload failed tests' directories\n    -       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n    -       uses: actions/upload-artifact@v2\n    +     - run: ci/print-test-failures.sh\n     @@ .github/workflows/main.yml: jobs:\n          - run: make\n          - run: ci/lib.sh --test\n            if: success() && matrix.vector.skip-tests != 'yes'\n    --    - run: make test\n    -+    - run: make test || ci/print-test-failures-github.sh\n    ++      env:\n    ++        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n    +     - run: make test\n            if: success() && matrix.vector.skip-tests != 'yes'\n    --    - run: ci/print-test-failures.sh\n    --      if: failure() && matrix.vector.skip-tests != 'yes'\n    -     - name: Upload failed tests' directories\n    -       if: failure() && env.FAILED_TEST_ARTIFACTS != ''\n    -       uses: actions/upload-artifact@v1\n    +     - run: ci/print-test-failures.sh\n    +\n    + ## ci/lib.sh ##\n    +@@ ci/lib.sh: if test -n \"$GITHUB_ENV\"\n    + then\n    + \techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n    + fi\n    ++echo \"CONFIG: GIT_CI_PTF_OUTPUT_TYPE=$GIT_CI_PTF_OUTPUT_TYPE\" >&2\n    + echo >&2\n    + \n    + # Helper functions\n    +@@ ci/lib.sh: MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n    + case \"$CI_TYPE\" in\n    + github-actions)\n    + \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n    +-\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n    ++\tGIT_TEST_OPTS=\"--verbose-log -x\"\n    ++\tif test -n \"$GIT_CI_PTF_OUTPUT_TYPE\"\n    ++\tthen\n    ++\t\t# For later use in ci/print-test-failures.sh\n    ++\t\tsetenv --test GIT_CI_PTF_OUTPUT_TYPE \"$GIT_CI_PTF_OUTPUT_TYPE\"\n    ++\n    ++\t\tcase \"$GIT_CI_PTF_OUTPUT_TYPE\" in\n    ++\t\tgithub)\n    ++\t\t\tGIT_TEST_OPTS=\"$GIT_TEST_OPTS --github-workflow-markup\"\n    ++\t\t\t;;\n    ++\t\tesac\n    ++\tfi\n    + \ttest Windows != \"$RUNNER_OS\" ||\n    + \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n    + \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\n     \n      ## ci/print-test-failures.sh ##\n     @@ ci/print-test-failures.sh: set -e\n    - . ${0%/*}/lib-ci-type.sh\n      . ${0%/*}/lib-tput.sh\n      \n    --exit_code=\n    -+case \"$CI_TYPE\" in\n    -+github-actions)\n    -+\texit_code=t\n    -+\tgithub_workflow_markup=t\n    -+\t;;\n    -+*)\n    -+\texit_code=\n    + github_workflow_markup=auto\n    +-case \"$CI_TYPE\" in\n    +-github-actions)\n    ++case \"$GIT_CI_PTF_OUTPUT_TYPE\" in\n    ++github)\n    + \tgithub_workflow_markup=t\n    + \t;;\n    ++raw)\n     +\tgithub_workflow_markup=\n     +\t;;\n    -+esac\n    -+\n    - while test $# != 0\n    - do\n    - \tcase \"$1\" in\n    - \t--exit-code)\n    - \t\texit_code=t\n    - \t\t;;\n    -+\t--no-exit-code)\n    -+\t\texit_code=\n    -+\t\t;;\n    -+\t--github-workflow-markup)\n    -+\t\tgithub_workflow_markup=t\n    -+\t\t;;\n    -+\t--no-github-workflow-markup)\n    -+\t\tgithub_workflow_markup=\n    -+\t\t;;\n    - \t*)\n    - \t\techo \"BUG: invalid $0 argument: $1\" >&2\n    - \t\texit 1\n    -@@ ci/print-test-failures.sh: do\n    - \t\tTEST_OUT=\"${TEST_NAME}.out\"\n    - \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n    - \n    --\t\techo \"------------------------------------------------------------------------\"\n    --\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    --\t\techo \"------------------------------------------------------------------------\"\n    -+\t\tif test -n \"$github_workflow_markup\"\n    -+\t\tthen\n    -+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n    -+\t\telse\n    -+\t\t\techo \"------------------------------------------------------------------------\"\n    -+\t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n    -+\t\t\techo \"------------------------------------------------------------------------\"\n    -+\t\tfi\n    - \t\tcat \"t/test-results/${TEST_OUT}\"\n    + esac\n      \n    - \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n    + while test $# != 0\n -:  ----------- > 14:  0b02b186c87 CI: make the --github-workflow-markup \"github\" output the default\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456047","messageId":"patch-v6-03.14-fdc5b534644-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 03/14] CI: stop setting FAILED_TEST_ARTIFACTS N times","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:52Z","receivedAt":"2022-05-25T11:26:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The FAILED_TEST_ARTIFACTS variable introduced in f72f328bc57 (ci: let\nGitHub Actions upload failed tests' directories, 2020-04-11) is only\nused once in the main.yml, there is no need to set it N times if we\nhave N failing tests.\n\nSee also 92bf1b60673 (ci: avoid `set-env` construct in\nprint-test-failures.sh, 2020-11-17) which moved it to using\n$GITHUB_ENV, we'll now check if it's set like ci/lib.sh, this makes it\neasier to test this script locally.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 9 ++++++++-\n 1 file changed, 8 insertions(+), 1 deletion(-)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 1249bb0c0cf..8d4d2225371 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -32,7 +32,6 @@ do\n \t\tcase \"$CI_TYPE\" in\n \t\tgithub-actions)\n \t\t\tmkdir -p t/failed-test-artifacts\n-\t\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \t\t\tcp \"t/test-results/${TEST_OUT}\" t/failed-test-artifacts/\n \t\t\t(\n \t\t\t\tcd t &&\n@@ -42,3 +41,11 @@ do\n \t\tesac\n \tfi\n done\n+\n+if test -n \"$failed\"\n+then\n+\tif test -n \"$GITHUB_ENV\"\n+\tthen\n+\t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n+\tfi\n+fi\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456048","messageId":"patch-v6-04.14-a75846a12f2-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 04/14] tests: refactor --write-junit-xml code","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:53Z","receivedAt":"2022-05-25T11:26:38Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe code writing JUnit XML is interspersed directly with all the code in\n`t/test-lib.sh`, and it is therefore not only ill-separated, but\nintroducing yet another output format would make the situation even\nworse.\n\nLet's introduce an abstraction layer by hiding the JUnit XML code behind\nfour new functions that are supposed to be called before and after each\ntest and test case.\n\nThis is not just an academic exercise, refactoring for refactoring's\nsake. We _actually_ want to introduce such a new output format, to\nmake it substantially easier to diagnose test failures in our GitHub\nworkflow, therefore we do need this refactoring.\n\nThis commit is best viewed with `git show --color-moved\n--color-moved-ws=allow-indentation-change <commit>`.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++\n t/test-lib.sh       | 124 ++++++-------------------------------------\n 2 files changed, 142 insertions(+), 108 deletions(-)\n create mode 100644 t/test-lib-junit.sh\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nnew file mode 100644\nindex 00000000000..9d55d74d764\n--- /dev/null\n+++ b/t/test-lib-junit.sh\n@@ -0,0 +1,126 @@\n+# Library of functions to format test scripts' output in JUnit XML\n+# format, to support Git's test suite result to be presented in an\n+# easily digestible way on Azure Pipelines.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when the user asks\n+# for JUnit XML; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n+\tmkdir -p \"$junit_xml_dir\"\n+\tjunit_xml_base=${1##*/}\n+\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n+\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n+\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n+\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n+\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n+\tjunit_suite_start=$(test-tool date getnanos)\n+\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\tthen\n+\t\tGIT_TEST_TEE_OFFSET=0\n+\tfi\n+}\n+\n+start_test_case_output () {\n+\tjunit_start=$(test-tool date getnanos)\n+}\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tok)\n+\t\tset \"$*\"\n+\t\t;;\n+\tfailure)\n+\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n+\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\t\t   then\n+\t\t\t\ttest-tool path-utils skip-n-bytes \\\n+\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\t\t\t   else\n+\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n+\t\t\t   fi)\")\"\n+\t\tjunit_insert=\"$junit_insert</failure>\"\n+\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n+\t\tthen\n+\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n+\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n+\t\tfi\n+\t\tset \"$1\" \"      $junit_insert\"\n+\t\t;;\n+\tfixed)\n+\t\tset \"$* (breakage fixed)\"\n+\t\t;;\n+\tbroken)\n+\t\tset \"$* (known breakage)\"\n+\t\t;;\n+\tskip)\n+\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n+\t\t;;\n+\tesac\n+\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tshift\n+\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n+\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n+\t\tdate getnanos $junit_start)\\\"\"\n+\twrite_junit_xml \"$(printf '%s\\n' \\\n+\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n+\tjunit_have_testcase=t\n+}\n+\n+finalize_test_output () {\n+\tif test -n \"$junit_xml_path\"\n+\tthen\n+\t\ttest -n \"$junit_have_testcase\" || {\n+\t\t\tjunit_start=$(test-tool date getnanos)\n+\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n+\t\t}\n+\n+\t\t# adjust the overall time\n+\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n+\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n+\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n+\t\t\t-e '/^ *<\\/testsuite/d' \\\n+\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n+\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n+\n+\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n+\t\twrite_junit_xml=\n+\tfi\n+}\n+\n+write_junit_xml () {\n+\tcase \"$1\" in\n+\t--truncate)\n+\t\t>\"$junit_xml_path\"\n+\t\tjunit_have_testcase=\n+\t\tshift\n+\t\t;;\n+\tesac\n+\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n+}\n+\n+xml_attr_encode () {\n+\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+}\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 8ba5ca15345..27e17c569d4 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -137,6 +137,12 @@ mark_option_requires_arg () {\n \tstore_arg_to=$2\n }\n \n+# These functions can be overridden e.g. to output JUnit XML\n+start_test_output () { :; }\n+start_test_case_output () { :; }\n+finalize_test_case_output () { :; }\n+finalize_test_output () { :; }\n+\n parse_option () {\n \tlocal opt=\"$1\"\n \n@@ -196,7 +202,7 @@ parse_option () {\n \t\ttee=t\n \t\t;;\n \t--write-junit-xml)\n-\t\twrite_junit_xml=t\n+\t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n \t--stress)\n \t\tstress=t ;;\n@@ -664,7 +670,7 @@ exec 6<&0\n exec 7>&2\n \n _error_exit () {\n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \tGIT_EXIT_OK=t\n \texit 1\n }\n@@ -774,35 +780,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$*\"\n-\tfi\n+\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n }\n \n test_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n-\t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\t\t   then\n-\t\t\t\ttest-tool path-utils skip-n-bytes \\\n-\t\t\t\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n-\t\t\t   else\n-\t\t\t\tprintf '%s\\n' \"$@\" | sed 1d\n-\t\t\t   fi)\")\"\n-\t\tjunit_insert=\"$junit_insert</failure>\"\n-\t\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\t\tthen\n-\t\t\tjunit_insert=\"$junit_insert<system-err>$(xml_attr_encode \\\n-\t\t\t\t\"$(cat \"$GIT_TEST_TEE_OUTPUT_FILE\")\")</system-err>\"\n-\t\tfi\n-\t\twrite_junit_xml_testcase \"$1\" \"      $junit_insert\"\n-\tfi\n+\tfinalize_test_case_output failure \"$@\"\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -815,19 +799,13 @@ test_failure_ () {\n }\n \n test_known_broken_ok_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (breakage fixed)\"\n-\tfi\n+\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n }\n \n test_known_broken_failure_ () {\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\twrite_junit_xml_testcase \"$* (known breakage)\"\n-\tfi\n+\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n }\n@@ -1104,10 +1082,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tif test -n \"$write_junit_xml\"\n-\tthen\n-\t\tjunit_start=$(test-tool date getnanos)\n-\tfi\n+\tstart_test_case_output\n }\n \n test_finish_ () {\n@@ -1158,12 +1133,7 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tif test -n \"$write_junit_xml\"\n-\t\tthen\n-\t\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n-\t\t\twrite_junit_xml_testcase \"$1\" \\\n-\t\t\t\t\"      <skipped message=\\\"$message\\\" />\"\n-\t\tfi\n+\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n@@ -1179,53 +1149,6 @@ test_at_end_hook_ () {\n \t:\n }\n \n-write_junit_xml () {\n-\tcase \"$1\" in\n-\t--truncate)\n-\t\t>\"$junit_xml_path\"\n-\t\tjunit_have_testcase=\n-\t\tshift\n-\t\t;;\n-\tesac\n-\tprintf '%s\\n' \"$@\" >>\"$junit_xml_path\"\n-}\n-\n-xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n-}\n-\n-write_junit_xml_testcase () {\n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n-\tshift\n-\tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n-\tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n-\t\tdate getnanos $junit_start)\\\"\"\n-\twrite_junit_xml \"$(printf '%s\\n' \\\n-\t\t\"    <testcase $junit_attrs>\" \"$@\" \"    </testcase>\")\"\n-\tjunit_have_testcase=t\n-}\n-\n-finalize_junit_xml () {\n-\tif test -n \"$write_junit_xml\" && test -n \"$junit_xml_path\"\n-\tthen\n-\t\ttest -n \"$junit_have_testcase\" || {\n-\t\t\tjunit_start=$(test-tool date getnanos)\n-\t\t\twrite_junit_xml_testcase \"all tests skipped\"\n-\t\t}\n-\n-\t\t# adjust the overall time\n-\t\tjunit_time=$(test-tool date getnanos $junit_suite_start)\n-\t\tsed -e \"s/\\(<testsuite.*\\) time=\\\"[^\\\"]*\\\"/\\1/\" \\\n-\t\t\t-e \"s/<testsuite [^>]*/& time=\\\"$junit_time\\\"/\" \\\n-\t\t\t-e '/^ *<\\/testsuite/d' \\\n-\t\t\t<\"$junit_xml_path\" >\"$junit_xml_path.new\"\n-\t\tmv \"$junit_xml_path.new\" \"$junit_xml_path\"\n-\n-\t\twrite_junit_xml \"  </testsuite>\" \"</testsuites>\"\n-\t\twrite_junit_xml=\n-\tfi\n-}\n-\n test_atexit_cleanup=:\n test_atexit_handler () {\n \t# In a succeeding test script 'test_atexit_handler' is invoked\n@@ -1248,7 +1171,7 @@ test_done () {\n \t# removed, so the commands can access pidfiles and socket files.\n \ttest_atexit_handler\n \n-\tfinalize_junit_xml\n+\tfinalize_test_output\n \n \tif test -z \"$HARNESS_ACTIVE\"\n \tthen\n@@ -1539,22 +1462,7 @@ fi\n # in subprocesses like git equals our $PWD (for pathname comparisons).\n cd -P \"$TRASH_DIRECTORY\" || exit 1\n \n-if test -n \"$write_junit_xml\"\n-then\n-\tjunit_xml_dir=\"$TEST_OUTPUT_DIRECTORY/out\"\n-\tmkdir -p \"$junit_xml_dir\"\n-\tjunit_xml_base=${0##*/}\n-\tjunit_xml_path=\"$junit_xml_dir/TEST-${junit_xml_base%.sh}.xml\"\n-\tjunit_attrs=\"name=\\\"${junit_xml_base%.sh}\\\"\"\n-\tjunit_attrs=\"$junit_attrs timestamp=\\\"$(TZ=UTC \\\n-\t\tdate +%Y-%m-%dT%H:%M:%S)\\\"\"\n-\twrite_junit_xml --truncate \"<testsuites>\" \"  <testsuite $junit_attrs>\"\n-\tjunit_suite_start=$(test-tool date getnanos)\n-\tif test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n-\tthen\n-\t\tGIT_TEST_TEE_OFFSET=0\n-\tfi\n-fi\n+start_test_output \"$0\"\n \n # Convenience\n # A regexp to match 5 and 35 hexdigits\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456049","messageId":"patch-v6-05.14-5b709dde86a-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 05/14] test(junit): avoid line feeds in XML attributes","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:54Z","receivedAt":"2022-05-25T11:26:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn the test case's output, we do want newline characters, but in the XML\nattributes we do not want them.\n\nHowever, the `xml_attr_encode` function always adds a Line Feed at the\nend (which are then encoded as `&#x0a;`, even for XML attributes.\n\nThis seems not to faze Azure Pipelines' XML parser, but it still is\nincorrect, so let's fix it.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-junit.sh | 14 ++++++++++----\n 1 file changed, 10 insertions(+), 4 deletions(-)\n\ndiff --git a/t/test-lib-junit.sh b/t/test-lib-junit.sh\nindex 9d55d74d764..c959183c7e2 100644\n--- a/t/test-lib-junit.sh\n+++ b/t/test-lib-junit.sh\n@@ -50,7 +50,7 @@ finalize_test_case_output () {\n \t\t;;\n \tfailure)\n \t\tjunit_insert=\"<failure message=\\\"not ok $test_count -\"\n-\t\tjunit_insert=\"$junit_insert $(xml_attr_encode \"$1\")\\\">\"\n+\t\tjunit_insert=\"$junit_insert $(xml_attr_encode --no-lf \"$1\")\\\">\"\n \t\tjunit_insert=\"$junit_insert $(xml_attr_encode \\\n \t\t\t\"$(if test -n \"$GIT_TEST_TEE_OUTPUT_FILE\"\n \t\t\t   then\n@@ -74,12 +74,12 @@ finalize_test_case_output () {\n \t\tset \"$* (known breakage)\"\n \t\t;;\n \tskip)\n-\t\tmessage=\"$(xml_attr_encode \"$skipped_reason\")\"\n+\t\tmessage=\"$(xml_attr_encode --no-lf \"$skipped_reason\")\"\n \t\tset \"$1\" \"      <skipped message=\\\"$message\\\" />\"\n \t\t;;\n \tesac\n \n-\tjunit_attrs=\"name=\\\"$(xml_attr_encode \"$this_test.$test_count $1\")\\\"\"\n+\tjunit_attrs=\"name=\\\"$(xml_attr_encode --no-lf \"$this_test.$test_count $1\")\\\"\"\n \tshift\n \tjunit_attrs=\"$junit_attrs classname=\\\"$this_test\\\"\"\n \tjunit_attrs=\"$junit_attrs time=\\\"$(test-tool \\\n@@ -122,5 +122,11 @@ write_junit_xml () {\n }\n \n xml_attr_encode () {\n-\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tif test \"x$1\" = \"x--no-lf\"\n+\tthen\n+\t\tshift\n+\t\tprintf '%s' \"$*\" | test-tool xml-encode\n+\telse\n+\t\tprintf '%s\\n' \"$@\" | test-tool xml-encode\n+\tfi\n }\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456050","messageId":"patch-v6-06.14-f5b39f1660d-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 06/14] ci: optionally mark up output in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:55Z","receivedAt":"2022-05-25T11:26:44Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nA couple of commands exist to spruce up the output in GitHub workflows:\nhttps://docs.github.com/en/actions/learn-github-actions/workflow-commands-for-github-actions\n\nIn addition to the `::group::<label>`/`::endgroup::` commands (which we\nalready use to structure the output of the build step better), we also\nuse `::error::`/`::notice::` to draw the attention to test failures and\nto test cases that were expected to fail but didn't.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh              |  4 +--\n t/test-lib-github-workflow-markup.sh | 50 ++++++++++++++++++++++++++++\n t/test-lib.sh                        |  5 ++-\n 3 files changed, 56 insertions(+), 3 deletions(-)\n create mode 100644 t/test-lib-github-workflow-markup.sh\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex 93c03380d44..af4831a54c6 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -795,7 +795,7 @@ test_verify_prereq () {\n }\n \n test_expect_failure () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-failure\"\n@@ -815,7 +815,7 @@ test_expect_failure () {\n }\n \n test_expect_success () {\n-\ttest_start_\n+\ttest_start_ \"$@\"\n \ttest \"$#\" = 3 && { test_prereq=$1; shift; } || test_prereq=\n \ttest \"$#\" = 2 ||\n \tBUG \"not 2 or 3 parameters to test-expect-success\"\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nnew file mode 100644\nindex 00000000000..d8dc969df4a\n--- /dev/null\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -0,0 +1,50 @@\n+# Library of functions to mark up test scripts' output suitable for\n+# pretty-printing it in GitHub workflows.\n+#\n+# Copyright (c) 2022 Johannes Schindelin\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 2 of the License, or\n+# (at your option) any later version.\n+#\n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+#\n+# You should have received a copy of the GNU General Public License\n+# along with this program.  If not, see http://www.gnu.org/licenses/ .\n+#\n+# The idea is for `test-lib.sh` to source this file when run in GitHub\n+# workflows; these functions will then override (empty) functions\n+# that are are called at the appropriate times during the test runs.\n+\n+start_test_output () {\n+\ttest -n \"$GIT_TEST_TEE_OUTPUT_FILE\" ||\n+\tdie \"--github-workflow-markup requires --verbose-log\"\n+\tgithub_markup_output=\"${GIT_TEST_TEE_OUTPUT_FILE%.out}.markup\"\n+\t>$github_markup_output\n+\tGIT_TEST_TEE_OFFSET=0\n+}\n+\n+# No need to override start_test_case_output\n+\n+finalize_test_case_output () {\n+\ttest_case_result=$1\n+\tshift\n+\tcase \"$test_case_result\" in\n+\tfailure)\n+\t\techo >>$github_markup_output \"::error::failed: $this_test.$test_count $1\"\n+\t\t;;\n+\tfixed)\n+\t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n+\t\t;;\n+\tesac\n+\techo >>$github_markup_output \"::group::$test_case_result: $this_test.$test_count $*\"\n+\ttest-tool >>$github_markup_output path-utils skip-n-bytes \\\n+\t\t\"$GIT_TEST_TEE_OUTPUT_FILE\" $GIT_TEST_TEE_OFFSET\n+\techo >>$github_markup_output \"::endgroup::\"\n+}\n+\n+# No need to override finalize_test_output\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 27e17c569d4..0a7e067ebdb 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -204,6 +204,9 @@ parse_option () {\n \t--write-junit-xml)\n \t\t. \"$TEST_DIRECTORY/test-lib-junit.sh\"\n \t\t;;\n+\t--github-workflow-markup)\n+\t\t. \"$TEST_DIRECTORY/test-lib-github-workflow-markup.sh\"\n+\t\t;;\n \t--stress)\n \t\tstress=t ;;\n \t--stress=*)\n@@ -1082,7 +1085,7 @@ test_start_ () {\n \ttest_count=$(($test_count+1))\n \tmaybe_setup_verbose\n \tmaybe_setup_valgrind\n-\tstart_test_case_output\n+\tstart_test_case_output \"$@\"\n }\n \n test_finish_ () {\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456051","messageId":"patch-v6-07.14-e713ca6041b-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 07/14] ci: make it easier to find failed tests' logs in the GitHub workflow","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:56Z","receivedAt":"2022-05-25T11:26:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"When investigating a test failure, the time that matters most is the\ntime it takes from getting aware of the failure to displaying the output\nof the failing test case.\n\nYou currently have to know a lot of implementation details when\ninvestigating test failures in the CI runs. The first step is easy: the\nfailed job is marked quite clearly, but when opening it, the failed step\nis expanded, which in our case is the one running\n`make` or 'make test`. When failing in the latter we only show a\nhigh-level view of what went wrong: it prints the output of `prove`\nwhich merely tells the reader which test script failed, along with the failed\ntest numbers.\n\nTo diagnose those failures in detail the user has then had to know\nthat they should expand the subsequent \"Run ci/print-test-failures.sh\"\nstep. Because that step always exits successfully it's not expanded by\ndefault (the GitHub CI only expands the last failing step), making it\neasy to miss that there is useful information hidden in there.\n\nThis change does a couple of things to improve the situation:\n\n * We now make use of the \"exit code\" feature of\n   ci/print-test-failures.sh added in a preceding commit, thus if \"make\n   test\" fails we'll pick up that we have failing tests, and fail in\n   ci/print-test-failures.sh too.\n\n   Note that we still exit successfully from ci/print-test-failures.sh\n   if we don't have logs of any failed tests in t/test-results. Thus\n   if we fail in \"make\" (i.e. when building), or even in \"make test\"\n   in a way that doesn't yield a failed test (e.g. the t/Makefile\n   itself failing) we'll correctly \"zoom in\" on the (hopefully\n   failing) \"make test\" instead.\n\n   As before if there was no previously failed step the\n   ci/print-test-failures.sh step is skipped entirely (see\n   .github/workflows/main.yml)\n\n   To make the script DWYM the ci/print-test-failures.sh defaults to\n   an \"auto\" mode. Thus since we turn on --github-workflow-markup in\n   ci/lib.sh we'll write *.markup files, and will pick up on that in\n   ci/print-test-failures.sh.\n\n   The \"$github_workflow_markup\" being \"auto\" (or \"t\") on failure is\n   also what makes us exit non-zero. We could also add\n   --[no-]exit-code arguments, but at this point we only need this for\n   the \"*.markup\" mode, so let's leave that for now.\n\n   By having this be \"auto\" well pick up on whatever the GIT_TEST_OPTS\n   setting is, which as we'll see in a subsequent commit will be\n   useful if we'd like to configure the CI to emit it only some of the\n   time.\n\n * The ci/print-test-failures.sh now makes use of the GitHub markdown\n   introduced for t/test-lib.sh in the preceding commit. I.e. in GitHub\n   CI we'll now run with --github-workflow-markup in GIT_TEST_OPTS,\n   which causes our \"--verbose\" output in\n   \"t/test-results/$TEST_OUT.markup\" to be in the GitHub CI-specific\n   Markdown format.\n\nThe new output is easier to read since it makes use of collapsible grouping.\nInitially, readers will see the high-level view of what actually happened.\nTo drill down, the \"group\" for the specific failing test(s) can be expanded.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/lib.sh                 |  2 +-\n ci/print-test-failures.sh | 62 ++++++++++++++++++++++++++++++++++++---\n 2 files changed, 59 insertions(+), 5 deletions(-)\n\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 80e89f89b7f..422399b1305 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -189,7 +189,7 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n case \"$CI_TYPE\" in\n github-actions)\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n-\tGIT_TEST_OPTS=\"--verbose-log -x\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 8d4d2225371..f45e36bdefc 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -8,25 +8,70 @@ set -e\n . ${0%/*}/lib-ci-type.sh\n . ${0%/*}/lib-tput.sh\n \n+github_workflow_markup=auto\n+case \"$CI_TYPE\" in\n+github-actions)\n+\tgithub_workflow_markup=t\n+\t;;\n+esac\n+\n+while test $# != 0\n+do\n+\tcase \"$1\" in\n+\t--github-workflow-markup)\n+\t\tgithub_workflow_markup=t\n+\t\t;;\n+\t--no-github-workflow-markup)\n+\t\tgithub_workflow_markup=\n+\t\t;;\n+\t*)\n+\t\techo \"BUG: invalid $0 argument: $1\" >&2\n+\t\texit 1\n+\t\t;;\n+\tesac\n+\tshift\n+done\n+\n if ! ls t/test-results/*.exit >/dev/null 2>/dev/null\n then\n \techo \"Build job failed before the tests could have been run\"\n \texit\n fi\n \n+failed=\n for TEST_EXIT in t/test-results/*.exit\n do\n \tif [ \"$(cat \"$TEST_EXIT\")\" != \"0\" ]\n \tthen\n+\t\tfailed=t\n \t\tTEST_NAME=\"${TEST_EXIT%.exit}\"\n \t\tTEST_NAME=\"${TEST_NAME##*/}\"\n \t\tTEST_OUT=\"${TEST_NAME}.out\"\n \t\tTEST_MARKUP=\"${TEST_NAME}.markup\"\n \n-\t\techo \"------------------------------------------------------------------------\"\n-\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n-\t\techo \"------------------------------------------------------------------------\"\n-\t\tcat \"t/test-results/${TEST_OUT}\"\n+\t\tdo_markup=\n+\t\tcase \"$github_workflow_markup\" in\n+\t\tt)\n+\t\t\tdo_markup=t\n+\t\t\t;;\n+\t\tauto)\n+\t\t\tif test -f \"t/test-results/$TEST_MARKUP\"\n+\t\t\tthen\n+\t\t\t\tdo_markup=t\n+\t\t\tfi\n+\t\t\t;;\n+\t\tesac\n+\n+\t\tif test -n \"$do_markup\"\n+\t\tthen\n+\t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n+\t\t\tcat \"t/test-results/$TEST_MARKUP\"\n+\t\telse\n+\t\t\techo \"------------------------------------------------------------------------\"\n+\t\t\techo \"$(tput setaf 1)${TEST_OUT}...$(tput sgr0)\"\n+\t\t\techo \"------------------------------------------------------------------------\"\n+\t\t\tcat \"t/test-results/${TEST_OUT}\"\n+\t\tfi\n \n \t\ttrash_dir=\"trash directory.$TEST_NAME\"\n \t\tcase \"$CI_TYPE\" in\n@@ -48,4 +93,13 @@ then\n \tthen\n \t\techo \"FAILED_TEST_ARTIFACTS=t/failed-test-artifacts\" >>$GITHUB_ENV\n \tfi\n+\n+\tcase \"$github_workflow_markup\" in\n+\tt|auto)\n+\t\texit 1\n+\t\t;;\n+\t'')\n+\t\texit 0\n+\t\t;;\n+\tesac\n fi\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456052","messageId":"patch-v6-08.14-9c9fd24fffa-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 08/14] ci(github): skip the logs of the successful test cases","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:57Z","receivedAt":"2022-05-25T11:27:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn most instances, looking at the log of failed test cases is enough to\nidentify the problem.\n\nIn some (rare?) instances, a previous test case that was marked as\nsuccessful actually has information pertaining to a later test case that\nfails.\n\nIn some (rare?) instances, a previous test case that was marked as\nsuccessful actually has information pertaining to a later test case that\nfails.\n\nTo allow the page to load relatively quickly, let's only show the logs\nof the failed test cases to be shown. The full logs are available for\ndownload as artifacts, should a deeper investigation become necessary.\n\nCo-authored-by: Victoria Dye <vdye@github.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-github-workflow-markup.sh | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nindex d8dc969df4a..1ef0fd5ba87 100644\n--- a/t/test-lib-github-workflow-markup.sh\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -40,6 +40,10 @@ finalize_test_case_output () {\n \tfixed)\n \t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n \t\t;;\n+\tok)\n+\t\t# Exit without printing the \"ok\" tests\n+\t\treturn\n+\t\t;;\n \tesac\n \techo >>$github_markup_output \"::group::$test_case_result: $this_test.$test_count $*\"\n \ttest-tool >>$github_markup_output path-utils skip-n-bytes \\\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456053","messageId":"patch-v6-09.14-03d7b54d68b-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 09/14] ci(github): skip \"skip\" tests in --github-workflow-markup","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:58Z","receivedAt":"2022-05-25T11:27:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As in the preceding commit's change to \"ok\" tests omit the \"skip\"\ntests in the --github-workflow-markup. Before this we'd emit this for\ne.g. t0026-eol-config.sh:\n\n\t$ rm -rf test-results; ./t0026-eol-config.sh --verbose-log -x --github-workflow-markup; echo; cat test-results/*markup\n\tok 1 - setup\n\tok 2 - eol=lf puts LFs in normalized file\n\tok 3 - eol=crlf puts CRLFs in normalized file\n\tok 4 - autocrlf=true overrides eol=lf\n\tok 5 - autocrlf=true overrides unset eol\n\tok 6 # skip eol native is crlf (missing NATIVE_CRLF)\n\t# passed all 6 test(s)\n\t1..6\n\n\t::group::skip: t0026.6 eol native is crlf\n\n\t        rm -rf native_eol && mkdir native_eol &&\n\t        (\n\t                cd native_eol &&\n\t                printf \"*.txt text\n\t\" >.gitattributes &&\n\t                printf \"one\n\ttwo\n\tthree\n\t\" >filedos.txt &&\n\t                printf \"one\n\ttwo\n\tthree\n\t\" >fileunix.txt &&\n\t                git init &&\n\t                git config core.autocrlf false &&\n\t                git config core.eol native &&\n\t                git add filedos.txt fileunix.txt &&\n\t                git commit -m \"first\" &&\n\t                rm file*.txt &&\n\t                git reset --hard HEAD &&\n\t                has_cr filedos.txt &&\n\t                has_cr fileunix.txt\n\t        )\n\n\t::endgroup::\n\nNow we'll instead emit this, i.e. an empty *.markup file:\n\n\t$ rm -rf test-results; ./t0026-eol-config.sh --verbose-log -x --github-workflow-markup; echo; cat test-results/*markup\n\tok 1 - setup\n\tok 2 - eol=lf puts LFs in normalized file\n\tok 3 - eol=crlf puts CRLFs in normalized file\n\tok 4 - autocrlf=true overrides eol=lf\n\tok 5 - autocrlf=true overrides unset eol\n\tok 6 # skip eol native is crlf (missing NATIVE_CRLF)\n\t# passed all 6 test(s)\n\t1..6\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-github-workflow-markup.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nindex 1ef0fd5ba87..bad3ebafdb7 100644\n--- a/t/test-lib-github-workflow-markup.sh\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -40,8 +40,8 @@ finalize_test_case_output () {\n \tfixed)\n \t\techo >>$github_markup_output \"::notice::fixed: $this_test.$test_count $1\"\n \t\t;;\n-\tok)\n-\t\t# Exit without printing the \"ok\" tests\n+\tok|skip)\n+\t\t# Exit without printing the \"ok\" or \"skip\" tests\n \t\treturn\n \t\t;;\n \tesac\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456054","messageId":"patch-v6-10.14-90a152d79f9-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 10/14] ci(github): avoid printing test case preamble twice","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:25:59Z","receivedAt":"2022-05-25T11:27:16Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Victoria Dye <vdye@github.com>\n\nWe want to mark up the test case preamble when presenting test output in\nGit's GitHub workflow. Let's suppress the non-marked-up version in that\ncase. Any information it would contain is included in the marked-up\nvariant already.\n\nThis change has the side-effect of not making the full logs available\nto us in the *.out files anymore. E.g. in the case of running a test\nwhere all tests are successful, we ran run this sequence of commands\nin t/:\n\n\ttest=t0013-sha1dc.sh;\n\trm -rf test-results*;\n\t./$test --verbose-log -x;\n\tmv test-results{,.old};\n\t./$test --verbose-log -x --github-workflow-markup;\n\tdiff -ru test-results{.old,}; file test-results/*markup\n\nWhich will emit:\n\n\tok 1 - test-sha1 detects shattered pdf\n\t# passed all 1 test(s)\n\t1..1\n\tok 1 - test-sha1 detects shattered pdf\n\t# passed all 1 test(s)\n\t1..1\n\tOnly in test-results: t0013-sha1dc.markup\n\tdiff -ru test-results.old/t0013-sha1dc.out test-results/t0013-sha1dc.out\n\t--- test-results.old/t0013-sha1dc.out   2022-05-24 19:12:14.106339385 +0200\n\t+++ test-results/t0013-sha1dc.out       2022-05-24 19:12:14.154338965 +0200\n\t@@ -1,9 +1,4 @@\n\t Initialized empty Git repository in /home/avar/g/git/t/trash directory.t0013-sha1dc/.git/\n\t-expecting success of 0013.1 'test-sha1 detects shattered pdf':\n\t-       test_must_fail test-tool sha1 <\"$TEST_DATA/shattered-1.pdf\" 2>err &&\n\t-       test_i18ngrep collision err &&\n\t-       grep 38762cf7f55934b34d179ae6a4c80cadccbb7f0a err\n\t-\n\t + test_must_fail test-tool sha1\n\t + _test_ok=\n\t + test_must_fail_acceptable test-tool sha1\n\ttest-results/t0013-sha1dc.markup: empty\n\nThis is because the the \"test_skip_test_preamble\" variable being set\nhere has a global effect. Perhaps it's acceptable to munge the *.out\noutput for now, as this will only kick in under\n--github-workflow-markup, but ideally we'd implement\n--github-workflow-markup in such a way that it doesn't change the\nnormal --verbose-log output.\n\nBecause of this change it's now harder to make sense of the\n--verbose-log output when viewing the full log output, as some of the\ncontext for test boundaries will be missing. Note that we shill have\nthe \"ok\" or \"not ok\" TAP lines, so we can still infer the test\nboundaries. The output that suffers the most from this is the\n\"--verbose-log -x\" output, i.e. we won't have the test source to go\nalong with the \"-x\" output.\n\nSigned-off-by: Victoria Dye <vdye@github.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nTested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib-functions.sh              | 2 ++\n t/test-lib-github-workflow-markup.sh | 2 ++\n 2 files changed, 4 insertions(+)\n\ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex af4831a54c6..89a5e146b7a 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -803,6 +803,7 @@ test_expect_failure () {\n \texport test_prereq\n \tif ! test_skip \"$@\"\n \tthen\n+\t\ttest -n \"$test_skip_test_preamble\" ||\n \t\tsay >&3 \"checking known breakage of $TEST_NUMBER.$test_count '$1': $2\"\n \t\tif test_run_ \"$2\" expecting_failure\n \t\tthen\n@@ -823,6 +824,7 @@ test_expect_success () {\n \texport test_prereq\n \tif ! test_skip \"$@\"\n \tthen\n+\t\ttest -n \"$test_skip_test_preamble\" ||\n \t\tsay >&3 \"expecting success of $TEST_NUMBER.$test_count '$1': $2\"\n \t\tif test_run_ \"$2\"\n \t\tthen\ndiff --git a/t/test-lib-github-workflow-markup.sh b/t/test-lib-github-workflow-markup.sh\nindex bad3ebafdb7..2267fba947c 100644\n--- a/t/test-lib-github-workflow-markup.sh\n+++ b/t/test-lib-github-workflow-markup.sh\n@@ -20,6 +20,8 @@\n # workflows; these functions will then override (empty) functions\n # that are are called at the appropriate times during the test runs.\n \n+test_skip_test_preamble=t\n+\n start_test_output () {\n \ttest -n \"$GIT_TEST_TEE_OUTPUT_FILE\" ||\n \tdie \"--github-workflow-markup requires --verbose-log\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456055","messageId":"patch-v6-11.14-68eed85162b-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 11/14] ci(github): mention where the full logs can be found","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:26:00Z","receivedAt":"2022-05-25T11:27:19Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThe full logs are contained in the `failed-tests-*.zip` artifacts that\nare attached to the failed CI run. Since this is not immediately\nobvious to the well-disposed reader, let's mention it explicitly.\n\nSuggested-by: Victoria Dye <vdye@github.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n ci/print-test-failures.sh | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex f45e36bdefc..72fae2b0cc4 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -65,6 +65,7 @@ do\n \t\tif test -n \"$do_markup\"\n \t\tthen\n \t\t\tprintf \"\\\\e[33m\\\\e[1m=== Failed test: ${TEST_NAME} ===\\\\e[m\\\\n\"\n+\t\t\techo \"The full logs are in the artifacts attached to this run.\"\n \t\t\tcat \"t/test-results/$TEST_MARKUP\"\n \t\telse\n \t\t\techo \"------------------------------------------------------------------------\"\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456056","messageId":"patch-v6-12.14-11dab84b0dc-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 12/14] ci: call `finalize_test_case_output` a little later","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:26:01Z","receivedAt":"2022-05-25T11:27:21Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWe used to call that function already before printing the final verdict.\nHowever, now that we added grouping to the GitHub workflow output, we\nwill want to include even that part in the collapsible group for that\ntest case.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/test-lib.sh | 11 ++++++-----\n 1 file changed, 6 insertions(+), 5 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 0a7e067ebdb..736c6447ecf 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -783,13 +783,13 @@ trap '{ code=$?; set +x; } 2>/dev/null; exit $code' INT TERM HUP\n # the test_expect_* functions instead.\n \n test_ok_ () {\n-\tfinalize_test_case_output ok \"$@\"\n \ttest_success=$(($test_success + 1))\n \tsay_color \"\" \"ok $test_count - $@\"\n+\tfinalize_test_case_output ok \"$@\"\n }\n \n test_failure_ () {\n-\tfinalize_test_case_output failure \"$@\"\n+\tfailure_label=$1\n \ttest_failure=$(($test_failure + 1))\n \tsay_color error \"not ok $test_count - $1\"\n \tshift\n@@ -799,18 +799,19 @@ test_failure_ () {\n \t\tsay_color error \"1..$test_count\"\n \t\t_error_exit\n \tfi\n+\tfinalize_test_case_output failure \"$failure_label\" \"$@\"\n }\n \n test_known_broken_ok_ () {\n-\tfinalize_test_case_output fixed \"$@\"\n \ttest_fixed=$(($test_fixed+1))\n \tsay_color error \"ok $test_count - $@ # TODO known breakage vanished\"\n+\tfinalize_test_case_output fixed \"$@\"\n }\n \n test_known_broken_failure_ () {\n-\tfinalize_test_case_output broken \"$@\"\n \ttest_broken=$(($test_broken+1))\n \tsay_color warn \"not ok $test_count - $@ # TODO known breakage\"\n+\tfinalize_test_case_output broken \"$@\"\n }\n \n test_debug () {\n@@ -1136,10 +1137,10 @@ test_skip () {\n \n \tcase \"$to_skip\" in\n \tt)\n-\t\tfinalize_test_case_output skip \"$@\"\n \n \t\tsay_color skip \"ok $test_count # skip $1 ($skipped_reason)\"\n \t\t: true\n+\t\tfinalize_test_case_output skip \"$@\"\n \t\t;;\n \t*)\n \t\tfalse\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456057","messageId":"patch-v6-13.14-fbe0d99c6b3-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 13/14] CI: make --github-workflow-markup ci-config, off by default","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:26:02Z","receivedAt":"2022-05-25T11:27:23Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"In preceding commits the --github-workflow-markup output was made the\ndefault under GitHub CI.\n\nThere's a few outstanding issues with that new output target however:\n\nA. As noted in [1] it's much slower in some common cases, i.e. the\n   page rendering time (under Firefox & Chrome debugging) goes from ~20s\n   to on the order of 60-80s (less pronounced when not debugging, but\n   still in that ballpark). See also [2] for tests on an earlier iteration\n   of the series.\n\nB. Preceding commits in this series to omit non-failing test output\n   may have mitigated that somewhat, i.e. skipping \"ok\" and \"skip\" tests\n   in the *.markup files (although [1] is a benchmark with that \"ok\"\n   change).\n\n   Per [3] there are some CI users that prefer to see only the full\n   verbose output, i.e. we can't in the general case assume that we\n   can emit only the trace output for the failing test, and that's\n   going to give us the information we need to debug the test. It\n   might be failing because of earlier setup, or from trace output\n   outside of any test (i.e. in the main body of the file).\n\n   Users such as [3] could still just consult the *.out output, but\n   then we'd make them download the archive instead of viewing the\n   output in the web UX.\n\nC. Per B above and [3] an earlier change in this series modified\n   the *.out output to change the *.out output inadvertently while trying\n   to modify the *.markup output. See the commit message of \"ci(github):\n   avoid printing test case preamble twice\" earlier in this series.\n\nIt thus make sense for now to make the \"ci/print-test-failures.sh\"\noutput be the \"raw\" one. I.e. the *.out output we'd get before\n--github-workflow-markup was implemented.\n\nTo make it use ci/print-test-failures.sh we can create a\n\"ci/config/print-test-failures-output-type\" script on the \"ci-config\"\nbranch that does e.g.:\n\n\t#!/bin/sh\n\techo github\n\nThat script will (like the existing \"check-ref\") get the ref as an\nargument, so we can in the future turn this on experimentally for\n\"seen\", and flip the default in the future. The script can also emit\nnothing to get whatever our idea is of the default (currently \"raw\").\n\nNote the corresponding change to ci/print-test-failures.sh, i.e. we'll\ndo the right thing vis-a-vis what we \"zoom in\" to depending on the\nsetting. If it's \"raw\" we'd like a failed \"make test\" to \"zoom in\" to\nthat step, if it's \"github\" we'd like the to open the subsequent\n\"ci/print-test-failures.sh\" step instead.\n\n1. https://lore.kernel.org/git/220523.86ee0kzjix.gmgdl@evledraar.gmail.com/\n2. https://lore.kernel.org/git/220222.86tucr6kz5.gmgdl@evledraar.gmail.com/\n3. https://lore.kernel.org/git/20210309175249.GE3590451@szeder.dev/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 24 ++++++++++++++++++++++++\n ci/lib.sh                  | 14 +++++++++++++-\n ci/print-test-failures.sh  |  7 +++++--\n 3 files changed, 42 insertions(+), 3 deletions(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 6835e942280..4195f37c1ba 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -8,6 +8,7 @@ jobs:\n     runs-on: ubuntu-latest\n     outputs:\n       enabled: ${{ steps.check-ref.outputs.enabled }}${{ steps.skip-if-redundant.outputs.enabled }}\n+      print-test-failures-output-type: ${{ steps.print-test-failures-output-type.outputs.type }}\n     steps:\n       - name: try to clone ci-config branch\n         run: |\n@@ -22,6 +23,21 @@ jobs:\n             config-repo &&\n           cd config-repo &&\n           git checkout HEAD -- ci/config || : ignore\n+      - id: print-test-failures-output-type\n+        name: check what output type ci/print-test-failures.sh uses\n+        run: |\n+          type_default=raw\n+          type=$type_default\n+\n+          if test -x config-repo/ci/config/print-test-failures-output-type\n+          then\n+            type=$(config-repo/ci/config/print-test-failures-output-type '${{ github.ref }}')\n+            if test -z \"$type\"\n+            then\n+              type=$type_default\n+            fi\n+          fi\n+          echo \"::set-output name=type::$type\"\n       - id: check-ref\n         name: check whether CI is enabled for ref\n         run: |\n@@ -124,6 +140,8 @@ jobs:\n     - uses: git-for-windows/setup-git-for-windows-sdk@v1\n     - run: ci/lib.sh --test\n       shell: bash\n+      env:\n+        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n       shell: bash\n@@ -213,6 +231,8 @@ jobs:\n       run: tar xf artifacts.tar.gz && tar xf tracked.tar.gz\n     - run: ci/lib.sh --test\n       shell: bash\n+      env:\n+        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n     - name: select tests\n       run: . /etc/profile && ci/select-test-slice.sh ${{matrix.nr}} 10\n       shell: bash\n@@ -265,6 +285,8 @@ jobs:\n     - run: ci/lib.sh --build\n     - run: make\n     - run: ci/lib.sh --test\n+      env:\n+        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n     - run: make test\n       if: success()\n     - run: ci/print-test-failures.sh\n@@ -302,6 +324,8 @@ jobs:\n     - run: make\n     - run: ci/lib.sh --test\n       if: success() && matrix.vector.skip-tests != 'yes'\n+      env:\n+        GIT_CI_PTF_OUTPUT_TYPE: ${{needs.ci-config.outputs.print-test-failures-output-type}}\n     - run: make test\n       if: success() && matrix.vector.skip-tests != 'yes'\n     - run: ci/print-test-failures.sh\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 422399b1305..b148d3f209f 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -95,6 +95,7 @@ if test -n \"$GITHUB_ENV\"\n then\n \techo \"CONFIG: GITHUB_ENV=$GITHUB_ENV\" >&2\n fi\n+echo \"CONFIG: GIT_CI_PTF_OUTPUT_TYPE=$GIT_CI_PTF_OUTPUT_TYPE\" >&2\n echo >&2\n \n # Helper functions\n@@ -189,7 +190,18 @@ MAKEFLAGS=\"$MAKEFLAGS SKIP_DASHED_BUILT_INS=$SKIP_DASHED_BUILT_INS\"\n case \"$CI_TYPE\" in\n github-actions)\n \tsetenv --test GIT_PROVE_OPTS \"--timer --jobs $NPROC\"\n-\tGIT_TEST_OPTS=\"--verbose-log -x --github-workflow-markup\"\n+\tGIT_TEST_OPTS=\"--verbose-log -x\"\n+\tif test -n \"$GIT_CI_PTF_OUTPUT_TYPE\"\n+\tthen\n+\t\t# For later use in ci/print-test-failures.sh\n+\t\tsetenv --test GIT_CI_PTF_OUTPUT_TYPE \"$GIT_CI_PTF_OUTPUT_TYPE\"\n+\n+\t\tcase \"$GIT_CI_PTF_OUTPUT_TYPE\" in\n+\t\tgithub)\n+\t\t\tGIT_TEST_OPTS=\"$GIT_TEST_OPTS --github-workflow-markup\"\n+\t\t\t;;\n+\t\tesac\n+\tfi\n \ttest Windows != \"$RUNNER_OS\" ||\n \tGIT_TEST_OPTS=\"--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS\"\n \tsetenv --test GIT_TEST_OPTS \"$GIT_TEST_OPTS\"\ndiff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh\nindex 72fae2b0cc4..1e0738e0058 100755\n--- a/ci/print-test-failures.sh\n+++ b/ci/print-test-failures.sh\n@@ -9,10 +9,13 @@ set -e\n . ${0%/*}/lib-tput.sh\n \n github_workflow_markup=auto\n-case \"$CI_TYPE\" in\n-github-actions)\n+case \"$GIT_CI_PTF_OUTPUT_TYPE\" in\n+github)\n \tgithub_workflow_markup=t\n \t;;\n+raw)\n+\tgithub_workflow_markup=\n+\t;;\n esac\n \n while test $# != 0\n-- \n2.36.1.1045.gf356b5617dd\n\n"},{"id":"456058","messageId":"patch-v6-14.14-0b02b186c87-20220525T100743Z-avarab@gmail.com","threadId":"57451","inReplyTo":"cover-v6-00.14-00000000000-20220525T100743Z-avarab@gmail.com","subject":"[PATCH v6 14/14] CI: make the --github-workflow-markup \"github\" output the default","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2022-05-25T11:26:03Z","receivedAt":"2022-05-25T11:27:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"As noted in the preceding commit there's outstanding issues with this\noutput target over the \"raw\" one, but let's flip the default so that\nthe end-state of this series matches that of [1]. If we'd like we can\nnow easily revert back.\n\nMy ci/config/print-test-failures-output-type on my \"ci-config\" branch\nis currently the following script, which allows for naming branches\nwith _CI_OUT_{GITHUB,RAW} suffixes to force a given output type:\n\n\t#!/bin/sh\n\n\tset -ex\n\n\tref=$1\n\tshift\n\techo \"ref: $ref\" >&2\n\techo \"arguments: $@\" >&2\n\n\tcase \"$ref\" in\n\t*_CI_OUT_GITHUB)\n\t\techo github\n\t\t;;\n\t*_CI_OUT_RAW)\n\t\techo raw\n\t\t;;\n\tesac\n\n1. https://lore.kernel.org/git/pull.1117.v3.git.1653171536.gitgitgadget@gmail.com/\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n .github/workflows/main.yml | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/.github/workflows/main.yml b/.github/workflows/main.yml\nindex 4195f37c1ba..39675cbdd60 100644\n--- a/.github/workflows/main.yml\n+++ b/.github/workflows/main.yml\n@@ -26,7 +26,7 @@ jobs:\n       - id: print-test-failures-output-type\n         name: check what output type ci/print-test-failures.sh uses\n         run: |\n-          type_default=raw\n+          type_default=github\n           type=$type_default\n \n           if test -x config-repo/ci/config/print-test-failures-output-type\n-- \n2.36.1.1045.gf356b5617dd\n\n"}]}