{build|unit}-test: show meson-log.txt when meson fails

to make it easier to figure out why it fails.

For example in https://github.com/systemd/systemd/runs/4799774735?check_suite_focus=true
it failed with
```

meson.build:1003:8: ERROR: Command "/usr/bin/clang -print-targets" failed with status 1.

A full log can be found at /home/runner/work/systemd/systemd/build/meson-logs/meson-log.txt
Error: Process completed with exit code 1.
```
and it wasn't clear what exactly happened there.
This commit is contained in:
Evgeny Vereshchagin
2022-01-13 07:01:17 +00:00
committed by Yu Watanabe
parent d2ceeb624c
commit 4e1ab496ae
2 changed files with 11 additions and 3 deletions

View File

@@ -125,10 +125,11 @@ for args in "${ARGS[@]}"; do
meson -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true --werror \
-Dcryptolib="${CRYPTOLIB:?}" $args build; then
cat build/meson-logs/meson-log.txt
fatal "meson failed with $args"
fi
if ! meson compile -C build; then
if ! meson compile -C build -v; then
fatal "'meson compile' failed with $args"
fi

View File

@@ -27,6 +27,13 @@ function info() {
echo -e "\033[33;1m$1\033[0m"
}
function run_meson() {
if ! meson "$@"; then
find . -type f -name meson-log.txt -exec cat '{}' +
return 1
fi
}
set -ex
MESON_ARGS=(-Dcryptolib=${CRYPTOLIB:-auto})
@@ -49,7 +56,7 @@ for phase in "${PHASES[@]}"; do
# The docs build is slow and is not affected by compiler/flags, so do it just once
MESON_ARGS+=(-Dman=true)
fi
meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
run_meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
ninja -C build -v
meson test -C build --print-errorlogs
;;
@@ -64,7 +71,7 @@ for phase in "${PHASES[@]}"; do
# -Db_lundef=false: See https://github.com/mesonbuild/meson/issues/764
MESON_ARGS+=(-Db_lundef=false -Dfuzz-tests=true)
fi
meson --werror -Dtests=unsafe -Db_sanitize=address,undefined "${MESON_ARGS[@]}" build
run_meson --werror -Dtests=unsafe -Db_sanitize=address,undefined "${MESON_ARGS[@]}" build
ninja -C build -v
export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1