xref: /qemu/.gitlab-ci.d/buildtest.yml (revision c3bef3b4)
1include:
2  - local: '/.gitlab-ci.d/buildtest-template.yml'
3
4build-system-alpine:
5  extends: .native_build_job_template
6  needs:
7    - job: amd64-alpine-container
8  variables:
9    IMAGE: alpine
10    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
11      microblazeel-softmmu mips64el-softmmu
12    MAKE_CHECK_ARGS: check-build
13    CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
14  artifacts:
15    expire_in: 2 days
16    paths:
17      - .git-submodule-status
18      - build
19
20check-system-alpine:
21  extends: .native_test_job_template
22  needs:
23    - job: build-system-alpine
24      artifacts: true
25  variables:
26    IMAGE: alpine
27    MAKE_CHECK_ARGS: check-unit check-qtest
28
29avocado-system-alpine:
30  extends: .avocado_test_job_template
31  needs:
32    - job: build-system-alpine
33      artifacts: true
34  variables:
35    IMAGE: alpine
36    MAKE_CHECK_ARGS: check-avocado
37
38build-system-ubuntu:
39  extends: .native_build_job_template
40  needs:
41    job: amd64-ubuntu2004-container
42  variables:
43    IMAGE: ubuntu2004
44    CONFIGURE_ARGS: --enable-docs --enable-fdt=system --enable-capstone
45    TARGETS: aarch64-softmmu alpha-softmmu cris-softmmu hppa-softmmu
46      microblazeel-softmmu mips64el-softmmu
47    MAKE_CHECK_ARGS: check-build
48  artifacts:
49    expire_in: 2 days
50    paths:
51      - build
52
53check-system-ubuntu:
54  extends: .native_test_job_template
55  needs:
56    - job: build-system-ubuntu
57      artifacts: true
58  variables:
59    IMAGE: ubuntu2004
60    MAKE_CHECK_ARGS: check
61
62avocado-system-ubuntu:
63  extends: .avocado_test_job_template
64  needs:
65    - job: build-system-ubuntu
66      artifacts: true
67  variables:
68    IMAGE: ubuntu2004
69    MAKE_CHECK_ARGS: check-avocado
70
71build-system-debian:
72  extends: .native_build_job_template
73  needs:
74    job: amd64-debian-container
75  variables:
76    IMAGE: debian-amd64
77    TARGETS: arm-softmmu avr-softmmu i386-softmmu mipsel-softmmu
78      riscv64-softmmu sh4eb-softmmu sparc-softmmu xtensaeb-softmmu
79    MAKE_CHECK_ARGS: check-build
80  artifacts:
81    expire_in: 2 days
82    paths:
83      - build
84
85check-system-debian:
86  extends: .native_test_job_template
87  needs:
88    - job: build-system-debian
89      artifacts: true
90  variables:
91    IMAGE: debian-amd64
92    MAKE_CHECK_ARGS: check
93
94avocado-system-debian:
95  extends: .avocado_test_job_template
96  needs:
97    - job: build-system-debian
98      artifacts: true
99  variables:
100    IMAGE: debian-amd64
101    MAKE_CHECK_ARGS: check-avocado
102
103crash-test-debian:
104  extends: .native_test_job_template
105  needs:
106    - job: build-system-debian
107      artifacts: true
108  variables:
109    IMAGE: debian-amd64
110  script:
111    - cd build
112    - make check-venv
113    - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-i386
114
115build-system-fedora:
116  extends: .native_build_job_template
117  needs:
118    job: amd64-fedora-container
119  variables:
120    IMAGE: fedora
121    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs
122             --enable-fdt=system --enable-slirp --enable-capstone
123    TARGETS: tricore-softmmu microblaze-softmmu mips-softmmu
124      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
125    MAKE_CHECK_ARGS: check-build
126  artifacts:
127    expire_in: 2 days
128    paths:
129      - build
130
131check-system-fedora:
132  extends: .native_test_job_template
133  needs:
134    - job: build-system-fedora
135      artifacts: true
136  variables:
137    IMAGE: fedora
138    MAKE_CHECK_ARGS: check
139
140avocado-system-fedora:
141  extends: .avocado_test_job_template
142  needs:
143    - job: build-system-fedora
144      artifacts: true
145  variables:
146    IMAGE: fedora
147    MAKE_CHECK_ARGS: check-avocado
148
149crash-test-fedora:
150  extends: .native_test_job_template
151  needs:
152    - job: build-system-fedora
153      artifacts: true
154  variables:
155    IMAGE: fedora
156  script:
157    - cd build
158    - make check-venv
159    - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
160    - tests/venv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
161
162build-system-centos:
163  extends: .native_build_job_template
164  needs:
165    job: amd64-centos8-container
166  variables:
167    IMAGE: centos8
168    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-fdt=system
169      --enable-modules --enable-trace-backends=dtrace --enable-docs
170      --enable-vfio-user-server
171    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
172      x86_64-softmmu rx-softmmu sh4-softmmu nios2-softmmu
173    MAKE_CHECK_ARGS: check-build
174  artifacts:
175    expire_in: 2 days
176    paths:
177      - build
178
179check-system-centos:
180  extends: .native_test_job_template
181  needs:
182    - job: build-system-centos
183      artifacts: true
184  variables:
185    IMAGE: centos8
186    MAKE_CHECK_ARGS: check
187
188avocado-system-centos:
189  extends: .avocado_test_job_template
190  needs:
191    - job: build-system-centos
192      artifacts: true
193  variables:
194    IMAGE: centos8
195    MAKE_CHECK_ARGS: check-avocado
196
197build-system-opensuse:
198  extends: .native_build_job_template
199  needs:
200    job: amd64-opensuse-leap-container
201  variables:
202    IMAGE: opensuse-leap
203    CONFIGURE_ARGS: --enable-fdt=system
204    TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
205    MAKE_CHECK_ARGS: check-build
206  artifacts:
207    expire_in: 2 days
208    paths:
209      - build
210
211check-system-opensuse:
212  extends: .native_test_job_template
213  needs:
214    - job: build-system-opensuse
215      artifacts: true
216  variables:
217    IMAGE: opensuse-leap
218    MAKE_CHECK_ARGS: check
219
220avocado-system-opensuse:
221  extends: .avocado_test_job_template
222  needs:
223    - job: build-system-opensuse
224      artifacts: true
225  variables:
226    IMAGE: opensuse-leap
227    MAKE_CHECK_ARGS: check-avocado
228
229
230# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
231# the configure script. The container doesn't contain Xen headers so
232# Xen accelerator is not detected / selected. As result it build the
233# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
234# available.
235# Also use a different coroutine implementation (which is only really of
236# interest to KVM users, i.e. with TCG disabled)
237build-tcg-disabled:
238  extends: .native_build_job_template
239  needs:
240    job: amd64-centos8-container
241  variables:
242    IMAGE: centos8
243  script:
244    - mkdir build
245    - cd build
246    - ../configure --disable-tcg --audio-drv-list="" --with-coroutine=ucontext
247                   --disable-docs --disable-sdl --disable-gtk --disable-vnc
248      || { cat config.log meson-logs/meson-log.txt && exit 1; }
249    - make -j"$JOBS"
250    - make check-unit
251    - make check-qapi-schema
252    - cd tests/qemu-iotests/
253    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
254            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
255            170 171 183 184 192 194 208 221 226 227 236 253 277 image-fleecing
256    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
257            124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
258            208 209 216 218 227 234 246 247 248 250 254 255 257 258
259            260 261 262 263 264 270 272 273 277 279 image-fleecing
260
261build-user:
262  extends: .native_build_job_template
263  needs:
264    job: amd64-debian-user-cross-container
265  variables:
266    IMAGE: debian-all-test-cross
267    CONFIGURE_ARGS: --disable-tools --disable-system
268    MAKE_CHECK_ARGS: check-tcg
269
270build-user-static:
271  extends: .native_build_job_template
272  needs:
273    job: amd64-debian-user-cross-container
274  variables:
275    IMAGE: debian-all-test-cross
276    CONFIGURE_ARGS: --disable-tools --disable-system --static
277    MAKE_CHECK_ARGS: check-tcg
278
279build-user-hexagon:
280  extends: .native_build_job_template
281  needs:
282    job: hexagon-cross-container
283  variables:
284    IMAGE: debian-hexagon-cross
285    TARGETS: hexagon-linux-user
286    CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
287    MAKE_CHECK_ARGS: check-tcg
288
289# Only build the softmmu targets we have check-tcg tests for
290build-some-softmmu:
291  extends: .native_build_job_template
292  needs:
293    job: amd64-debian-user-cross-container
294  variables:
295    IMAGE: debian-all-test-cross
296    CONFIGURE_ARGS: --disable-tools --enable-debug
297    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
298    MAKE_CHECK_ARGS: check-tcg
299
300# We build tricore in a very minimal tricore only container
301build-tricore-softmmu:
302  extends: .native_build_job_template
303  needs:
304    job: tricore-debian-cross-container
305  variables:
306    IMAGE: debian-tricore-cross
307    CONFIGURE_ARGS: --disable-tools --disable-fdt --enable-debug
308    TARGETS: tricore-softmmu
309    MAKE_CHECK_ARGS: check-tcg
310
311clang-system:
312  extends: .native_build_job_template
313  needs:
314    job: amd64-fedora-container
315  variables:
316    IMAGE: fedora
317    CONFIGURE_ARGS: --cc=clang --cxx=clang++
318      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
319    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
320    MAKE_CHECK_ARGS: check-qtest check-tcg
321
322clang-user:
323  extends: .native_build_job_template
324  needs:
325    job: amd64-debian-user-cross-container
326  timeout: 70m
327  variables:
328    IMAGE: debian-all-test-cross
329    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
330      --target-list-exclude=microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
331      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
332    MAKE_CHECK_ARGS: check-unit check-tcg
333
334# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
335# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
336# triggers an Out-Of-Memory error
337#
338# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
339# CFI builds, and thus have to disable it here.
340#
341# Split in three sets of build/check/avocado to limit the execution time of each
342# job
343build-cfi-aarch64:
344  extends: .native_build_job_template
345  needs:
346  - job: amd64-fedora-container
347  variables:
348    LD_JOBS: 1
349    AR: llvm-ar
350    IMAGE: fedora
351    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
352      --enable-safe-stack --disable-slirp
353    TARGETS: aarch64-softmmu
354    MAKE_CHECK_ARGS: check-build
355    # FIXME: This job is often failing, likely due to out-of-memory problems in
356    # the constrained containers of the shared runners. Thus this is marked as
357    # skipped until the situation has been solved.
358    QEMU_JOB_SKIPPED: 1
359  timeout: 90m
360  artifacts:
361    expire_in: 2 days
362    paths:
363      - build
364
365check-cfi-aarch64:
366  extends: .native_test_job_template
367  needs:
368    - job: build-cfi-aarch64
369      artifacts: true
370  variables:
371    IMAGE: fedora
372    MAKE_CHECK_ARGS: check
373
374avocado-cfi-aarch64:
375  extends: .avocado_test_job_template
376  needs:
377    - job: build-cfi-aarch64
378      artifacts: true
379  variables:
380    IMAGE: fedora
381    MAKE_CHECK_ARGS: check-avocado
382
383build-cfi-ppc64-s390x:
384  extends: .native_build_job_template
385  needs:
386  - job: amd64-fedora-container
387  variables:
388    LD_JOBS: 1
389    AR: llvm-ar
390    IMAGE: fedora
391    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
392      --enable-safe-stack --disable-slirp
393    TARGETS: ppc64-softmmu s390x-softmmu
394    MAKE_CHECK_ARGS: check-build
395    # FIXME: This job is often failing, likely due to out-of-memory problems in
396    # the constrained containers of the shared runners. Thus this is marked as
397    # skipped until the situation has been solved.
398    QEMU_JOB_SKIPPED: 1
399  timeout: 80m
400  artifacts:
401    expire_in: 2 days
402    paths:
403      - build
404
405check-cfi-ppc64-s390x:
406  extends: .native_test_job_template
407  needs:
408    - job: build-cfi-ppc64-s390x
409      artifacts: true
410  variables:
411    IMAGE: fedora
412    MAKE_CHECK_ARGS: check
413
414avocado-cfi-ppc64-s390x:
415  extends: .avocado_test_job_template
416  needs:
417    - job: build-cfi-ppc64-s390x
418      artifacts: true
419  variables:
420    IMAGE: fedora
421    MAKE_CHECK_ARGS: check-avocado
422
423build-cfi-x86_64:
424  extends: .native_build_job_template
425  needs:
426  - job: amd64-fedora-container
427  variables:
428    LD_JOBS: 1
429    AR: llvm-ar
430    IMAGE: fedora
431    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
432      --enable-safe-stack --disable-slirp
433    TARGETS: x86_64-softmmu
434    MAKE_CHECK_ARGS: check-build
435  timeout: 70m
436  artifacts:
437    expire_in: 2 days
438    paths:
439      - build
440
441check-cfi-x86_64:
442  extends: .native_test_job_template
443  needs:
444    - job: build-cfi-x86_64
445      artifacts: true
446  variables:
447    IMAGE: fedora
448    MAKE_CHECK_ARGS: check
449
450avocado-cfi-x86_64:
451  extends: .avocado_test_job_template
452  needs:
453    - job: build-cfi-x86_64
454      artifacts: true
455  variables:
456    IMAGE: fedora
457    MAKE_CHECK_ARGS: check-avocado
458
459tsan-build:
460  extends: .native_build_job_template
461  needs:
462    job: amd64-ubuntu2004-container
463  variables:
464    IMAGE: ubuntu2004
465    CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
466          --enable-trace-backends=ust --enable-fdt=system --disable-slirp
467    TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
468    MAKE_CHECK_ARGS: bench V=1
469
470# gcov is a GCC features
471gcov:
472  extends: .native_build_job_template
473  needs:
474    job: amd64-ubuntu2004-container
475  timeout: 80m
476  variables:
477    IMAGE: ubuntu2004
478    CONFIGURE_ARGS: --enable-gcov
479    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
480    MAKE_CHECK_ARGS: check
481  after_script:
482    - cd build
483    - gcovr --xml-pretty --exclude-unreachable-branches --print-summary
484        -o coverage.xml --root ${CI_PROJECT_DIR} . *.p
485  coverage: /^\s*lines:\s*\d+.\d+\%/
486  artifacts:
487    name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
488    expire_in: 2 days
489    reports:
490      coverage_report:
491        coverage_format: cobertura
492        path: build/coverage.xml
493
494build-oss-fuzz:
495  extends: .native_build_job_template
496  needs:
497    job: amd64-fedora-container
498  variables:
499    IMAGE: fedora
500  script:
501    - mkdir build-oss-fuzz
502    - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt
503    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
504      ./scripts/oss-fuzz/build.sh
505    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
506    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
507                      | grep -v slirp); do
508        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
509        echo Testing ${fuzzer} ... ;
510        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
511      done
512
513build-tci:
514  extends: .native_build_job_template
515  needs:
516    job: amd64-debian-user-cross-container
517  variables:
518    IMAGE: debian-all-test-cross
519  script:
520    - TARGETS="aarch64 alpha arm hppa m68k microblaze ppc64 s390x x86_64"
521    - mkdir build
522    - cd build
523    - ../configure --enable-tcg-interpreter --disable-docs --disable-gtk --disable-vnc
524        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
525        || { cat config.log meson-logs/meson-log.txt && exit 1; }
526    - make -j"$JOBS"
527    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
528    - for tg in $TARGETS ; do
529        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
530        ./tests/qtest/boot-serial-test || exit 1 ;
531        ./tests/qtest/cdrom-test || exit 1 ;
532      done
533    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
534    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
535    - make check-tcg
536
537# Alternate coroutines implementations are only really of interest to KVM users
538# However we can't test against KVM on Gitlab-CI so we can only run unit tests
539build-coroutine-sigaltstack:
540  extends: .native_build_job_template
541  needs:
542    job: amd64-ubuntu2004-container
543  variables:
544    IMAGE: ubuntu2004
545    CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
546                    --enable-trace-backends=ftrace
547    MAKE_CHECK_ARGS: check-unit
548
549# Check our reduced build configurations
550build-without-defaults:
551  extends: .native_build_job_template
552  needs:
553    job: amd64-centos8-container
554  variables:
555    IMAGE: centos8
556    CONFIGURE_ARGS:
557      --without-default-devices
558      --without-default-features
559      --disable-fdt
560      --disable-pie
561      --disable-qom-cast-debug
562      --disable-strip
563    TARGETS: avr-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
564      sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user
565    MAKE_CHECK_ARGS: check-unit check-qtest-avr check-qtest-mips64
566
567build-libvhost-user:
568  extends: .base_job_template
569  stage: build
570  image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
571  needs:
572    job: amd64-fedora-container
573  script:
574    - mkdir subprojects/libvhost-user/build
575    - cd subprojects/libvhost-user/build
576    - meson
577    - ninja
578
579# No targets are built here, just tools, docs, and unit tests. This
580# also feeds into the eventual documentation deployment steps later
581build-tools-and-docs-debian:
582  extends: .native_build_job_template
583  needs:
584    job: amd64-debian-container
585    # when running on 'master' we use pre-existing container
586    optional: true
587  variables:
588    IMAGE: debian-amd64
589    MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
590    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
591    QEMU_JOB_PUBLISH: 1
592  artifacts:
593    expire_in: 2 days
594    paths:
595      - build
596
597# Prepare for GitLab pages deployment. Anything copied into the
598# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
599#
600# GitLab publishes from any branch that triggers a CI pipeline
601#
602# For the main repo we don't want to publish from 'staging'
603# since that content may not be pushed, nor do we wish to
604# publish from 'stable-NNN' branches as that content is outdated.
605# Thus we restrict to just the default branch
606#
607# For contributor forks we want to publish from any repo so
608# that users can see the results of their commits, regardless
609# of what topic branch they're currently using
610pages:
611  extends: .base_job_template
612  image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
613  stage: test
614  needs:
615    - job: build-tools-and-docs-debian
616  script:
617    - mkdir -p public
618    # HTML-ised source tree
619    - make gtags
620    - htags -anT --tree-view=filetree -m qemu_init
621        -t "Welcome to the QEMU sourcecode"
622    - mv HTML public/src
623    # Project documentation
624    - make -C build install DESTDIR=$(pwd)/temp-install
625    - mv temp-install/usr/local/share/doc/qemu/* public/
626  artifacts:
627    paths:
628      - public
629  variables:
630    QEMU_JOB_PUBLISH: 1
631