xref: /kvm-unit-tests/.gitlab-ci.yml (revision f117b0286d0ae2789f9d1eae6519f0205f100ea4)
1image: fedora:40
2
3before_script:
4 - dnf update -y
5 - dnf install -y make python
6
7# By default artifacts are only saved on success. This uses when:always
8# because the test logs are important to help diagnose failures.
9.intree_template:
10 artifacts:
11  when: always
12  expire_in: 2 days
13  when: always
14  paths:
15   - logs
16
17.outoftree_template:
18 artifacts:
19  when: always
20  expire_in: 2 days
21  when: always
22  paths:
23   - build/logs
24
25build-aarch64:
26 extends: .intree_template
27 script:
28 - dnf install -y qemu-system-aarch64 gcc-aarch64-linux-gnu
29 - ./configure --arch=aarch64 --cross-prefix=aarch64-linux-gnu-
30 - make -j2
31 - ACCEL=tcg MAX_SMP=8 ./run_tests.sh
32      cache
33      debug-bp
34      debug-sstep
35      debug-wp
36      gicv2-active
37      gicv2-ipi
38      gicv2-mmio
39      gicv3-active
40      gicv3-ipi
41      its-introspection
42      its-trigger
43      pci-test
44      pmu-cycle-counter
45      pmu-event-counter-config
46      pmu-sw-incr
47      selftest-setup
48      selftest-smp
49      selftest-vectors-kernel
50      selftest-vectors-user
51      timer
52      | tee results.txt
53 - grep -q PASS results.txt && ! grep -q FAIL results.txt
54
55build-aarch64-efi:
56 extends: .intree_template
57 script:
58 - dnf install -y qemu-system-aarch64 gcc-aarch64-linux-gnu edk2-aarch64
59 - ./configure --arch=aarch64 --cross-prefix=aarch64-linux-gnu- --enable-efi --enable-efi-direct
60 - make -j2
61 - ACCEL=tcg MAX_SMP=8 ./run_tests.sh
62      selftest-setup
63      selftest-smp
64      selftest-vectors-kernel
65      selftest-vectors-user
66      | tee results.txt
67 - grep -q PASS results.txt && ! grep -q FAIL results.txt
68
69build-aarch64-efi-acpi:
70 extends: .intree_template
71 script:
72 - dnf install -y qemu-system-aarch64 gcc-aarch64-linux-gnu edk2-aarch64
73 - ./configure --arch=aarch64 --cross-prefix=aarch64-linux-gnu- --enable-efi --enable-efi-direct
74 - make -j2
75 - EFI_USE_ACPI=y ACCEL=tcg MAX_SMP=8 ./run_tests.sh
76      selftest-setup
77      selftest-smp
78      selftest-vectors-kernel
79      selftest-vectors-user
80      | tee results.txt
81 - grep -q PASS results.txt && ! grep -q FAIL results.txt
82
83build-aarch64-clang:
84 extends: .outoftree_template
85 script:
86 - dnf install -y qemu-system-aarch64 gcc-aarch64-linux-gnu clang
87 - mkdir build
88 - cd build
89 - ../configure --arch=arm64 --cc=clang --cflags='--target=aarch64' --cross-prefix=aarch64-linux-gnu-
90 - make -j2
91 - ACCEL=tcg MAX_SMP=8 ./run_tests.sh
92      cache
93      debug-bp
94      debug-sstep
95      debug-wp
96      gicv2-active
97      gicv2-ipi
98      gicv2-mmio
99      gicv3-active
100      gicv3-ipi
101      its-introspection
102      its-trigger
103      pci-test
104      pmu-cycle-counter
105      pmu-event-counter-config
106      pmu-sw-incr
107      selftest-setup
108      selftest-smp
109      selftest-vectors-kernel
110      selftest-vectors-user
111      timer
112      | tee results.txt
113 - grep -q PASS results.txt && ! grep -q FAIL results.txt
114
115build-aarch64-clang-efi:
116 extends: .intree_template
117 script:
118 - dnf install -y edk2-aarch64 qemu-system-aarch64 gcc-aarch64-linux-gnu clang
119 - ./configure --arch=arm64 --cc=clang --cflags='--target=aarch64' --cross-prefix=aarch64-linux-gnu- --enable-efi --enable-efi-direct
120 - make -j2
121 - ACCEL=tcg MAX_SMP=8 ./run_tests.sh
122      selftest-setup
123      selftest-smp
124      selftest-vectors-kernel
125      selftest-vectors-user
126      | tee results.txt
127 - grep -q PASS results.txt && ! grep -q FAIL results.txt
128
129build-arm:
130 extends: .outoftree_template
131 script:
132 - dnf install -y qemu-system-arm gcc-arm-linux-gnu
133 - mkdir build
134 - cd build
135 - ../configure --arch=arm --cross-prefix=arm-linux-gnu-
136 - make -j2
137 - ACCEL=tcg MAX_SMP=8 ./run_tests.sh
138     selftest-setup selftest-vectors-kernel selftest-vectors-user selftest-smp
139     pci-test pmu-cycle-counter gicv2-ipi gicv2-mmio gicv3-ipi gicv2-active
140     gicv3-active
141     | tee results.txt
142 - grep -q PASS results.txt && ! grep -q FAIL results.txt
143
144build-ppc64be:
145 extends: .outoftree_template
146 script:
147 - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat
148 - mkdir build
149 - cd build
150 - ../configure --arch=ppc64 --endian=big --cross-prefix=powerpc64-linux-gnu-
151 - make -j2
152 - ACCEL=tcg ./run_tests.sh
153      selftest-setup
154      selftest-migration
155      selftest-migration-skip
156      spapr_hcall
157      rtas-get-time-of-day
158      rtas-get-time-of-day-base
159      rtas-set-time-of-day
160      emulator
161      | tee results.txt
162 - if grep -q FAIL results.txt ; then exit 1 ; fi
163
164build-ppc64le:
165 extends: .intree_template
166 script:
167 - dnf install -y qemu-system-ppc gcc-powerpc64-linux-gnu nmap-ncat
168 - ./configure --arch=ppc64 --endian=little --cross-prefix=powerpc64-linux-gnu-
169 - make -j2
170 - ACCEL=tcg ./run_tests.sh
171      selftest-setup
172      selftest-migration
173      selftest-migration-skip
174      spapr_hcall
175      rtas-get-time-of-day
176      rtas-get-time-of-day-base
177      rtas-set-time-of-day
178      emulator
179      | tee results.txt
180 - if grep -q FAIL results.txt ; then exit 1 ; fi
181
182build-riscv32:
183 extends: .outoftree_template
184 script:
185 - dnf install -y qemu-system-riscv gcc-riscv64-linux-gnu
186 - mkdir build
187 - cd build
188 - ../configure --arch=riscv32 --cross-prefix=riscv64-linux-gnu-
189 - make -j2
190 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
191 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
192      selftest
193      sbi
194      | tee results.txt
195 - grep -q PASS results.txt && ! grep -q FAIL results.txt
196
197build-riscv64:
198 extends: .intree_template
199 script:
200 - dnf install -y qemu-system-riscv gcc-riscv64-linux-gnu
201 - ./configure --arch=riscv64 --cross-prefix=riscv64-linux-gnu-
202 - make -j2
203 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
204 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
205      selftest
206      sbi
207      | tee results.txt
208 - grep -q PASS results.txt && ! grep -q FAIL results.txt
209
210build-riscv64-efi:
211 extends: .intree_template
212 script:
213 - dnf install -y edk2-riscv64 qemu-system-riscv gcc-riscv64-linux-gnu
214 - cp /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd .
215 - truncate -s 32M RISCV_VIRT_CODE.fd
216 - ./configure --arch=riscv64 --cross-prefix=riscv64-linux-gnu- --enable-efi
217 - make -j2
218 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
219 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
220      selftest
221      sbi
222      | tee results.txt
223 - grep -q PASS results.txt && ! grep -q FAIL results.txt
224
225build-riscv32-clang:
226 extends: .intree_template
227 script:
228 - dnf install -y qemu-system-riscv gcc-riscv64-linux-gnu clang
229 - ./configure --arch=riscv32 --cc=clang --cflags='--target=riscv32' --cross-prefix=riscv64-linux-gnu-
230 - make -j2
231 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
232 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
233      selftest
234      sbi
235      | tee results.txt
236 - grep -q PASS results.txt && ! grep -q FAIL results.txt
237
238build-riscv64-clang:
239 extends: .outoftree_template
240 script:
241 - dnf install -y qemu-system-riscv gcc-riscv64-linux-gnu clang
242 - mkdir build
243 - cd build
244 - ../configure --arch=riscv64 --cc=clang --cflags='--target=riscv64' --cross-prefix=riscv64-linux-gnu-
245 - make -j2
246 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
247 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
248      selftest
249      sbi
250      | tee results.txt
251 - grep -q PASS results.txt && ! grep -q FAIL results.txt
252
253build-riscv64-clang-efi:
254 extends: .intree_template
255 script:
256 - dnf install -y edk2-riscv64 qemu-system-riscv gcc-riscv64-linux-gnu clang
257 - cp /usr/share/edk2/riscv/RISCV_VIRT_CODE.fd .
258 - truncate -s 32M RISCV_VIRT_CODE.fd
259 - ./configure --arch=riscv64 --cc=clang --cflags='--target=riscv64' --cross-prefix=riscv64-linux-gnu- --enable-efi
260 - make -j2
261 - printf "FOO=foo\nBAR=bar\nBAZ=baz\nMVENDORID=0\nMARCHID=0\nMIMPID=0\n" >test-env
262 - ACCEL=tcg KVM_UNIT_TESTS_ENV=test-env ./run_tests.sh
263      selftest
264      sbi
265      | tee results.txt
266 - grep -q PASS results.txt && ! grep -q FAIL results.txt
267
268build-s390x:
269 extends: .outoftree_template
270 script:
271 - dnf install -y qemu-system-s390x gcc-s390x-linux-gnu
272 - mkdir build
273 - cd build
274 - ../configure --arch=s390x --cross-prefix=s390x-linux-gnu-
275 - make -j2
276 - ACCEL=tcg ./run_tests.sh
277      adtl-status-no-vec-no-gs-tcg
278      adtl-status-tcg
279      cpumodel
280      css
281      diag10
282      diag288
283      diag308
284      edat
285      emulator
286      epsw
287      exittime
288      firq-linear-cpu-ids-tcg
289      firq-nonlinear-cpu-ids-tcg
290      iep
291      intercept
292      mvpg
293      sck
294      sclp-1g
295      sclp-3g
296      selftest-setup
297      sieve
298      smp
299      stsi
300      tprot
301      vector
302      | tee results.txt
303 - if grep -q FAIL results.txt ; then exit 1 ; fi
304
305build-x86_64:
306 extends: .intree_template
307 script:
308 - dnf install -y qemu-system-x86 gcc
309 - ./configure --arch=x86_64
310 - make -j2
311 - ACCEL=tcg ./run_tests.sh
312      eventinj
313      intel_iommu
314      ioapic-split
315      memory
316      pks
317      pku
318      rdpru
319      realmode
320      rmap_chain
321      setjmp
322      sieve
323      smap
324      smptest
325      smptest3
326      syscall
327      tsc
328      umip
329      vmexit_cpuid
330      vmexit_cr0_wp
331      vmexit_cr4_pge
332      vmexit_inl_pmtimer
333      vmexit_ipi
334      vmexit_ipi_halt
335      vmexit_mov_from_cr8
336      vmexit_mov_to_cr8
337      vmexit_ple_round_robin
338      vmexit_tscdeadline
339      vmexit_tscdeadline_immed
340      | tee results.txt
341 - if grep -q FAIL results.txt ; then exit 1 ; fi
342
343build-i386:
344 extends: .outoftree_template
345 script:
346 - dnf install -y qemu-system-x86 gcc
347 - mkdir build
348 - cd build
349 - ../configure --arch=i386
350 - make -j2
351 - ACCEL=tcg ./run_tests.sh
352      cmpxchg8b
353      eventinj
354      realmode
355      setjmp
356      sieve
357      smap
358      smptest
359      smptest3
360      taskswitch
361      tsc
362      umip
363      vmexit_cpuid
364      vmexit_cr0_wp
365      vmexit_cr4_pge
366      vmexit_inl_pmtimer
367      vmexit_ipi
368      vmexit_ipi_halt
369      vmexit_mov_from_cr8
370      vmexit_mov_to_cr8
371      vmexit_ple_round_robin
372      vmexit_tscdeadline
373      vmexit_tscdeadline_immed
374      | tee results.txt
375 - if grep -q FAIL results.txt ; then exit 1 ; fi
376
377build-clang:
378 extends: .intree_template
379 script:
380 - dnf install -y qemu-system-x86 clang
381 - ./configure --arch=x86_64 --cc=clang
382 - make -j2
383 - ACCEL=tcg ./run_tests.sh
384      eventinj
385      intel_iommu
386      ioapic-split
387      memory
388      pks
389      pku
390      rdpru
391      rmap_chain
392      setjmp
393      sieve
394      smap
395      smptest
396      smptest3
397      syscall
398      tsc
399      umip
400      vmexit_cpuid
401      vmexit_cr0_wp
402      vmexit_cr4_pge
403      vmexit_inl_pmtimer
404      vmexit_ipi
405      vmexit_ipi_halt
406      vmexit_mov_from_cr8
407      vmexit_mov_to_cr8
408      vmexit_ple_round_robin
409      vmexit_tscdeadline
410      vmexit_tscdeadline_immed
411      | tee results.txt
412 - grep -q PASS results.txt && ! grep -q FAIL results.txt
413
414build-centos8:
415 extends: .outoftree_template
416 image: centos:8
417 before_script:
418# CentOS mirrors have changed, these sed scripts fixes the repos.
419 - sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
420 - sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
421 - sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
422 - yum update -y
423 - yum install -y make qemu-kvm gcc
424 script:
425 - mkdir build
426 - cd build
427 - ../configure --arch=x86_64 --disable-pretty-print-stacks
428 - make -j2
429 - ACCEL=tcg ./run_tests.sh
430      eventinj
431      intel_iommu
432      ioapic-split
433      memory
434      pks
435      pku
436      port80
437      rdpru
438      rmap_chain
439      setjmp
440      sieve
441      smap
442      smptest
443      smptest3
444      syscall
445      tsc
446      umip
447      vmexit_cpuid
448      vmexit_cr0_wp
449      vmexit_cr4_pge
450      vmexit_inl_pmtimer
451      vmexit_ipi
452      vmexit_ipi_halt
453      vmexit_mov_from_cr8
454      vmexit_mov_to_cr8
455      vmexit_ple_round_robin
456      vmexit_tscdeadline
457      vmexit_tscdeadline_immed
458      | tee results.txt
459 - if grep -q FAIL results.txt ; then exit 1 ; fi
460 - grep -q PASS results.txt && ! grep -q FAIL results.txt
461
462# Cirrus-CI provides containers with macOS and Linux with KVM enabled,
463# so we can test some scenarios there that are not possible with the
464# gitlab-CI shared runners. We use the "cirrus-run" container from the
465# libvirt project to start the jobs. See the following URL for more
466# information how to set up your environment to use these containers:
467#
468#   https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst
469#
470.cirrus_build_job_template: &cirrus_build_job_definition
471 image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:latest
472 before_script:
473  - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
474        -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
475        -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
476        < ci/$CI_JOB_NAME.yml > ci/_$CI_JOB_NAME.yml
477 script:
478  - cirrus-run -v --show-build-log always ci/_$CI_JOB_NAME.yml
479 only:
480  variables:
481   - $CIRRUS_GITHUB_REPO
482   - $CIRRUS_API_TOKEN
483
484cirrus-ci-fedora:
485 <<: *cirrus_build_job_definition
486
487cirrus-ci-macos-i386:
488 <<: *cirrus_build_job_definition
489
490cirrus-ci-macos-x86-64:
491 <<: *cirrus_build_job_definition
492
493s390x-kvm:
494 extends: .intree_template
495 before_script: []
496 tags:
497  - s390x-z15-vm
498 script:
499  - ./configure --arch=s390x
500  - make -j$(nproc)
501  - ACCEL=kvm ./run_tests.sh
502      selftest-setup
503      selftest-migration-skip
504      cmm
505      cpumodel
506      css
507      diag10
508      diag288
509      diag308
510      emulator
511      execute
512      gs
513      iep
514      intercept
515      migration
516      migration-memory
517      migration-sck
518      migration-skey-parallel
519      migration-skey-sequential
520      pfmf
521      sclp-1g
522      sclp-3g
523      sie
524      sieve
525      skrf
526      sthyi
527      stsi
528      vector
529      | tee results.txt
530  - grep -q PASS results.txt && ! grep -q FAIL results.txt
531 only:
532  variables:
533   - $S390X_Z15_RUNNER_AVAILABLE
534
535check-kerneldoc:
536  extends: .intree_template
537  stage: build
538  image: python:3.10-alpine
539  needs: []
540  script:
541    - ./configure --arch=x86_64
542    - make -s check-kerneldoc 2>&1 | tee docwarnings.txt
543    - test -z `cat docwarnings.txt`
544  before_script:
545    - apk -U add bash make perl gcc
546  allow_failure: true
547
548check-shellcheck:
549  extends: .intree_template
550  stage: build
551  image: python:3.10-alpine
552  needs: []
553  script:
554    - ./configure --arch=x86_64
555    - make -s shellcheck 2>&1 | tee shellcheckwarnings.txt
556    - test -z `cat shellcheckwarnings.txt`
557  before_script:
558    - apk -U add bash make gcc shellcheck
559  allow_failure: true
560
561check-patch:
562  extends: .intree_template
563  stage: build
564  image: python:3.10-alpine
565  needs: []
566  script:
567    - scripts/check-patch.py
568  before_script:
569    - apk -U add git perl
570  allow_failure: true
571