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