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