|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Exit on error |
| 4 | +set -e |
| 5 | + |
| 6 | +error_handler() |
| 7 | +{ |
| 8 | + ERR_CODE=$? |
| 9 | + echo |
| 10 | + echo "Error ${ERR_CODE} with command '${BASH_COMMAND}' on line ${BASH_LINENO[0]}. Exiting." |
| 11 | + # Meson logs are stored in the build directory |
| 12 | + if [ -f "build/meson-logs/testlog.txt" ]; then |
| 13 | + echo "--- Meson Test Log ---" |
| 14 | + cat build/meson-logs/testlog.txt |
| 15 | + fi |
| 16 | + exit ${ERR_CODE} |
| 17 | +} |
| 18 | + |
| 19 | +trap error_handler ERR |
| 20 | + |
| 21 | +tests=( |
| 22 | + "-Dnotifications=enabled -Dicons-and-clipboard=enabled -Dotr=enabled -Dpgp=enabled -Domemo=enabled -Dc-plugins=enabled -Dpython-plugins=enabled -Dxscreensaver=enabled -Domemo-qrcode=enabled -Dgdk-pixbuf=enabled" |
| 23 | + "" |
| 24 | + "-Dnotifications=disabled" |
| 25 | + "-Dicons-and-clipboard=disabled" |
| 26 | + "-Dotr=disabled" |
| 27 | + "-Dpgp=disabled" |
| 28 | + "-Domemo=disabled -Domemo-qrcode=disabled" |
| 29 | + "-Dpgp=disabled -Dotr=disabled" |
| 30 | + "-Dpgp=disabled -Dotr=disabled -Domemo=disabled" |
| 31 | + "-Dpython-plugins=disabled" |
| 32 | + "-Dc-plugins=disabled" |
| 33 | + "-Dc-plugins=disabled -Dpython-plugins=disabled" |
| 34 | + "-Dxscreensaver=disabled" |
| 35 | + "-Dgdk-pixbuf=disabled" |
| 36 | +) |
| 37 | + |
| 38 | +# Run Valgrind check (Only on Linux, on first/full feature set) |
| 39 | +if [[ "$(uname | tr '[:upper:]' '[:lower:]')" == linux* ]]; then |
| 40 | + echo "--> Running Valgrind check with full features" |
| 41 | + |
| 42 | + meson setup build_valgrind ${tests[0]} -Dtests=true |
| 43 | + meson compile -C build_valgrind |
| 44 | + |
| 45 | + meson test -C build_valgrind --print-errorlogs --wrap=valgrind || echo "Valgrind issues detected" |
| 46 | + |
| 47 | + rm -rf build_valgrind |
| 48 | +fi |
| 49 | + |
| 50 | +# Iterate through all feature combinations |
| 51 | +for features in "${tests[@]}" |
| 52 | +do |
| 53 | + echo "----------------------------------------------------" |
| 54 | + echo "--> Building with: ${features}" |
| 55 | + echo "----------------------------------------------------" |
| 56 | + |
| 57 | + rm -rf build_run |
| 58 | + |
| 59 | + meson setup build_run ${features} -Dtests=true |
| 60 | + meson compile -C build_run |
| 61 | + |
| 62 | + meson test -C build_run --print-errorlogs |
| 63 | + |
| 64 | + ./build_run/profanity -v |
| 65 | +done |
0 commit comments