1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
export LC_ALL=C.UTF-8
unset LANGUAGE
export QT_QPA_PLATFORM=vnc
unset DBUS_SESSION_BUS_ADDRESS DESKTOP_SESSION DISPLAY WINDOWID
unset GPG_AGENT_INFO MONKEYSPHERE_VALIDATION_AGENT_SOCKET SSH_AUTH_SOCK
unset XDG_CURRENT_DESKTOP XDG_RUNTIME_DIR XDG_SESSION_COOKIE XDM_MANAGED
if ! v=$(dpkg-query -W --showformat='${Version}' qtbase5-dev); then
print -ru2 -- "E: could not determine qtbase5-dev version"
exit 255
fi
case x$v {
(x[0-9]*) ;;
(x) print -ru2 -- "E: empty qtbase5-dev version"
exit 255 ;;
(x*) print -ru2 -- "E: implausible qtbase5-dev version ${v@Q}"
exit 255 ;;
}
if dpkg --compare-versions "$v" lt 5.11; then
print -ru2 -- "I: Qt5 too old for running the tests, skipping"
exit 0
fi
set -e
set -o pipefail
rm -rf /tmp/testhome
mkdir /tmp/testhome
export HOME=/tmp/testhome
set -x
objdir=$(perl -MDebian::Debhelper::Dh_Buildsystems -e \
'buildsystems_init(); print load_buildsystem("cmake", "configure")->get_builddir();')
topdir=$(realpath .)
# parse DEB_BUILD_OPTIONS
j=
J=
fbdebug=0
nocheck=0
for i in "$@"; do
if [[ $i = parallel ]]; then
nproc=$(nproc) || nproc=1
j=-j$nproc
J=-j
elif [[ $i = parallel=* ]]; then
j=-j${i#*=}
J=$j
elif [[ $i = fbdebug ]]; then
fbdebug=1
elif [[ $i = nocheck ]]; then
nocheck=1
fi
done
# parse INSTALL_NAME
i=$(fgrep INSTALL_NAME "$objdir/config.h")
i=${i#*\"}
i=${i%\"*}
if [[ -z $i || $i = *$'\n'* ]]; then
print -ru2 -- "E: could not determine INSTALL_NAME"
print -ru2 -- I: output was \<$i\>
exit 1
fi
i=${i%%+(/)}
# skip the remainder if nocheck
if (( nocheck )); then
print -ru2 -- "I: tests disabled from DEB_BUILD_OPTIONS"
exit 0
fi
# for idempotency
rm -rf "$objdir/mtest/share" "$objdir/mtest/libmscore/share"
# create symlinks for running the tests in situ
mkdir "$objdir/mtest/share" "$objdir/mtest/libmscore/share"
ln -s "$topdir/share" "$objdir/mtest/share/$i"
ln -s "$topdir/share" "$objdir/mtest/libmscore/share/$i"
# build the tests
cd "$objdir/mtest"
make $J
# run mtests
set +e
if (( fbdebug )); then
set -A xvfbargs -- -a -s '-screen 0 1024x768x24 -fbdir /var/tmp'
else
set -A xvfbargs -- -a
fi
xvfb-run "${xvfbargs[@]}" -- ctest -O ctest.log $j --output-on-failure
rv=$?
set -e +x
(( !rv )) || print -ru2 -- "W: mtests failed with errorlevel $rv"
x=$(fgrep 'tests failed out of' ctest.log)
if [[ $x != *'passed, 0 tests failed'* ]]; then
print -ru2 -- N: $x
print -ru2 -- "W: mtests found failures"
fi
print -ru2 "I: mtests run"
|