xref: /qemu/.gitlab-ci.d/buildtest.yml (revision fb72e779)
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      || { cat config.log meson-logs/meson-log.txt && exit 1; }
248    - make -j"$JOBS"
249    - make check-unit
250    - make check-qapi-schema
251    - cd tests/qemu-iotests/
252    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
253            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
254            170 171 183 184 192 194 208 221 226 227 236 253 277 image-fleecing
255    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
256            124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
257            208 209 216 218 227 234 246 247 248 250 254 255 257 258
258            260 261 262 263 264 270 272 273 277 279 image-fleecing
259
260build-user:
261  extends: .native_build_job_template
262  needs:
263    job: amd64-debian-user-cross-container
264  variables:
265    IMAGE: debian-all-test-cross
266    CONFIGURE_ARGS: --disable-tools --disable-system
267    MAKE_CHECK_ARGS: check-tcg
268
269build-user-static:
270  extends: .native_build_job_template
271  needs:
272    job: amd64-debian-user-cross-container
273  variables:
274    IMAGE: debian-all-test-cross
275    CONFIGURE_ARGS: --disable-tools --disable-system --static
276    MAKE_CHECK_ARGS: check-tcg
277
278# Because the hexagon cross-compiler takes so long to build we don't rely
279# on the CI system to build it and hence this job has an optional dependency
280# declared. The image is manually uploaded.
281build-user-hexagon:
282  extends: .native_build_job_template
283  needs:
284    job: hexagon-cross-container
285    optional: true
286  variables:
287    IMAGE: debian-hexagon-cross
288    TARGETS: hexagon-linux-user
289    CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
290    MAKE_CHECK_ARGS: check-tcg
291
292# Only build the softmmu targets we have check-tcg tests for
293build-some-softmmu:
294  extends: .native_build_job_template
295  needs:
296    job: amd64-debian-user-cross-container
297  variables:
298    IMAGE: debian-all-test-cross
299    CONFIGURE_ARGS: --disable-tools --enable-debug
300    TARGETS: xtensa-softmmu arm-softmmu aarch64-softmmu alpha-softmmu
301    MAKE_CHECK_ARGS: check-tcg
302
303# We build tricore in a very minimal tricore only container
304build-tricore-softmmu:
305  extends: .native_build_job_template
306  needs:
307    job: tricore-debian-cross-container
308  variables:
309    IMAGE: debian-tricore-cross
310    CONFIGURE_ARGS: --disable-tools --disable-fdt --enable-debug
311    TARGETS: tricore-softmmu
312    MAKE_CHECK_ARGS: check-tcg
313
314clang-system:
315  extends: .native_build_job_template
316  needs:
317    job: amd64-fedora-container
318  variables:
319    IMAGE: fedora
320    CONFIGURE_ARGS: --cc=clang --cxx=clang++
321      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
322    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu
323      ppc-softmmu s390x-softmmu
324    MAKE_CHECK_ARGS: check-qtest check-tcg
325
326clang-user:
327  extends: .native_build_job_template
328  needs:
329    job: amd64-debian-user-cross-container
330  timeout: 70m
331  variables:
332    IMAGE: debian-all-test-cross
333    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system
334      --target-list-exclude=microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
335      --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
336    MAKE_CHECK_ARGS: check-unit check-tcg
337
338# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
339# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
340# triggers an Out-Of-Memory error
341#
342# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
343# CFI builds, and thus have to disable it here.
344#
345# Split in three sets of build/check/avocado to limit the execution time of each
346# job
347build-cfi-aarch64:
348  extends: .native_build_job_template
349  needs:
350  - job: amd64-fedora-container
351  variables:
352    LD_JOBS: 1
353    AR: llvm-ar
354    IMAGE: fedora
355    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
356      --enable-safe-stack --disable-slirp
357    TARGETS: aarch64-softmmu
358    MAKE_CHECK_ARGS: check-build
359    # FIXME: This job is often failing, likely due to out-of-memory problems in
360    # the constrained containers of the shared runners. Thus this is marked as
361    # skipped until the situation has been solved.
362    QEMU_JOB_SKIPPED: 1
363  timeout: 90m
364  artifacts:
365    expire_in: 2 days
366    paths:
367      - build
368
369check-cfi-aarch64:
370  extends: .native_test_job_template
371  needs:
372    - job: build-cfi-aarch64
373      artifacts: true
374  variables:
375    IMAGE: fedora
376    MAKE_CHECK_ARGS: check
377
378avocado-cfi-aarch64:
379  extends: .avocado_test_job_template
380  needs:
381    - job: build-cfi-aarch64
382      artifacts: true
383  variables:
384    IMAGE: fedora
385    MAKE_CHECK_ARGS: check-avocado
386
387build-cfi-ppc64-s390x:
388  extends: .native_build_job_template
389  needs:
390  - job: amd64-fedora-container
391  variables:
392    LD_JOBS: 1
393    AR: llvm-ar
394    IMAGE: fedora
395    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
396      --enable-safe-stack --disable-slirp
397    TARGETS: ppc64-softmmu s390x-softmmu
398    MAKE_CHECK_ARGS: check-build
399    # FIXME: This job is often failing, likely due to out-of-memory problems in
400    # the constrained containers of the shared runners. Thus this is marked as
401    # skipped until the situation has been solved.
402    QEMU_JOB_SKIPPED: 1
403  timeout: 80m
404  artifacts:
405    expire_in: 2 days
406    paths:
407      - build
408
409check-cfi-ppc64-s390x:
410  extends: .native_test_job_template
411  needs:
412    - job: build-cfi-ppc64-s390x
413      artifacts: true
414  variables:
415    IMAGE: fedora
416    MAKE_CHECK_ARGS: check
417
418avocado-cfi-ppc64-s390x:
419  extends: .avocado_test_job_template
420  needs:
421    - job: build-cfi-ppc64-s390x
422      artifacts: true
423  variables:
424    IMAGE: fedora
425    MAKE_CHECK_ARGS: check-avocado
426
427build-cfi-x86_64:
428  extends: .native_build_job_template
429  needs:
430  - job: amd64-fedora-container
431  variables:
432    LD_JOBS: 1
433    AR: llvm-ar
434    IMAGE: fedora
435    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
436      --enable-safe-stack --disable-slirp
437    TARGETS: x86_64-softmmu
438    MAKE_CHECK_ARGS: check-build
439  timeout: 70m
440  artifacts:
441    expire_in: 2 days
442    paths:
443      - build
444
445check-cfi-x86_64:
446  extends: .native_test_job_template
447  needs:
448    - job: build-cfi-x86_64
449      artifacts: true
450  variables:
451    IMAGE: fedora
452    MAKE_CHECK_ARGS: check
453
454avocado-cfi-x86_64:
455  extends: .avocado_test_job_template
456  needs:
457    - job: build-cfi-x86_64
458      artifacts: true
459  variables:
460    IMAGE: fedora
461    MAKE_CHECK_ARGS: check-avocado
462
463tsan-build:
464  extends: .native_build_job_template
465  needs:
466    job: amd64-ubuntu2004-container
467  variables:
468    IMAGE: ubuntu2004
469    CONFIGURE_ARGS: --enable-tsan --cc=clang-10 --cxx=clang++-10
470          --enable-trace-backends=ust --enable-fdt=system --disable-slirp
471    TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
472    MAKE_CHECK_ARGS: bench V=1
473
474# gprof/gcov are GCC features
475build-gprof-gcov:
476  extends: .native_build_job_template
477  needs:
478    job: amd64-ubuntu2004-container
479  variables:
480    IMAGE: ubuntu2004
481    CONFIGURE_ARGS: --enable-gprof --enable-gcov
482    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
483  artifacts:
484    expire_in: 1 days
485    paths:
486      - build
487
488check-gprof-gcov:
489  extends: .native_test_job_template
490  needs:
491    - job: build-gprof-gcov
492      artifacts: true
493  variables:
494    IMAGE: ubuntu2004
495    MAKE_CHECK_ARGS: check
496  after_script:
497    - cd build
498    - gcovr --xml-pretty --exclude-unreachable-branches --print-summary
499        -o coverage.xml --root ${CI_PROJECT_DIR} . *.p
500  coverage: /^\s*lines:\s*\d+.\d+\%/
501  artifacts:
502    name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
503    expire_in: 2 days
504    reports:
505      coverage_report:
506        coverage_format: cobertura
507        path: build/coverage.xml
508
509build-oss-fuzz:
510  extends: .native_build_job_template
511  needs:
512    job: amd64-fedora-container
513  variables:
514    IMAGE: fedora
515  script:
516    - mkdir build-oss-fuzz
517    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
518      ./scripts/oss-fuzz/build.sh
519    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
520    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
521                      | grep -v slirp); do
522        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
523        echo Testing ${fuzzer} ... ;
524        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
525      done
526
527build-tci:
528  extends: .native_build_job_template
529  needs:
530    job: amd64-debian-user-cross-container
531  variables:
532    IMAGE: debian-all-test-cross
533  script:
534    - TARGETS="aarch64 alpha arm hppa m68k microblaze ppc64 s390x x86_64"
535    - mkdir build
536    - cd build
537    - ../configure --enable-tcg-interpreter
538        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
539    - make -j"$JOBS"
540    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
541    - for tg in $TARGETS ; do
542        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
543        ./tests/qtest/boot-serial-test || exit 1 ;
544        ./tests/qtest/cdrom-test || exit 1 ;
545      done
546    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
547    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
548    - make check-tcg
549
550# Alternate coroutines implementations are only really of interest to KVM users
551# However we can't test against KVM on Gitlab-CI so we can only run unit tests
552build-coroutine-sigaltstack:
553  extends: .native_build_job_template
554  needs:
555    job: amd64-ubuntu2004-container
556  variables:
557    IMAGE: ubuntu2004
558    CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
559                    --enable-trace-backends=ftrace
560    MAKE_CHECK_ARGS: check-unit
561
562# Check our reduced build configurations
563build-without-default-devices:
564  extends: .native_build_job_template
565  needs:
566    job: amd64-centos8-container
567  variables:
568    IMAGE: centos8
569    CONFIGURE_ARGS: --without-default-devices --disable-user
570
571build-without-default-features:
572  extends: .native_build_job_template
573  needs:
574    job: amd64-fedora-container
575  variables:
576    IMAGE: fedora
577    CONFIGURE_ARGS:
578      --without-default-features
579      --disable-capstone
580      --disable-pie
581      --disable-qom-cast-debug
582      --disable-strip
583    TARGETS: avr-softmmu i386-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
584      sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user
585    MAKE_CHECK_ARGS: check-unit check-qtest SPEED=slow
586
587build-libvhost-user:
588  extends: .base_job_template
589  stage: build
590  image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
591  needs:
592    job: amd64-fedora-container
593  script:
594    - mkdir subprojects/libvhost-user/build
595    - cd subprojects/libvhost-user/build
596    - meson
597    - ninja
598
599# No targets are built here, just tools, docs, and unit tests. This
600# also feeds into the eventual documentation deployment steps later
601build-tools-and-docs-debian:
602  extends: .native_build_job_template
603  needs:
604    job: amd64-debian-container
605    # when running on 'master' we use pre-existing container
606    optional: true
607  variables:
608    IMAGE: debian-amd64
609    MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
610    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
611    QEMU_JOB_PUBLISH: 1
612  artifacts:
613    expire_in: 2 days
614    paths:
615      - build
616
617# Prepare for GitLab pages deployment. Anything copied into the
618# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
619#
620# GitLab publishes from any branch that triggers a CI pipeline
621#
622# For the main repo we don't want to publish from 'staging'
623# since that content may not be pushed, nor do we wish to
624# publish from 'stable-NNN' branches as that content is outdated.
625# Thus we restrict to just the default branch
626#
627# For contributor forks we want to publish from any repo so
628# that users can see the results of their commits, regardless
629# of what topic branch they're currently using
630pages:
631  extends: .base_job_template
632  image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
633  stage: test
634  needs:
635    - job: build-tools-and-docs-debian
636  script:
637    - mkdir -p public
638    # HTML-ised source tree
639    - make gtags
640    - htags -anT --tree-view=filetree -m qemu_init
641        -t "Welcome to the QEMU sourcecode"
642    - mv HTML public/src
643    # Project documentation
644    - make -C build install DESTDIR=$(pwd)/temp-install
645    - mv temp-install/usr/local/share/doc/qemu/* public/
646  artifacts:
647    paths:
648      - public
649  variables:
650    QEMU_JOB_PUBLISH: 1
651