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