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