xref: /openbmc/qemu/.gitlab-ci.d/buildtest.yml (revision 6a094d62)
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
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# These targets are on the way out
477build-deprecated:
478  extends: .native_build_job_template
479  needs:
480    job: amd64-debian-user-cross-container
481  variables:
482    IMAGE: debian-all-test-cross
483    CONFIGURE_ARGS: --disable-tools
484    MAKE_CHECK_ARGS: build-tcg
485    TARGETS: ppc64abi32-linux-user
486  artifacts:
487    expire_in: 2 days
488    paths:
489      - build
490
491# We split the check-tcg step as test failures are expected but we still
492# want to catch the build breaking.
493check-deprecated:
494  extends: .native_test_job_template
495  needs:
496    - job: build-deprecated
497      artifacts: true
498  variables:
499    IMAGE: debian-all-test-cross
500    MAKE_CHECK_ARGS: check-tcg
501  allow_failure: true
502
503# gprof/gcov are GCC features
504build-gprof-gcov:
505  extends: .native_build_job_template
506  needs:
507    job: amd64-ubuntu2004-container
508  variables:
509    IMAGE: ubuntu2004
510    CONFIGURE_ARGS: --enable-gprof --enable-gcov
511    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
512  artifacts:
513    expire_in: 1 days
514    paths:
515      - build
516
517check-gprof-gcov:
518  extends: .native_test_job_template
519  needs:
520    - job: build-gprof-gcov
521      artifacts: true
522  variables:
523    IMAGE: ubuntu2004
524    MAKE_CHECK_ARGS: check
525  after_script:
526    - ${CI_PROJECT_DIR}/scripts/ci/coverage-summary.sh
527
528build-oss-fuzz:
529  extends: .native_build_job_template
530  needs:
531    job: amd64-fedora-container
532  variables:
533    IMAGE: fedora
534  script:
535    - mkdir build-oss-fuzz
536    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
537      ./scripts/oss-fuzz/build.sh
538    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
539    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
540                      | grep -v slirp); do
541        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
542        echo Testing ${fuzzer} ... ;
543        "${fuzzer}" -runs=1 -seed=1 || exit 1 ;
544      done
545    # Unrelated to fuzzer: run some tests with -fsanitize=address
546    - cd build-oss-fuzz && make check-qtest-i386 check-unit
547
548build-tci:
549  extends: .native_build_job_template
550  needs:
551    job: amd64-debian-user-cross-container
552  variables:
553    IMAGE: debian-all-test-cross
554  script:
555    - TARGETS="aarch64 alpha arm hppa m68k microblaze ppc64 s390x x86_64"
556    - mkdir build
557    - cd build
558    - ../configure --enable-tcg-interpreter
559        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)" || { cat config.log meson-logs/meson-log.txt && exit 1; }
560    - make -j"$JOBS"
561    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
562    - for tg in $TARGETS ; do
563        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
564        ./tests/qtest/boot-serial-test || exit 1 ;
565        ./tests/qtest/cdrom-test || exit 1 ;
566      done
567    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
568    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
569    - make check-tcg
570
571# Alternate coroutines implementations are only really of interest to KVM users
572# However we can't test against KVM on Gitlab-CI so we can only run unit tests
573build-coroutine-sigaltstack:
574  extends: .native_build_job_template
575  needs:
576    job: amd64-ubuntu2004-container
577  variables:
578    IMAGE: ubuntu2004
579    CONFIGURE_ARGS: --with-coroutine=sigaltstack --disable-tcg
580                    --enable-trace-backends=ftrace
581    MAKE_CHECK_ARGS: check-unit
582
583# Check our reduced build configurations
584build-without-default-devices:
585  extends: .native_build_job_template
586  needs:
587    job: amd64-centos8-container
588  variables:
589    IMAGE: centos8
590    CONFIGURE_ARGS: --without-default-devices --disable-user
591
592build-without-default-features:
593  extends: .native_build_job_template
594  needs:
595    job: amd64-fedora-container
596  variables:
597    IMAGE: fedora
598    CONFIGURE_ARGS:
599      --without-default-features
600      --disable-capstone
601      --disable-pie
602      --disable-qom-cast-debug
603      --disable-slirp
604      --disable-strip
605    TARGETS: avr-softmmu i386-softmmu mips64-softmmu s390x-softmmu sh4-softmmu
606      sparc64-softmmu hexagon-linux-user i386-linux-user s390x-linux-user
607    MAKE_CHECK_ARGS: check-unit check-qtest SPEED=slow
608
609build-libvhost-user:
610  stage: build
611  image: $CI_REGISTRY_IMAGE/qemu/fedora:latest
612  needs:
613    job: amd64-fedora-container
614  script:
615    - mkdir subprojects/libvhost-user/build
616    - cd subprojects/libvhost-user/build
617    - meson
618    - ninja
619
620# No targets are built here, just tools, docs, and unit tests. This
621# also feeds into the eventual documentation deployment steps later
622build-tools-and-docs-debian:
623  extends: .native_build_job_template
624  needs:
625    job: amd64-debian-container
626  variables:
627    IMAGE: debian-amd64
628    MAKE_CHECK_ARGS: check-unit check-softfloat ctags TAGS cscope
629    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
630  artifacts:
631    expire_in: 2 days
632    paths:
633      - build
634
635# Prepare for GitLab pages deployment. Anything copied into the
636# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
637#
638# GitLab publishes from any branch that triggers a CI pipeline
639#
640# For the main repo we don't want to publish from 'staging'
641# since that content may not be pushed, nor do we wish to
642# publish from 'stable-NNN' branches as that content is outdated.
643# Thus we restrict to just the default branch
644#
645# For contributor forks we want to publish from any repo so
646# that users can see the results of their commits, regardless
647# of what topic branch they're currently using
648pages:
649  image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest
650  stage: test
651  needs:
652    - job: build-tools-and-docs-debian
653  script:
654    - mkdir -p public
655    # HTML-ised source tree
656    - make gtags
657    - htags -anT --tree-view=filetree -m qemu_init
658        -t "Welcome to the QEMU sourcecode"
659    - mv HTML public/src
660    # Project documentation
661    - make -C build install DESTDIR=$(pwd)/temp-install
662    - mv temp-install/usr/local/share/doc/qemu/* public/
663  artifacts:
664    paths:
665      - public
666  rules:
667    - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
668      when: on_success
669    - if: '$CI_PROJECT_NAMESPACE == "qemu-project"'
670      when: never
671    - if: '$CI_PROJECT_NAMESPACE != "qemu-project"'
672      when: on_success
673