Debian Codegraph @

debian/buildtest

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