test/guest-debug: echo QEMU command as well
[qemu.git] / .gitlab-ci.yml
blobfd0162ad29b9955d25958775b75043d6472f17b5
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   - build
8   - test
10 include:
11   - local: '/.gitlab-ci.d/edk2.yml'
12   - local: '/.gitlab-ci.d/opensbi.yml'
13   - local: '/.gitlab-ci.d/containers.yml'
14   - local: '/.gitlab-ci.d/crossbuilds.yml'
16 .native_build_job_template: &native_build_job_definition
17   stage: build
18   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
19   before_script:
20     - JOBS=$(expr $(nproc) + 1)
21     - sed -i s,git.qemu.org/git,gitlab.com/qemu-project, .gitmodules
22   script:
23     - mkdir build
24     - cd build
25     - if test -n "$TARGETS";
26       then
27         ../configure --enable-werror $CONFIGURE_ARGS --target-list="$TARGETS" ;
28       else
29         ../configure --enable-werror $CONFIGURE_ARGS ;
30       fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
31     - make -j"$JOBS"
32     - if test -n "$MAKE_CHECK_ARGS";
33       then
34         make -j"$JOBS" $MAKE_CHECK_ARGS ;
35       fi
37 .native_test_job_template: &native_test_job_definition
38   stage: test
39   image: $CI_REGISTRY_IMAGE/qemu/$IMAGE:latest
40   script:
41     - cd build
42     - find . -type f -exec touch {} +
43     - make $MAKE_CHECK_ARGS
45 .acceptance_template: &acceptance_definition
46   cache:
47     key: "${CI_JOB_NAME}-cache"
48     paths:
49       - ${CI_PROJECT_DIR}/avocado-cache
50     policy: pull-push
51   artifacts:
52     name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
53     when: always
54     expire_in: 2 days
55     paths:
56       - build/tests/results/latest/results.xml
57       - build/tests/results/latest/test-results
58     reports:
59       junit: build/tests/results/latest/results.xml
60   before_script:
61     - mkdir -p ~/.config/avocado
62     - echo "[datadir.paths]" > ~/.config/avocado/avocado.conf
63     - echo "cache_dirs = ['${CI_PROJECT_DIR}/avocado-cache']"
64            >> ~/.config/avocado/avocado.conf
65     - echo -e '[job.output.testlogs]\nstatuses = ["FAIL"]'
66            >> ~/.config/avocado/avocado.conf
67     - if [ -d ${CI_PROJECT_DIR}/avocado-cache ]; then
68         du -chs ${CI_PROJECT_DIR}/avocado-cache ;
69       fi
70     - export AVOCADO_ALLOW_UNTRUSTED_CODE=1
71   after_script:
72     - cd build
73     - du -chs ${CI_PROJECT_DIR}/avocado-cache
75 build-system-ubuntu:
76   <<: *native_build_job_definition
77   variables:
78     IMAGE: ubuntu2004
79     TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
80       moxie-softmmu microblazeel-softmmu mips64el-softmmu
81     MAKE_CHECK_ARGS: check-build
82   artifacts:
83     expire_in: 2 days
84     paths:
85       - build
87 check-system-ubuntu:
88   <<: *native_test_job_definition
89   needs:
90     - job: build-system-ubuntu
91       artifacts: true
92   variables:
93     IMAGE: ubuntu2004
94     MAKE_CHECK_ARGS: check
96 acceptance-system-ubuntu:
97   <<: *native_test_job_definition
98   needs:
99     - job: build-system-ubuntu
100       artifacts: true
101   variables:
102     IMAGE: ubuntu2004
103     MAKE_CHECK_ARGS: check-acceptance
104   <<: *acceptance_definition
106 build-system-debian:
107   <<: *native_build_job_definition
108   variables:
109     IMAGE: debian-amd64
110     TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
111       riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
112     MAKE_CHECK_ARGS: check-build
113   artifacts:
114     expire_in: 2 days
115     paths:
116       - build
118 check-system-debian:
119   <<: *native_test_job_definition
120   needs:
121     - job: build-system-debian
122       artifacts: true
123   variables:
124     IMAGE: debian-amd64
125     MAKE_CHECK_ARGS: check
127 # No targets are built here, just tools, docs, and unit tests. This
128 # also feeds into the eventual documentation deployment steps later
129 build-tools-and-docs-debian:
130   <<: *native_build_job_definition
131   variables:
132     IMAGE: debian-amd64
133     MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope
134     CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
135   artifacts:
136     expire_in: 2 days
137     paths:
138       - build
140 acceptance-system-debian:
141   <<: *native_test_job_definition
142   needs:
143     - job: build-system-debian
144       artifacts: true
145   variables:
146     IMAGE: debian-amd64
147     MAKE_CHECK_ARGS: check-acceptance
148   <<: *acceptance_definition
150 build-system-fedora:
151   <<: *native_build_job_definition
152   variables:
153     IMAGE: fedora
154     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
155     TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
156       xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
157     MAKE_CHECK_ARGS: check-build
158   artifacts:
159     expire_in: 2 days
160     paths:
161       - build
163 check-system-fedora:
164   <<: *native_test_job_definition
165   needs:
166     - job: build-system-fedora
167       artifacts: true
168   variables:
169     IMAGE: fedora
170     MAKE_CHECK_ARGS: check
172 acceptance-system-fedora:
173   <<: *native_test_job_definition
174   needs:
175     - job: build-system-fedora
176       artifacts: true
177   variables:
178     IMAGE: fedora
179     MAKE_CHECK_ARGS: check-acceptance
180   <<: *acceptance_definition
182 build-system-centos:
183   <<: *native_build_job_definition
184   variables:
185     IMAGE: centos8
186     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
187     TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
188       x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
189     MAKE_CHECK_ARGS: check-build
190   artifacts:
191     expire_in: 2 days
192     paths:
193       - build
195 check-system-centos:
196   <<: *native_test_job_definition
197   needs:
198     - job: build-system-centos
199       artifacts: true
200   variables:
201     IMAGE: centos8
202     MAKE_CHECK_ARGS: check
204 acceptance-system-centos:
205   <<: *native_test_job_definition
206   needs:
207     - job: build-system-centos
208       artifacts: true
209   variables:
210     IMAGE: centos8
211     MAKE_CHECK_ARGS: check-acceptance
212   <<: *acceptance_definition
214 build-system-opensuse:
215   <<: *native_build_job_definition
216   variables:
217     IMAGE: opensuse-leap
218     TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
219     MAKE_CHECK_ARGS: check-build
220   artifacts:
221     expire_in: 2 days
222     paths:
223       - build
225 check-system-opensuse:
226   <<: *native_test_job_definition
227   needs:
228     - job: build-system-opensuse
229       artifacts: true
230   variables:
231     IMAGE: opensuse-leap
232     MAKE_CHECK_ARGS: check
234 acceptance-system-opensuse:
235    <<: *native_test_job_definition
236    needs:
237      - job: build-system-opensuse
238        artifacts: true
239    variables:
240      IMAGE: opensuse-leap
241      MAKE_CHECK_ARGS: check-acceptance
242    <<: *acceptance_definition
245 build-disabled:
246   <<: *native_build_job_definition
247   variables:
248     IMAGE: fedora
249     CONFIGURE_ARGS:
250       --disable-attr
251       --disable-auth-pam
252       --disable-avx2
253       --disable-bochs
254       --disable-brlapi
255       --disable-bzip2
256       --disable-cap-ng
257       --disable-capstone
258       --disable-cloop
259       --disable-coroutine-pool
260       --disable-curl
261       --disable-curses
262       --disable-dmg
263       --disable-docs
264       --disable-gcrypt
265       --disable-glusterfs
266       --disable-gnutls
267       --disable-gtk
268       --disable-guest-agent
269       --disable-iconv
270       --disable-keyring
271       --disable-kvm
272       --disable-libiscsi
273       --disable-libpmem
274       --disable-libssh
275       --disable-libudev
276       --disable-libusb
277       --disable-libxml2
278       --disable-linux-aio
279       --disable-live-block-migration
280       --disable-lzo
281       --disable-malloc-trim
282       --disable-mpath
283       --disable-nettle
284       --disable-numa
285       --disable-opengl
286       --disable-parallels
287       --disable-pie
288       --disable-qcow1
289       --disable-qed
290       --disable-qom-cast-debug
291       --disable-rbd
292       --disable-rdma
293       --disable-replication
294       --disable-sdl
295       --disable-seccomp
296       --disable-sheepdog
297       --disable-slirp
298       --disable-smartcard
299       --disable-snappy
300       --disable-sparse
301       --disable-spice
302       --disable-strip
303       --disable-tpm
304       --disable-usb-redir
305       --disable-vdi
306       --disable-vhost-crypto
307       --disable-vhost-net
308       --disable-vhost-scsi
309       --disable-vhost-user
310       --disable-vhost-vdpa
311       --disable-vhost-vsock
312       --disable-virglrenderer
313       --disable-vnc
314       --disable-vte
315       --disable-vvfat
316       --disable-xen
317       --disable-zstd
318     TARGETS: arm-softmmu i386-softmmu ppc64-softmmu mips64-softmmu
319       s390x-softmmu i386-linux-user
320     MAKE_CHECK_ARGS: check-qtest SPEED=slow
322 # This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
323 # the configure script. The container doesn't contain Xen headers so
324 # Xen accelerator is not detected / selected. As result it build the
325 # i386-softmmu and x86_64-softmmu with KVM being the single accelerator
326 # available.
327 build-tcg-disabled:
328   <<: *native_build_job_definition
329   variables:
330     IMAGE: centos8
331   script:
332     - mkdir build
333     - cd build
334     - ../configure --disable-tcg --audio-drv-list="" || { cat config.log meson-logs/meson-log.txt && exit 1; }
335     - make -j"$JOBS"
336     - make check-unit
337     - make check-qapi-schema
338     - cd tests/qemu-iotests/
339     - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
340             052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
341             170 171 183 184 192 194 197 208 215 221 222 226 227 236 253 277
342     - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
343             124 132 139 142 144 145 151 152 155 157 165 194 196 197 200 202
344             208 209 215 216 218 222 227 234 246 247 248 250 254 255 257 258
345             260 261 262 263 264 270 272 273 277 279
347 build-user:
348   <<: *native_build_job_definition
349   variables:
350     IMAGE: debian-all-test-cross
351     CONFIGURE_ARGS: --disable-tools --disable-system
352     MAKE_CHECK_ARGS: check-tcg
354 build-user-static:
355   <<: *native_build_job_definition
356   variables:
357     IMAGE: debian-all-test-cross
358     CONFIGURE_ARGS: --disable-tools --disable-system --static
359     MAKE_CHECK_ARGS: check-tcg
361 # Only build the softmmu targets we have check-tcg tests for
362 build-some-softmmu:
363   <<: *native_build_job_definition
364   variables:
365     IMAGE: debian-all-test-cross
366     CONFIGURE_ARGS: --disable-tools --enable-debug-tcg
367     TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
368     MAKE_CHECK_ARGS: check-tcg
370 # Run check-tcg against linux-user (with plugins)
371 # we skip sparc64-linux-user until it has been fixed somewhat
372 # we skip cris-linux-user as it doesn't use the common run loop
373 build-user-plugins:
374   <<: *native_build_job_definition
375   variables:
376     IMAGE: debian-all-test-cross
377     CONFIGURE_ARGS: --disable-tools --disable-system --enable-plugins --enable-debug-tcg --target-list-exclude=sparc64-linux-user,cris-linux-user
378     MAKE_CHECK_ARGS: check-tcg
379   timeout: 1h 30m
381 build-some-softmmu-plugins:
382   <<: *native_build_job_definition
383   variables:
384     IMAGE: debian-all-test-cross
385     CONFIGURE_ARGS: --disable-tools --disable-user --enable-plugins --enable-debug-tcg
386     TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
387     MAKE_CHECK_ARGS: check-tcg
389 build-clang:
390   <<: *native_build_job_definition
391   variables:
392     IMAGE: fedora
393     CONFIGURE_ARGS: --cc=clang --cxx=clang++
394     TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
395       ppc-softmmu s390x-softmmu arm-linux-user
396     MAKE_CHECK_ARGS: check
398 # These targets are on the way out
399 build-deprecated:
400   <<: *native_build_job_definition
401   variables:
402     IMAGE: debian-all-test-cross
403     CONFIGURE_ARGS: --disable-docs --disable-tools
404     MAKE_CHECK_ARGS: build-tcg
405     TARGETS: ppc64abi32-linux-user tilegx-linux-user lm32-softmmu
406       unicore32-softmmu
407   artifacts:
408     expire_in: 2 days
409     paths:
410       - build
412 # We split the check-tcg step as test failures are expected but we still
413 # want to catch the build breaking.
414 check-deprecated:
415   <<: *native_test_job_definition
416   needs:
417     - job: build-deprecated
418       artifacts: true
419   variables:
420     IMAGE: debian-all-test-cross
421     MAKE_CHECK_ARGS: check-tcg
422   allow_failure: true
424 build-oss-fuzz:
425   <<: *native_build_job_definition
426   variables:
427     IMAGE: fedora
428   script:
429     - mkdir build-oss-fuzz
430     - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
431       ./scripts/oss-fuzz/build.sh
432     - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
433     - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
434                       | grep -v slirp); do
435         grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
436         echo Testing ${fuzzer} ... ;
437         "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
438       done
439     # Unrelated to fuzzer: run some tests with -fsanitize=address
440     - cd build-oss-fuzz && make check-qtest-i386 check-unit
442 build-tci:
443   <<: *native_build_job_definition
444   variables:
445     IMAGE: fedora
446   script:
447     - TARGETS="aarch64 alpha arm hppa m68k microblaze moxie ppc64 s390x x86_64"
448     - mkdir build
449     - cd build
450     - ../configure --enable-tcg-interpreter
451         --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
452     - make -j"$JOBS"
453     - make run-tcg-tests-x86_64-softmmu
454     - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
455     - for tg in $TARGETS ; do
456         export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
457         ./tests/qtest/boot-serial-test || exit 1 ;
458         ./tests/qtest/cdrom-test || exit 1 ;
459       done
460     - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
461     - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
463 # Alternate coroutines implementations are only really of interest to KVM users
464 # However we can't test against KVM on Gitlab-CI so we can only run unit tests
465 build-coroutine-ucontext:
466   <<: *native_build_job_definition
467   variables:
468     IMAGE: ubuntu2004
469     CONFIGURE_ARGS: --with-coroutine=ucontext --disable-tcg
470     MAKE_CHECK_ARGS: check-unit
472 build-coroutine-sigaltstack:
473   <<: *native_build_job_definition
474   variables:
475     IMAGE: ubuntu2004
476     CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
477     MAKE_CHECK_ARGS: check-unit
479 # Most jobs test latest gcrypt or nettle builds
481 # These jobs test old gcrypt and nettle from RHEL7
482 # which had some API differences.
483 build-crypto-old-nettle:
484   <<: *native_build_job_definition
485   variables:
486     IMAGE: centos7
487     TARGETS: x86_64-softmmu x86_64-linux-user
488     CONFIGURE_ARGS: --disable-gcrypt --enable-nettle
489     MAKE_CHECK_ARGS: check-build
490   artifacts:
491     paths:
492       - build
494 check-crypto-old-nettle:
495   <<: *native_test_job_definition
496   needs:
497     - job: build-crypto-old-nettle
498       artifacts: true
499   variables:
500     IMAGE: centos7
501     MAKE_CHECK_ARGS: check
504 build-crypto-old-gcrypt:
505   <<: *native_build_job_definition
506   variables:
507     IMAGE: centos7
508     TARGETS: x86_64-softmmu x86_64-linux-user
509     CONFIGURE_ARGS: --disable-nettle --enable-gcrypt
510     MAKE_CHECK_ARGS: check-build
511   artifacts:
512     paths:
513       - build
515 check-crypto-old-gcrypt:
516   <<: *native_test_job_definition
517   needs:
518     - job: build-crypto-old-gcrypt
519       artifacts: true
520   variables:
521     IMAGE: centos7
522     MAKE_CHECK_ARGS: check
525 build-crypto-only-gnutls:
526   <<: *native_build_job_definition
527   variables:
528     IMAGE: centos7
529     TARGETS: x86_64-softmmu x86_64-linux-user
530     CONFIGURE_ARGS: --disable-nettle --disable-gcrypt --enable-gnutls
531     MAKE_CHECK_ARGS: check-build
532   artifacts:
533     paths:
534       - build
536 check-crypto-only-gnutls:
537   <<: *native_test_job_definition
538   needs:
539     - job: build-crypto-only-gnutls
540       artifacts: true
541   variables:
542     IMAGE: centos7
543     MAKE_CHECK_ARGS: check
545 # We don't need to exercise every backend with every front-end
546 build-trace-multi-user:
547   <<: *native_build_job_definition
548   variables:
549     IMAGE: ubuntu2004
550     CONFIGURE_ARGS: --enable-trace-backends=log,simple,syslog --disable-system
552 build-trace-ftrace-system:
553   <<: *native_build_job_definition
554   variables:
555     IMAGE: ubuntu2004
556     CONFIGURE_ARGS: --enable-trace-backends=ftrace --target-list=x86_64-softmmu
558 build-trace-ust-system:
559   <<: *native_build_job_definition
560   variables:
561     IMAGE: ubuntu2004
562     CONFIGURE_ARGS: --enable-trace-backends=ust --target-list=x86_64-softmmu
564 # Check our reduced build configurations
565 build-without-default-devices:
566   <<: *native_build_job_definition
567   variables:
568     IMAGE: centos8
569     CONFIGURE_ARGS: --without-default-devices --disable-user
571 build-without-default-features:
572   <<: *native_build_job_definition
573   variables:
574     IMAGE: debian-amd64
575     CONFIGURE_ARGS: --without-default-features --disable-user
576     MAKE_CHECK_ARGS: check-unit
578 check-patch:
579   stage: build
580   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
581   script: .gitlab-ci.d/check-patch.py
582   except:
583     variables:
584       - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
585   variables:
586     GIT_DEPTH: 1000
587   allow_failure: true
589 check-dco:
590   stage: build
591   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
592   script: .gitlab-ci.d/check-dco.py
593   except:
594     variables:
595       - $CI_PROJECT_NAMESPACE == 'qemu-project' && $CI_COMMIT_BRANCH == 'master'
596   variables:
597     GIT_DEPTH: 1000
599 build-libvhost-user:
600   stage: build
601   image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
602   before_script:
603     - dnf install -y meson ninja-build
604   script:
605     - mkdir subprojects/libvhost-user/build
606     - cd subprojects/libvhost-user/build
607     - meson
608     - ninja
610 # Prepare for GitLab pages deployment. Anything copied into the
611 # "public" directory will be deployed to $USER.gitlab.io/$PROJECT
612 pages:
613   image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
614   stage: test
615   needs:
616     - job: build-tools-and-docs-debian
617   script:
618     - mkdir -p public
619     # HTML-ised source tree
620     - make gtags
621     - htags -anT --tree-view=filetree -m qemu_init
622         -t "Welcome to the QEMU sourcecode"
623     - mv HTML public/src
624     # Project documentation
625     - mv build/docs/index.html public/
626     - for i in devel interop specs system tools user ; do mv build/docs/$i public/ ; done
627   artifacts:
628     paths:
629       - public