X Tutup
Skip to content

Commit 4e1ab49

Browse files
evverxyuwata
authored andcommitted
{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.
1 parent d2ceeb6 commit 4e1ab49

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.github/workflows/build_test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,11 @@ for args in "${ARGS[@]}"; do
125125
meson -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true --werror \
126126
-Dcryptolib="${CRYPTOLIB:?}" $args build; then
127127

128+
cat build/meson-logs/meson-log.txt
128129
fatal "meson failed with $args"
129130
fi
130131

131-
if ! meson compile -C build; then
132+
if ! meson compile -C build -v; then
132133
fatal "'meson compile' failed with $args"
133134
fi
134135

.github/workflows/unit_tests.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ function info() {
2727
echo -e "\033[33;1m$1\033[0m"
2828
}
2929

30+
function run_meson() {
31+
if ! meson "$@"; then
32+
find . -type f -name meson-log.txt -exec cat '{}' +
33+
return 1
34+
fi
35+
}
36+
3037
set -ex
3138

3239
MESON_ARGS=(-Dcryptolib=${CRYPTOLIB:-auto})
@@ -49,7 +56,7 @@ for phase in "${PHASES[@]}"; do
4956
# The docs build is slow and is not affected by compiler/flags, so do it just once
5057
MESON_ARGS+=(-Dman=true)
5158
fi
52-
meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
59+
run_meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true "${MESON_ARGS[@]}" build
5360
ninja -C build -v
5461
meson test -C build --print-errorlogs
5562
;;
@@ -64,7 +71,7 @@ for phase in "${PHASES[@]}"; do
6471
# -Db_lundef=false: See https://github.com/mesonbuild/meson/issues/764
6572
MESON_ARGS+=(-Db_lundef=false -Dfuzz-tests=true)
6673
fi
67-
meson --werror -Dtests=unsafe -Db_sanitize=address,undefined "${MESON_ARGS[@]}" build
74+
run_meson --werror -Dtests=unsafe -Db_sanitize=address,undefined "${MESON_ARGS[@]}" build
6875
ninja -C build -v
6976

7077
export ASAN_OPTIONS=strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1

0 commit comments

Comments
 (0)
X Tutup