Merge branch 'ps/ci-meson'

The meson-build procedure is integrated into CI to catch and
prevent bitrotting.

* ps/ci-meson:
  ci: wire up Meson builds
  t: introduce compatibility options to clar-based tests
  t: fix out-of-tree tests for some git-p4 tests
  Makefile: detect missing Meson tests
  meson: detect missing tests at configure time
  t/unit-tests: rename clar-based unit tests to have a common prefix
  Makefile: drop -DSUPPRESS_ANNOTATED_LEAKS
  ci/lib: support custom output directories when creating test artifacts
This commit is contained in:
Junio C Hamano
2024-12-23 09:32:24 -08:00
17 changed files with 195 additions and 74 deletions

View File

@ -58,6 +58,7 @@ ubuntu-*|ubuntu32-*|debian-*)
make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
libemail-valid-perl libio-pty-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
libpcre2-dev meson ninja-build pkg-config \
${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
case "$distro" in
@ -90,6 +91,12 @@ macos-*)
sudo xattr -d com.apple.quarantine "$CUSTOM_PATH/p4" "$CUSTOM_PATH/p4d" 2>/dev/null || true
rm helix-core-server.tgz
case "$jobname" in
osx-meson)
brew install meson ninja pcre2
;;
esac
if test -n "$CC_PACKAGE"
then
BREW_PACKAGE=${CC_PACKAGE/-/@}

View File

@ -181,9 +181,9 @@ handle_failed_tests () {
}
create_failed_test_artifacts () {
mkdir -p t/failed-test-artifacts
mkdir -p "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts
for test_exit in t/test-results/*.exit
for test_exit in "${TEST_OUTPUT_DIRECTORY:-t}"/test-results/*.exit
do
test 0 != "$(cat "$test_exit")" || continue
@ -192,11 +192,11 @@ create_failed_test_artifacts () {
printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
echo "The full logs are in the 'print test failures' step below."
echo "See also the 'failed-tests-*' artifacts attached to this run."
cat "t/test-results/$test_name.markup"
cat "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.markup"
trash_dir="t/trash directory.$test_name"
cp "t/test-results/$test_name.out" t/failed-test-artifacts/
tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
trash_dir="${TEST_OUTPUT_DIRECTORY:-t}/trash directory.$test_name"
cp "${TEST_OUTPUT_DIRECTORY:-t}/test-results/$test_name.out" "${TEST_OUTPUT_DIRECTORY:-t}"/failed-test-artifacts/
tar czf "${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts/$test_name.trash.tar.gz" "$trash_dir"
done
}
@ -237,7 +237,7 @@ then
CC="${CC_PACKAGE:-${CC:-gcc}}"
DONT_SKIP_TAGS=t
handle_failed_tests () {
echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:-t}/failed-test-artifacts" >>$GITHUB_ENV
create_failed_test_artifacts
return 1
}

View File

@ -46,7 +46,7 @@ do
;;
github-actions)
mkdir -p failed-test-artifacts
echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
echo "FAILED_TEST_ARTIFACTS=${TEST_OUTPUT_DIRECTORY:t}/failed-test-artifacts" >>$GITHUB_ENV
cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
continue

View File

@ -48,12 +48,29 @@ pedantic)
;;
esac
group Build make
if test -n "$run_tests"
then
group "Run tests" make test ||
handle_failed_tests
fi
check_unignored_build_artifacts
case "$jobname" in
*-meson)
group "Configure" meson setup build . \
--warnlevel 2 --werror \
--wrap-mode nofallback
group "Build" meson compile -C build --
if test -n "$run_tests"
then
group "Run tests" meson test -C build --print-errorlogs --test-args="$GIT_TEST_OPTS" || (
./t/aggregate-results.sh "${TEST_OUTPUT_DIRECTORY:-t}/test-results"
handle_failed_tests
)
fi
;;
*)
group Build make
if test -n "$run_tests"
then
group "Run tests" make test ||
handle_failed_tests
fi
;;
esac
check_unignored_build_artifacts
save_good_tree