From: Evgeny Vereshchagin Date: Thu, 13 Jan 2022 07:01:17 +0000 (+0000) Subject: {build|unit}-test: show meson-log.txt when meson fails X-Git-Tag: v251-rc1~538 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e1ab496ae58e21b233ed7cd7fea3c8f495ef1e4;p=thirdparty%2Fsystemd.git {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. --- diff --git a/.github/workflows/build_test.sh b/.github/workflows/build_test.sh index cd5fcac5509..9dc53a8c9b9 100755 --- a/.github/workflows/build_test.sh +++ b/.github/workflows/build_test.sh @@ -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 diff --git a/.github/workflows/unit_tests.sh b/.github/workflows/unit_tests.sh index 9c7beb6d19e..fc9c9b2cdca 100755 --- a/.github/workflows/unit_tests.sh +++ b/.github/workflows/unit_tests.sh @@ -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