]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
{build|unit}-test: show meson-log.txt when meson fails
authorEvgeny Vereshchagin <evvers@ya.ru>
Thu, 13 Jan 2022 07:01:17 +0000 (07:01 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 13 Jan 2022 11:27:25 +0000 (20:27 +0900)
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.

.github/workflows/build_test.sh
.github/workflows/unit_tests.sh

index cd5fcac550931c8b7e07b44bc809e5b94db64177..9dc53a8c9b9df8983fbe4f8afcafba59a7fae7cc 100755 (executable)
@@ -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
 
index 9c7beb6d19e9468fe10fed576a6ee8e5e60c3cda..fc9c9b2cdcaf0b4e7685faf6ca112a022da31f21 100755 (executable)
@@ -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