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