xref: /qemu/.gitlab-ci.d/buildtest.yml (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
1include:
2  - local: '/.gitlab-ci.d/buildtest-template.yml'
3
4build-system-alpine:
5  extends:
6    - .native_build_job_template
7    - .native_build_artifact_template
8  needs:
9    - job: amd64-alpine-container
10  variables:
11    IMAGE: alpine
12    TARGETS: avr-softmmu loongarch64-softmmu mips64-softmmu mipsel-softmmu
13    MAKE_CHECK_ARGS: check-build
14    CONFIGURE_ARGS: --enable-docs --enable-trace-backends=log,simple,syslog
15
16check-system-alpine:
17  extends: .native_test_job_template
18  needs:
19    - job: build-system-alpine
20      artifacts: true
21  variables:
22    IMAGE: alpine
23    MAKE_CHECK_ARGS: check-unit check-qtest
24
25functional-system-alpine:
26  extends: .functional_test_job_template
27  needs:
28    - job: build-system-alpine
29      artifacts: true
30  variables:
31    IMAGE: alpine
32    MAKE_CHECK_ARGS: check-avocado check-functional
33    AVOCADO_TAGS: arch:avr arch:loongarch64 arch:mips64 arch:mipsel
34
35build-system-ubuntu:
36  extends:
37    - .native_build_job_template
38    - .native_build_artifact_template
39  needs:
40    job: amd64-ubuntu2204-container
41  variables:
42    IMAGE: ubuntu2204
43    CONFIGURE_ARGS: --enable-docs --enable-rust
44    TARGETS: alpha-softmmu microblazeel-softmmu mips64el-softmmu
45    MAKE_CHECK_ARGS: check-build
46
47check-system-ubuntu:
48  extends: .native_test_job_template
49  needs:
50    - job: build-system-ubuntu
51      artifacts: true
52  variables:
53    IMAGE: ubuntu2204
54    MAKE_CHECK_ARGS: check
55
56functional-system-ubuntu:
57  extends: .functional_test_job_template
58  needs:
59    - job: build-system-ubuntu
60      artifacts: true
61  variables:
62    IMAGE: ubuntu2204
63    MAKE_CHECK_ARGS: check-avocado check-functional
64    AVOCADO_TAGS: arch:alpha arch:microblazeel arch:mips64el
65
66build-system-debian:
67  extends:
68    - .native_build_job_template
69    - .native_build_artifact_template
70  needs:
71    job: amd64-debian-container
72  variables:
73    IMAGE: debian
74    CONFIGURE_ARGS: --with-coroutine=sigaltstack --enable-rust
75    TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu
76      sparc-softmmu xtensa-softmmu
77    MAKE_CHECK_ARGS: check-build
78
79check-system-debian:
80  extends: .native_test_job_template
81  needs:
82    - job: build-system-debian
83      artifacts: true
84  variables:
85    IMAGE: debian
86    MAKE_CHECK_ARGS: check
87
88functional-system-debian:
89  extends: .functional_test_job_template
90  needs:
91    - job: build-system-debian
92      artifacts: true
93  variables:
94    IMAGE: debian
95    MAKE_CHECK_ARGS: check-avocado check-functional
96    AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch:xtensa
97
98crash-test-debian:
99  extends: .native_test_job_template
100  needs:
101    - job: build-system-debian
102      artifacts: true
103  variables:
104    IMAGE: debian
105  script:
106    - cd build
107    - make NINJA=":" check-venv
108    - pyvenv/bin/python3 scripts/device-crash-test -q --tcg-only ./qemu-system-i386
109
110build-system-fedora:
111  extends:
112    - .native_build_job_template
113    - .native_build_artifact_template
114  needs:
115    job: amd64-fedora-container
116  variables:
117    IMAGE: fedora
118    CONFIGURE_ARGS: --disable-gcrypt --enable-nettle --enable-docs --enable-crypto-afalg --enable-rust
119    TARGETS: microblaze-softmmu mips-softmmu
120      xtensa-softmmu m68k-softmmu riscv32-softmmu ppc-softmmu sparc64-softmmu
121    MAKE_CHECK_ARGS: check-build
122
123build-system-fedora-rust-nightly:
124  extends:
125    - .native_build_job_template
126    - .native_build_artifact_template
127  needs:
128    job: amd64-fedora-rust-nightly-container
129  variables:
130    IMAGE: fedora-rust-nightly
131    CONFIGURE_ARGS: --disable-docs --enable-rust --enable-strict-rust-lints
132    TARGETS: aarch64-softmmu
133    MAKE_CHECK_ARGS: check-build
134  after_script:
135    - source scripts/ci/gitlab-ci-section
136    - section_start test "Running Rust doctests"
137    - cd build
138    - pyvenv/bin/meson devenv -w ../rust ${CARGO-cargo} test --doc -p qemu_api
139
140  allow_failure: true
141
142check-system-fedora:
143  extends: .native_test_job_template
144  needs:
145    - job: build-system-fedora
146      artifacts: true
147  variables:
148    IMAGE: fedora
149    MAKE_CHECK_ARGS: check
150
151functional-system-fedora:
152  extends: .functional_test_job_template
153  needs:
154    - job: build-system-fedora
155      artifacts: true
156  variables:
157    IMAGE: fedora
158    MAKE_CHECK_ARGS: check-avocado check-functional
159    AVOCADO_TAGS: arch:microblaze arch:mips arch:xtensa arch:m68k
160      arch:riscv32 arch:ppc arch:sparc64
161
162crash-test-fedora:
163  extends: .native_test_job_template
164  needs:
165    - job: build-system-fedora
166      artifacts: true
167  variables:
168    IMAGE: fedora
169  script:
170    - cd build
171    - make NINJA=":" check-venv
172    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-ppc
173    - pyvenv/bin/python3 scripts/device-crash-test -q ./qemu-system-riscv32
174
175build-system-centos:
176  extends:
177    - .native_build_job_template
178    - .native_build_artifact_template
179  needs:
180    job: amd64-centos9-container
181  variables:
182    IMAGE: centos9
183    CONFIGURE_ARGS: --disable-nettle --enable-gcrypt --enable-vfio-user-server
184      --enable-modules --enable-trace-backends=dtrace --enable-docs
185    TARGETS: ppc64-softmmu or1k-softmmu s390x-softmmu
186      x86_64-softmmu rx-softmmu sh4-softmmu
187    MAKE_CHECK_ARGS: check-build
188
189# Previous QEMU release. Used for cross-version migration tests.
190build-previous-qemu:
191  extends: .native_build_job_template
192  artifacts:
193    when: on_success
194    expire_in: 2 days
195    paths:
196      - build-previous
197    exclude:
198      - build-previous/**/*.p
199      - build-previous/**/*.a.p
200      - build-previous/**/*.c.o
201      - build-previous/**/*.c.o.d
202  needs:
203    job: amd64-opensuse-leap-container
204  variables:
205    IMAGE: opensuse-leap
206    TARGETS: x86_64-softmmu aarch64-softmmu
207    # Override the default flags as we need more to grab the old version
208    GIT_FETCH_EXTRA_FLAGS: --prune --quiet
209  before_script:
210    - source scripts/ci/gitlab-ci-section
211    - export QEMU_PREV_VERSION="$(sed 's/\([0-9.]*\)\.[0-9]*/v\1.0/' VERSION)"
212    - git remote add upstream https://gitlab.com/qemu-project/qemu
213    - git fetch upstream refs/tags/$QEMU_PREV_VERSION:refs/tags/$QEMU_PREV_VERSION
214    - git checkout $QEMU_PREV_VERSION
215  after_script:
216    - mv build build-previous
217
218.migration-compat-common:
219  extends: .common_test_job_template
220  needs:
221    - job: build-previous-qemu
222    - job: build-system-opensuse
223  # The old QEMU could have bugs unrelated to migration that are
224  # already fixed in the current development branch, so this test
225  # might fail.
226  allow_failure: true
227  variables:
228    IMAGE: opensuse-leap
229    MAKE_CHECK_ARGS: check-build
230  script:
231    # Use the migration-tests from the older QEMU tree. This avoids
232    # testing an old QEMU against new features/tests that it is not
233    # compatible with.
234    - cd build-previous
235    # Don't allow python-based tests to run. The
236    # vmstate-checker-script test has a race that causes it to fail
237    # sometimes. It cannot be fixed it because this job runs the test
238    # from the old QEMU version. The test will be removed on master,
239    # but this job will only see the change in the next release.
240    #
241    # TODO: remove this line after 9.2 release
242    - unset PYTHON
243    # old to new
244    - QTEST_QEMU_BINARY_SRC=./qemu-system-${TARGET}
245          QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
246    # new to old
247    - QTEST_QEMU_BINARY_DST=./qemu-system-${TARGET}
248          QTEST_QEMU_BINARY=../build/qemu-system-${TARGET} ./tests/qtest/migration-test
249
250# This job needs to be disabled until we can have an aarch64 CPU model that
251# will both (1) support both KVM and TCG, and (2) provide a stable ABI.
252# Currently only "-cpu max" can provide (1), however it doesn't guarantee
253# (2).  Mark this test skipped until later.
254migration-compat-aarch64:
255  extends: .migration-compat-common
256  variables:
257    TARGET: aarch64
258    QEMU_JOB_SKIPPED: 1
259
260migration-compat-x86_64:
261  extends: .migration-compat-common
262  variables:
263    TARGET: x86_64
264
265check-system-centos:
266  extends: .native_test_job_template
267  needs:
268    - job: build-system-centos
269      artifacts: true
270  variables:
271    IMAGE: centos9
272    MAKE_CHECK_ARGS: check
273
274functional-system-centos:
275  extends: .functional_test_job_template
276  needs:
277    - job: build-system-centos
278      artifacts: true
279  variables:
280    IMAGE: centos9
281    MAKE_CHECK_ARGS: check-avocado check-functional
282    AVOCADO_TAGS: arch:ppc64 arch:or1k arch:s390x arch:x86_64 arch:rx
283      arch:sh4
284
285build-system-opensuse:
286  extends:
287    - .native_build_job_template
288    - .native_build_artifact_template
289  needs:
290    job: amd64-opensuse-leap-container
291  variables:
292    IMAGE: opensuse-leap
293    TARGETS: s390x-softmmu x86_64-softmmu aarch64-softmmu
294    MAKE_CHECK_ARGS: check-build
295
296check-system-opensuse:
297  extends: .native_test_job_template
298  needs:
299    - job: build-system-opensuse
300      artifacts: true
301  variables:
302    IMAGE: opensuse-leap
303    MAKE_CHECK_ARGS: check
304
305functional-system-opensuse:
306  extends: .functional_test_job_template
307  needs:
308    - job: build-system-opensuse
309      artifacts: true
310  variables:
311    IMAGE: opensuse-leap
312    MAKE_CHECK_ARGS: check-avocado check-functional
313    AVOCADO_TAGS: arch:s390x arch:x86_64 arch:aarch64
314
315#
316# Flaky tests. We don't run these by default and they are allow fail
317# but often the CI system is the only way to trigger the failures.
318#
319
320build-system-flaky:
321  extends:
322    - .native_build_job_template
323    - .native_build_artifact_template
324  needs:
325    job: amd64-debian-container
326  variables:
327    IMAGE: debian
328    QEMU_JOB_OPTIONAL: 1
329    TARGETS: aarch64-softmmu arm-softmmu mips64el-softmmu
330      ppc64-softmmu rx-softmmu s390x-softmmu sh4-softmmu x86_64-softmmu
331    MAKE_CHECK_ARGS: check-build
332
333functional-system-flaky:
334  extends: .functional_test_job_template
335  needs:
336    - job: build-system-flaky
337      artifacts: true
338  allow_failure: true
339  variables:
340    IMAGE: debian
341    MAKE_CHECK_ARGS: check-avocado check-functional
342    QEMU_JOB_OPTIONAL: 1
343    QEMU_TEST_FLAKY_TESTS: 1
344    AVOCADO_TAGS: flaky
345
346# This jobs explicitly disable TCG (--disable-tcg), KVM is detected by
347# the configure script. The container doesn't contain Xen headers so
348# Xen accelerator is not detected / selected. As result it build the
349# i386-softmmu and x86_64-softmmu with KVM being the single accelerator
350# available.
351# Also use a different coroutine implementation (which is only really of
352# interest to KVM users, i.e. with TCG disabled)
353build-tcg-disabled:
354  extends: .native_build_job_template
355  needs:
356    job: amd64-centos9-container
357  variables:
358    IMAGE: centos9
359  script:
360    - mkdir build
361    - cd build
362    - ../configure --disable-tcg --audio-drv-list="" --with-coroutine=ucontext
363                   --disable-docs --disable-sdl --disable-gtk --disable-vnc
364      || { cat config.log meson-logs/meson-log.txt && exit 1; }
365    - make -j"$JOBS"
366    - make check-unit
367    - make check-qapi-schema
368    - cd tests/qemu-iotests/
369    - ./check -raw 001 002 003 004 005 008 009 010 011 012 021 025 032 033 048
370            052 063 077 086 101 104 106 113 148 150 151 152 157 159 160 163
371            170 171 184 192 194 208 221 226 227 236 253 277 image-fleecing
372    - ./check -qcow2 028 051 056 057 058 065 068 082 085 091 095 096 102 122
373            124 132 139 142 144 145 151 152 155 157 165 194 196 200 202
374            208 209 216 218 227 234 246 247 248 250 254 255 257 258
375            260 261 262 263 264 270 272 273 277 279 image-fleecing
376    - cd ../..
377    - make distclean
378
379build-user:
380  extends: .native_build_job_template
381  needs:
382    job: amd64-debian-user-cross-container
383  variables:
384    IMAGE: debian-all-test-cross
385    CONFIGURE_ARGS: --disable-tools --disable-system
386      --target-list-exclude=alpha-linux-user,sh4-linux-user
387    MAKE_CHECK_ARGS: check-tcg
388
389build-user-static:
390  extends: .native_build_job_template
391  needs:
392    job: amd64-debian-user-cross-container
393  variables:
394    IMAGE: debian-all-test-cross
395    CONFIGURE_ARGS: --disable-tools --disable-system --static
396      --target-list-exclude=alpha-linux-user,sh4-linux-user
397    MAKE_CHECK_ARGS: check-tcg
398
399# targets stuck on older compilers
400build-legacy:
401  extends: .native_build_job_template
402  needs:
403    job: amd64-debian-legacy-cross-container
404  variables:
405    IMAGE: debian-legacy-test-cross
406    TARGETS: alpha-linux-user alpha-softmmu sh4-linux-user
407    CONFIGURE_ARGS: --disable-tools
408    MAKE_CHECK_ARGS: check-tcg
409
410build-user-hexagon:
411  extends: .native_build_job_template
412  needs:
413    job: hexagon-cross-container
414  variables:
415    IMAGE: debian-hexagon-cross
416    TARGETS: hexagon-linux-user
417    CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
418    MAKE_CHECK_ARGS: check-tcg
419
420# Build the softmmu targets we have check-tcg tests and compilers in
421# our omnibus all-test-cross container. Those targets that haven't got
422# Debian cross compiler support need to use special containers.
423build-some-softmmu:
424  extends: .native_build_job_template
425  needs:
426    job: amd64-debian-user-cross-container
427  variables:
428    IMAGE: debian-all-test-cross
429    CONFIGURE_ARGS: --disable-tools --enable-debug
430    TARGETS: arm-softmmu aarch64-softmmu i386-softmmu riscv64-softmmu
431      s390x-softmmu x86_64-softmmu
432    MAKE_CHECK_ARGS: check-tcg
433
434build-loongarch64:
435  extends: .native_build_job_template
436  needs:
437    job: loongarch-debian-cross-container
438  variables:
439    IMAGE: debian-loongarch-cross
440    CONFIGURE_ARGS: --disable-tools --enable-debug
441    TARGETS: loongarch64-linux-user loongarch64-softmmu
442    MAKE_CHECK_ARGS: check-tcg
443
444# We build tricore in a very minimal tricore only container
445build-tricore-softmmu:
446  extends: .native_build_job_template
447  needs:
448    job: tricore-debian-cross-container
449  variables:
450    IMAGE: debian-tricore-cross
451    CONFIGURE_ARGS: --disable-tools --disable-fdt --enable-debug
452    TARGETS: tricore-softmmu
453    MAKE_CHECK_ARGS: check-tcg
454
455clang-system:
456  extends: .native_build_job_template
457  needs:
458    job: amd64-fedora-container
459  variables:
460    IMAGE: fedora
461    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-ubsan
462      --extra-cflags=-fno-sanitize-recover=undefined
463    TARGETS: alpha-softmmu arm-softmmu m68k-softmmu mips64-softmmu s390x-softmmu
464    MAKE_CHECK_ARGS: check-qtest check-tcg
465
466clang-user:
467  extends: .native_build_job_template
468  needs:
469    job: amd64-debian-user-cross-container
470  timeout: 70m
471  variables:
472    IMAGE: debian-all-test-cross
473    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --disable-system --enable-ubsan
474      --target-list-exclude=alpha-linux-user,microblazeel-linux-user,aarch64_be-linux-user,i386-linux-user,m68k-linux-user,mipsn32el-linux-user,xtensaeb-linux-user
475      --extra-cflags=-fno-sanitize-recover=undefined
476    MAKE_CHECK_ARGS: check-unit check-tcg
477
478# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
479# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
480# triggers an Out-Of-Memory error
481#
482# Since slirp callbacks are used in QEMU Timers, we cannot use libslirp with
483# CFI builds, and thus have to disable it here.
484#
485# Split in three sets of build/check/avocado to limit the execution time of each
486# job
487build-cfi-aarch64:
488  extends:
489    - .native_build_job_template
490    - .native_build_artifact_template
491  needs:
492  - job: amd64-fedora-container
493  variables:
494    LD_JOBS: 1
495    AR: llvm-ar
496    IMAGE: fedora
497    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
498      --enable-safe-stack --disable-slirp
499    TARGETS: aarch64-softmmu
500    MAKE_CHECK_ARGS: check-build
501    # FIXME: This job is often failing, likely due to out-of-memory problems in
502    # the constrained containers of the shared runners. Thus this is marked as
503    # skipped until the situation has been solved.
504    QEMU_JOB_SKIPPED: 1
505  timeout: 90m
506
507check-cfi-aarch64:
508  extends: .native_test_job_template
509  needs:
510    - job: build-cfi-aarch64
511      artifacts: true
512  variables:
513    IMAGE: fedora
514    MAKE_CHECK_ARGS: check
515
516functional-cfi-aarch64:
517  extends: .functional_test_job_template
518  needs:
519    - job: build-cfi-aarch64
520      artifacts: true
521  variables:
522    IMAGE: fedora
523    MAKE_CHECK_ARGS: check-avocado check-functional
524
525build-cfi-ppc64-s390x:
526  extends:
527    - .native_build_job_template
528    - .native_build_artifact_template
529  needs:
530  - job: amd64-fedora-container
531  variables:
532    LD_JOBS: 1
533    AR: llvm-ar
534    IMAGE: fedora
535    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
536      --enable-safe-stack --disable-slirp
537    TARGETS: ppc64-softmmu s390x-softmmu
538    MAKE_CHECK_ARGS: check-build
539    # FIXME: This job is often failing, likely due to out-of-memory problems in
540    # the constrained containers of the shared runners. Thus this is marked as
541    # skipped until the situation has been solved.
542    QEMU_JOB_SKIPPED: 1
543  timeout: 80m
544
545check-cfi-ppc64-s390x:
546  extends: .native_test_job_template
547  needs:
548    - job: build-cfi-ppc64-s390x
549      artifacts: true
550  variables:
551    IMAGE: fedora
552    MAKE_CHECK_ARGS: check
553
554functional-cfi-ppc64-s390x:
555  extends: .functional_test_job_template
556  needs:
557    - job: build-cfi-ppc64-s390x
558      artifacts: true
559  variables:
560    IMAGE: fedora
561    MAKE_CHECK_ARGS: check-avocado check-functional
562
563build-cfi-x86_64:
564  extends:
565    - .native_build_job_template
566    - .native_build_artifact_template
567  needs:
568  - job: amd64-fedora-container
569  variables:
570    LD_JOBS: 1
571    AR: llvm-ar
572    IMAGE: fedora
573    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
574      --enable-safe-stack --disable-slirp
575    TARGETS: x86_64-softmmu
576    MAKE_CHECK_ARGS: check-build
577  timeout: 70m
578
579check-cfi-x86_64:
580  extends: .native_test_job_template
581  needs:
582    - job: build-cfi-x86_64
583      artifacts: true
584  variables:
585    IMAGE: fedora
586    MAKE_CHECK_ARGS: check
587
588functional-cfi-x86_64:
589  extends: .functional_test_job_template
590  needs:
591    - job: build-cfi-x86_64
592      artifacts: true
593  variables:
594    IMAGE: fedora
595    MAKE_CHECK_ARGS: check-avocado check-functional
596
597tsan-build:
598  extends: .native_build_job_template
599  needs:
600    job: amd64-ubuntu2204-container
601  variables:
602    IMAGE: ubuntu2204
603    CONFIGURE_ARGS: --enable-tsan --cc=clang --cxx=clang++
604          --enable-trace-backends=ust --disable-slirp
605    TARGETS: x86_64-softmmu ppc64-softmmu riscv64-softmmu x86_64-linux-user
606    # Remove when we switch to a distro with clang >= 18
607    # https://github.com/google/sanitizers/issues/1716
608    MAKE: setarch -R make
609
610# gcov is a GCC features
611gcov:
612  extends: .native_build_job_template
613  needs:
614    job: amd64-ubuntu2204-container
615  timeout: 80m
616  variables:
617    IMAGE: ubuntu2204
618    CONFIGURE_ARGS: --enable-gcov
619    TARGETS: aarch64-softmmu ppc64-softmmu s390x-softmmu x86_64-softmmu
620    MAKE_CHECK_ARGS: check-unit check-softfloat
621  after_script:
622    - cd build
623    - gcovr --xml-pretty --exclude-unreachable-branches --print-summary
624        -o coverage.xml --root ${CI_PROJECT_DIR} . *.p
625  coverage: /^\s*lines:\s*\d+.\d+\%/
626  artifacts:
627    name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
628    when: always
629    expire_in: 2 days
630    paths:
631      - build/meson-logs/testlog.txt
632    reports:
633      junit: build/meson-logs/testlog.junit.xml
634      coverage_report:
635        coverage_format: cobertura
636        path: build/coverage.xml
637
638build-oss-fuzz:
639  extends: .native_build_job_template
640  needs:
641    job: amd64-fedora-container
642  variables:
643    IMAGE: fedora
644  script:
645    - mkdir build-oss-fuzz
646    - export LSAN_OPTIONS=suppressions=scripts/oss-fuzz/lsan_suppressions.txt
647    - CC="clang" CXX="clang++" CFLAGS="-fsanitize=address"
648      ./scripts/oss-fuzz/build.sh
649    - export ASAN_OPTIONS="fast_unwind_on_malloc=0"
650    - failures=0
651    - for fuzzer in $(find ./build-oss-fuzz/DEST_DIR/ -executable -type f
652                      | grep -v slirp); do
653        grep "LLVMFuzzerTestOneInput" ${fuzzer} > /dev/null 2>&1 || continue ;
654        echo Testing ${fuzzer} ... ;
655        "${fuzzer}" -runs=1 -seed=1 || { echo "FAILED:"" ${fuzzer} exit code is $?"; failures=$(($failures+1)); };
656      done
657    - echo "Number of failures:"" $failures"
658    - test $failures = 0
659
660build-tci:
661  extends: .native_build_job_template
662  needs:
663    job: amd64-debian-user-cross-container
664  variables:
665    IMAGE: debian-all-test-cross
666  script:
667    - TARGETS="aarch64 arm hppa m68k microblaze ppc64 s390x x86_64"
668    - mkdir build
669    - cd build
670    - ../configure --enable-tcg-interpreter --disable-kvm --disable-docs --disable-gtk --disable-vnc
671        --target-list="$(for tg in $TARGETS; do echo -n ${tg}'-softmmu '; done)"
672        || { cat config.log meson-logs/meson-log.txt && exit 1; }
673    - make -j"$JOBS"
674    - make tests/qtest/boot-serial-test tests/qtest/cdrom-test tests/qtest/pxe-test
675    - for tg in $TARGETS ; do
676        export QTEST_QEMU_BINARY="./qemu-system-${tg}" ;
677        ./tests/qtest/boot-serial-test || exit 1 ;
678        ./tests/qtest/cdrom-test || exit 1 ;
679      done
680    - QTEST_QEMU_BINARY="./qemu-system-x86_64" ./tests/qtest/pxe-test
681    - QTEST_QEMU_BINARY="./qemu-system-s390x" ./tests/qtest/pxe-test -m slow
682    - make check-tcg
683
684# Check our reduced build configurations
685build-without-defaults:
686  extends: .native_build_job_template
687  needs:
688    job: amd64-centos9-container
689  variables:
690    IMAGE: centos9
691    CONFIGURE_ARGS:
692      --without-default-devices
693      --without-default-features
694      --disable-fdt
695      --disable-pie
696      --disable-qom-cast-debug
697      --disable-strip
698      --target-list-exclude=aarch64-softmmu,microblaze-softmmu,mips64-softmmu,mipsel-softmmu,ppc64-softmmu,sh4el-softmmu,xtensa-softmmu,x86_64-softmmu
699    MAKE_CHECK_ARGS: check
700
701build-libvhost-user:
702  extends: .base_job_template
703  stage: build
704  image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
705  needs:
706    job: amd64-fedora-container
707  script:
708    - mkdir subprojects/libvhost-user/build
709    - cd subprojects/libvhost-user/build
710    - meson
711    - ninja
712
713# No targets are built here, just tools, docs, and unit tests. This
714# also feeds into the eventual documentation deployment steps later
715build-tools-and-docs-debian:
716  extends:
717    - .native_build_job_template
718    - .native_build_artifact_template
719  needs:
720    job: amd64-debian-container
721    # when running on 'master' we use pre-existing container
722    optional: true
723  variables:
724    IMAGE: debian
725    MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
726    CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
727    QEMU_JOB_PUBLISH: 1
728
729# Prepare for GitLab pages deployment. Anything copied into the
730# "public" directory will be deployed to $USER.gitlab.io/$PROJECT
731#
732# GitLab publishes from any branch that triggers a CI pipeline
733#
734# For the main repo we don't want to publish from 'staging'
735# since that content may not be pushed, nor do we wish to
736# publish from 'stable-NNN' branches as that content is outdated.
737# Thus we restrict to just the default branch
738#
739# For contributor forks we want to publish from any repo so
740# that users can see the results of their commits, regardless
741# of what topic branch they're currently using
742pages:
743  extends: .base_job_template
744  image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
745  stage: test
746  needs:
747    - job: build-tools-and-docs-debian
748  script:
749    - mkdir -p public
750    # HTML-ised source tree
751    - make gtags
752    # We unset variables to work around a bug in some htags versions
753    # which causes it to fail when the environment is large
754    - CI_COMMIT_MESSAGE= CI_COMMIT_TAG_MESSAGE= htags
755        -anT --tree-view=filetree -m qemu_init
756        -t "Welcome to the QEMU sourcecode"
757    - mv HTML public/src
758    # Project documentation
759    - make -C build install DESTDIR=$(pwd)/temp-install
760    - mv temp-install/usr/local/share/doc/qemu/* public/
761  artifacts:
762    when: on_success
763    paths:
764      - public
765  variables:
766    QEMU_JOB_PUBLISH: 1
767
768coverity:
769  image: $CI_REGISTRY_IMAGE/qemu/fedora:$QEMU_CI_CONTAINER_TAG
770  stage: build
771  allow_failure: true
772  timeout: 3h
773  needs:
774    - job: amd64-fedora-container
775      optional: true
776  before_script:
777    - dnf install -y curl wget
778  script:
779    # would be nice to cancel the job if over quota (https://gitlab.com/gitlab-org/gitlab/-/issues/256089)
780    # for example:
781    #   curl --request POST --header "PRIVATE-TOKEN: $CI_JOB_TOKEN" "${CI_SERVER_URL}/api/v4/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/cancel
782    - 'scripts/coverity-scan/run-coverity-scan --check-upload-only || { exitcode=$?; if test $exitcode = 1; then
783        exit 0;
784      else
785        exit $exitcode;
786      fi; };
787      scripts/coverity-scan/run-coverity-scan --update-tools-only > update-tools.log 2>&1 || { cat update-tools.log; exit 1; };
788      scripts/coverity-scan/run-coverity-scan --no-update-tools'
789  rules:
790    - if: '$COVERITY_TOKEN == null'
791      when: never
792    - if: '$COVERITY_EMAIL == null'
793      when: never
794    # Never included on upstream pipelines, except for schedules
795    - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM && $CI_PIPELINE_SOURCE == "schedule"'
796      when: on_success
797    - if: '$CI_PROJECT_NAMESPACE == $QEMU_CI_UPSTREAM'
798      when: never
799    # Forks don't get any pipeline unless QEMU_CI=1 or QEMU_CI=2 is set
800    - if: '$QEMU_CI != "1" && $QEMU_CI != "2"'
801      when: never
802    # Always manual on forks even if $QEMU_CI == "2"
803    - when: manual
804