Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20200903' into staging
[qemu.git] / .gitlab-ci.yml
1 # Currently we have two build stages after our containers are built:
2 #  - build (for traditional build and test or first stage build)
3 #  - test (for test stages, using build artefacts from a build stage)
4 stages:
5   - containers
6   - containers-layer2
7   - containers-layer3
8   - build
9   - test
10
11 # We assume GitLab has it's own caching set up for RPM/APT repositories so we
12 # just take care of avocado assets here.
13 cache:
14   paths:
15     - $HOME/avocado/data/cache
16
17 include:
18   - local: '/.gitlab-ci.d/edk2.yml'
19   - local: '/.gitlab-ci.d/opensbi.yml'
20   - local: '/.gitlab-ci.d/containers.yml'
21
22 .native_build_job_template: &native_build_job_definition
23   stage: build
24   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
25   before_script:
26     - JOBS=$(expr $(nproc) + 1)
27   script:
28     - mkdir build
29     - cd build
30     - if test -n "$TARGETS";
31       then
32         ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
33       else
34         ../configure --enable-werror $CONFIGURE_ARGS ;
35       fi
36     - make -j"$JOBS"
37     - if test -n "$MAKE_CHECK_ARGS";
38       then
39         make -j"$JOBS" $MAKE_CHECK_ARGS ;
40       fi
41
42 .native_test_job_template: &native_test_job_definition
43   stage: test
44   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
45   script:
46     - cd build
47     - find . -type f -exec touch {} +
48     - make $MAKE_CHECK_ARGS
49
50 .acceptance_template: &acceptance_definition
51   cache:
52     key: "${CI_JOB_NAME}-cache"
53     paths:
54       - ${CI_PROJECT_DIR}/avocado-cache
55     policy: pull-push
56   before_script:
57     - mkdir -p ~/.config/avocado
58     - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
59     - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
60            >> ~/.config/avocado/avocado.conf
61     - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
62         du -chs ${CI_PROJECT_DIR}/avocado-cache ;
63       fi
64   after_script:
65     - cd build
66     - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat
67     - du -chs ${CI_PROJECT_DIR}/avocado-cache
68
69 build-system-ubuntu:
70   <<: *native_build_job_definition
71   variables:
72     IMAGE: ubuntu2004
73     TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
74       moxie-softmmu microblazeel-softmmu mips64el-softmmu
75     MAKE_CHECK_ARGS: check-build
76   artifacts:
77     expire_in: 2 days
78     paths:
79       - build
80
81 check-system-ubuntu:
82   <<: *native_test_job_definition
83   needs:
84     - job: build-system-ubuntu
85       artifacts: true
86   variables:
87     IMAGE: ubuntu2004
88     MAKE_CHECK_ARGS: check
89
90 acceptance-system-ubuntu:
91   <<: *native_test_job_definition
92   needs:
93     - job: build-system-ubuntu
94       artifacts: true
95   variables:
96     IMAGE: ubuntu2004
97     MAKE_CHECK_ARGS: check-acceptance
98   <<: *acceptance_definition
99
100 build-system-debian:
101   <<: *native_build_job_definition
102   variables:
103     IMAGE: debian-amd64
104     TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
105       riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
106     MAKE_CHECK_ARGS: check-build
107   artifacts:
108     expire_in: 2 days
109     paths:
110       - build
111
112 check-system-debian:
113   <<: *native_test_job_definition
114   needs:
115     - job: build-system-debian
116       artifacts: true
117   variables:
118     IMAGE: debian-amd64
119     MAKE_CHECK_ARGS: check
120
121 acceptance-system-debian:
122   <<: *native_test_job_definition
123   needs:
124     - job: build-system-debian
125       artifacts: true
126   variables:
127     IMAGE: debian-amd64
128     MAKE_CHECK_ARGS: check-acceptance
129   <<: *acceptance_definition
130
131 build-system-fedora:
132   <<: *native_build_job_definition
133   variables:
134     IMAGE: fedora
135     TARGETS: tricore-softmmu unicore32-softmmu microblaze-softmmu mips-softmmu
136       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
137     MAKE_CHECK_ARGS: check-build
138   artifacts:
139     expire_in: 2 days
140     paths:
141       - build
142
143 check-system-fedora:
144   <<: *native_test_job_definition
145   needs:
146     - job: build-system-fedora
147       artifacts: true
148   variables:
149     IMAGE: fedora
150     MAKE_CHECK_ARGS: check
151
152 acceptance-system-fedora:
153   <<: *native_test_job_definition
154   needs:
155     - job: build-system-fedora
156       artifacts: true
157   variables:
158     IMAGE: fedora
159     MAKE_CHECK_ARGS: check-acceptance
160   <<: *acceptance_definition
161
162 build-system-centos:
163   <<: *native_build_job_definition
164   variables:
165     IMAGE: centos8
166     TARGETS: ppc64-softmmu lm32-softmmu or1k-softmmu s390x-softmmu
167       x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
168     MAKE_CHECK_ARGS: check-build
169   artifacts:
170     expire_in: 2 days
171     paths:
172       - build
173
174 check-system-centos:
175   <<: *native_test_job_definition
176   needs:
177     - job: build-system-centos
178       artifacts: true
179   variables:
180     IMAGE: centos8
181     MAKE_CHECK_ARGS: check
182
183 acceptance-system-centos:
184   <<: *native_test_job_definition
185   needs:
186     - job: build-system-centos
187       artifacts: true
188   variables:
189     IMAGE: centos8
190     MAKE_CHECK_ARGS: check-acceptance
191   <<: *acceptance_definition
192
193 build-disabled:
194   <<: *native_build_job_definition
195   variables:
196     IMAGE: fedora
197     CONFIGURE_ARGS: --disable-attr --disable-avx2 --disable-bochs
198       --disable-brlapi --disable-bzip2 --disable-cap-ng --disable-capstone
199       --disable-cloop --disable-coroutine-pool --disable-curl --disable-curses
200       --disable-dmg --disable-docs --disable-glusterfs --disable-gnutls
201       --disable-gtk --disable-guest-agent --disable-iconv --disable-kvm
202       --disable-libiscsi --disable-libpmem --disable-libssh --disable-libusb
203       --disable-libxml2 --disable-linux-aio --disable-live-block-migration
204       --disable-lzo --disable-malloc-trim --disable-mpath --disable-nettle
205       --disable-numa --disable-parallels --disable-pie --disable-qcow1
206       --disable-qed --disable-qom-cast-debug --disable-rbd --disable-rdma
207       --disable-replication --disable-sdl --disable-seccomp --disable-sheepdog
208       --disable-slirp --disable-smartcard --disable-snappy --disable-spice
209       --disable-strip --disable-tpm --disable-usb-redir --disable-vdi
210       --disable-vhost-crypto --disable-vhost-net --disable-vhost-scsi
211       --disable-vhost-user --disable-vhost-vdpa --disable-vhost-vsock
212       --disable-virglrenderer --disable-vnc --disable-vte --disable-vvfat
213       --disable-xen --disable-zstd
214     TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
215       s390x-softmmu i386-linux-user
216     MAKE_CHECK_ARGS: check-qtest SPEED=slow
217
218 build-tcg-disabled:
219   <<: *native_build_job_definition
220   variables:
221     IMAGE: centos8
222   script:
223     - mkdir build
224     - cd build
225     - ../configure --disable-tcg --audio-drv-list=""
226     - make -j"$JOBS"
227     - make check-unit
228     - make check-qapi-schema
229     - cd tests/qemu-iotests/
230     - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
231             052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
232             170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
233     - ./check -qcow2 028 051 056 057 058 065 067 068 082 085 091 095 096 102 122
234             124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
235             208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
236             260 261 262 263 264 270 272 273 277 279
237
238 build-user:
239   <<: *native_build_job_definition
240   variables:
241     IMAGE: debian-all-test-cross
242     CONFIGURE_ARGS: --disable-tools --disable-system
243     MAKE_CHECK_ARGS: check-tcg
244
245 build-clang:
246   <<: *native_build_job_definition
247   variables:
248     IMAGE: fedora
249     CONFIGURE_ARGS: --cc=clang --cxx=clang++
250     TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
251       ppc-softmmu s390x-softmmu arm-linux-user
252     MAKE_CHECK_ARGS: check
253
254 build-oss-fuzz:
255   <<: *native_build_job_definition
256   variables:
257     IMAGE: fedora
258   script:
259     - mkdir build-oss-fuzz
260     - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
261       ./scripts/oss-fuzz/build.sh
262     - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
263     - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
264                       | grep -v slirp); do
265         grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
266         echo Testing ${fuzzer} ... ;
267         "${fuzzer}" -runs=1000 -seed=1 || exit 1 ;
268       done
269     # Unrelated to fuzzer: run some tests with -fsanitize=address
270     - cd build-oss-fuzz && make check-qtest-i386 check-unit
271
272 build-tci:
273   <<: *native_build_job_definition
274   variables:
275     IMAGE: fedora
276   script:
277     - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
278     - mkdir build
279     - cd build
280     - ../configure --enable-tcg-interpreter
281         --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
282     - make -j"$JOBS"
283     - make run-tcg-tests-x86_64-softmmu
284     - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
285     - for tg in $TARGETS ; do
286         export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
287         ./tests/qtest/boot-serial-test || exit 1 ;
288         ./tests/qtest/cdrom-test || exit 1 ;
289       done
290     - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
291     - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow