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