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