summaryrefslogtreecommitdiff
path: root/.gitlab-ci/run-tests.sh
blob: a4593532f347b226ce4c2a53de5a23e56cca685b (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash

set +x
set +e

srcdir=$( pwd )
builddir=$1
backend=$2

# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
export G_SLICE=always-malloc

case "${backend}" in
  x11)
    xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
          meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend} \
                --suite=gtk \
                --no-suite=failing \
                --no-suite=flaky \
                --no-suite=gsk-compare-broadway

    # Store the exit code for the CI run, but always
    # generate the reports
    exit_code=$?

    xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
          meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend}_unstable \
                --suite=flaky \
                --suite=failing || true
    ;;

  wayland)
    export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"

    weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
    compositor=$!
    export WAYLAND_DISPLAY=wayland-5

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend} \
                --suite=gtk \
                --no-suite=failing \
                --no-suite=flaky \
                --no-suite=gsk-compare-broadway
    exit_code=$?

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend}_unstable \
                --suite=flaky \
                --suite=failing || true

    kill ${compositor}
    ;;

  waylandgles)
    export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"

    weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
    compositor=$!
    export WAYLAND_DISPLAY=wayland-6

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend} \
                --suite=gtk \
                --no-suite=failing \
                --no-suite=flaky \
                --no-suite=gsk-compare-broadway
    exit_code=$?

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend}_unstable \
                --suite=flaky \
                --suite=failing || true

    kill ${compositor}
    ;;

  broadway)
    export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"

    ${builddir}/gdk/broadway/gtk4-broadwayd :5 &
    server=$!
    export BROADWAY_DISPLAY=:5

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend} \
                --suite=gtk \
                --no-suite=failing \
                --no-suite=flaky \
                --no-suite=gsk-compare-opengl

    # don't let Broadway failures fail the run, for now
    exit_code=0

    meson test -C ${builddir} \
                --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
                --print-errorlogs \
                --setup=${backend}_unstable \
                --suite=flaky \
                --suite=failing || true

    kill ${server}
    ;;

  *)
    echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
    exit 1
    ;;

esac

cd ${builddir}

for suffix in "" "_unstable"; do
    $srcdir/.gitlab-ci/meson-junit-report.py \
            --project-name=gtk \
            --backend="${backend}${suffix}" \
            --job-id="${CI_JOB_NAME}" \
            --output="report-${backend}${suffix}.xml" \
            "meson-logs/testlog-${backend}${suffix}.json"
    $srcdir/.gitlab-ci/meson-html-report.py \
            --project-name=gtk \
            --backend="${backend}${suffix}" \
            --job-id="${CI_JOB_NAME}" \
            --reftest-output-dir="testsuite/reftests/output/${backend}${suffix}" \
            --output="report-${backend}${suffix}.html" \
            "meson-logs/testlog-${backend}${suffix}.json"
done

exit $exit_code