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