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