Skip to contentSkip to conversation

gitlab-ci.yml: Run test with KVM and macOS via cirrus-run

PATCH Applied Thomas Huth 2 participants 2 messages Jan 15, 2021 – Jan 18, 2021 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gitlab-ci.yml: Run test with KVM and macOS via cirrus-run

Since Travis changed their policy, we soon cannot use it for the kvm-unit-tests anymore, thus we lose the CI testing with KVM enabled and the compilation jobs on macOS. Fortunately there is an alternative:
Cirrus-CI also provides containers with KVM enabled and CI jobs with macOS. Thanks to the so-call "cirrus-run" script, we can even start the jobs from the gitlab-CI, so we get all the test coverage in the gitlab-CI again. cirrus-run needs some configuration first, though. Please refer to the description from libvirt for the details how to set up your environment for these jobs:

https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst

---
 .gitlab-ci.yml                | 31 +++++++++++++++++
 ci/cirrus-ci-fedora.yml       | 65 +++++++++++++++++++++++++++++++++++
 ci/cirrus-ci-macos-i386.yml   | 36 +++++++++++++++++++
 ci/cirrus-ci-macos-x86-64.yml | 41 ++++++++++++++++++++++
 4 files changed, 173 insertions(+)
 create mode 100644 ci/cirrus-ci-fedora.yml
 create mode 100644 ci/cirrus-ci-macos-i386.yml
 create mode 100644 ci/cirrus-ci-macos-x86-64.yml
.gitlab-ci.yml +31 -0
index 6613c7b..8834e59 100644
@@ -122,3 +122,34 @@ build-centos7:
      setjmp sieve tsc rmap_chain umip
      | tee results.txt
  - grep -q PASS results.txt && ! grep -q FAIL results.txt
+
+# Cirrus-CI provides containers with macOS and Linux with KVM enabled,
+# so we can test some scenarios there that are not possible with the
+# gitlab-CI shared runners. We use the "cirrus-run" container from the
+# libvirt project to start the jobs. See the following URL for more
+# information how to set up your environment to use these containers:
+#
+#   https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst
+#
+.cirrus_build_job_template: &cirrus_build_job_definition
+ image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
+ before_script:
+  - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
+        -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
+        -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
+        < ci/$CI_JOB_NAME.yml > ci/_$CI_JOB_NAME.yml
+ script:
+  - cirrus-run -v --show-build-log always ci/_$CI_JOB_NAME.yml
+ only:
+  variables:
+   - $CIRRUS_GITHUB_REPO
+   - $CIRRUS_API_TOKEN
+
+cirrus-ci-fedora:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-i386:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-x86-64:
+ <<: *cirrus_build_job_definition
ci/cirrus-ci-fedora.yml new file +65 -0

65 lines not on this page · raw message

ci/cirrus-ci-macos-i386.yml new file +36 -0
new file mode 100644
index 0000000..b837101
@@ -0,0 +1,36 @@
+
+macos_i386_task:
+  osx_instance:
+    image: catalina-base
+  install_script:
+    - brew install coreutils bash git gnu-getopt make qemu i686-elf-gcc
+  clone_script:
+    - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+    - git fetch origin "@CI_COMMIT_REF_NAME@"
+    - git reset --hard "@CI_COMMIT_SHA@"
+  script:
+    - export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+    - mkdir build
+    - cd build
+    - ../configure --arch=i386 --cross-prefix=i686-elf-
+    - gmake -j$(sysctl -n hw.ncpu)
+    - ACCEL=tcg ./run_tests.sh
+         cmpxchg8b
+         eventinj
+         realmode
+         setjmp
+         sieve
+         taskswitch
+         tsc
+         umip
+         vmexit_cpuid
+         vmexit_inl_pmtimer
+         vmexit_ipi
+         vmexit_ipi_halt
+         vmexit_mov_from_cr8
+         vmexit_mov_to_cr8
+         vmexit_ple_round_robin
+         vmexit_tscdeadline
+         vmexit_tscdeadline_immed
+         | tee results.txt
+    - grep -q PASS results.txt && ! grep -q FAIL results.txt
ci/cirrus-ci-macos-x86-64.yml new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.27.0
maintainer Applied
#1 lore raw
Quoted 213 lines · Thomas Huth

Since Travis changed their policy, we soon cannot use it for the kvm-unit-tests anymore, thus we lose the CI testing with KVM enabled and the compilation jobs on macOS. Fortunately there is an alternative:
Cirrus-CI also provides containers with KVM enabled and CI jobs with macOS. Thanks to the so-call "cirrus-run" script, we can even start the jobs from the gitlab-CI, so we get all the test coverage in the gitlab-CI again. cirrus-run needs some configuration first, though. Please refer to the description from libvirt for the details how to set up your environment for these jobs:

https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst

---
  .gitlab-ci.yml                | 31 +++++++++++++++++
  ci/cirrus-ci-fedora.yml       | 65 +++++++++++++++++++++++++++++++++++
  ci/cirrus-ci-macos-i386.yml   | 36 +++++++++++++++++++
  ci/cirrus-ci-macos-x86-64.yml | 41 ++++++++++++++++++++++
  4 files changed, 173 insertions(+)

create mode 100644 ci/cirrus-ci-fedora.yml create mode 100644 ci/cirrus-ci-macos-i386.yml create mode 100644 ci/cirrus-ci-macos-x86-64.yml

.gitlab-ci.yml +31 -0
index 6613c7b..8834e59 100644
@@ -122,3 +122,34 @@ build-centos7:
       setjmp sieve tsc rmap_chain umip
       | tee results.txt
   - grep -q PASS results.txt && ! grep -q FAIL results.txt
+
+# Cirrus-CI provides containers with macOS and Linux with KVM enabled,
+# so we can test some scenarios there that are not possible with the
+# gitlab-CI shared runners. We use the "cirrus-run" container from the
+# libvirt project to start the jobs. See the following URL for more
+# information how to set up your environment to use these containers:
+#
+#   https://gitlab.com/libvirt/libvirt/-/blob/v7.0.0/ci/README.rst
+#
+.cirrus_build_job_template: &cirrus_build_job_definition
+ image: registry.gitlab.com/libvirt/libvirt-ci/cirrus-run:master
+ before_script:
+  - sed -e "s|[@]CI_REPOSITORY_URL@|$CI_REPOSITORY_URL|g"
+        -e "s|[@]CI_COMMIT_REF_NAME@|$CI_COMMIT_REF_NAME|g"
+        -e "s|[@]CI_COMMIT_SHA@|$CI_COMMIT_SHA|g"
+        < ci/$CI_JOB_NAME.yml > ci/_$CI_JOB_NAME.yml
+ script:
+  - cirrus-run -v --show-build-log always ci/_$CI_JOB_NAME.yml
+ only:
+  variables:
+   - $CIRRUS_GITHUB_REPO
+   - $CIRRUS_API_TOKEN
+
+cirrus-ci-fedora:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-i386:
+ <<: *cirrus_build_job_definition
+
+cirrus-ci-macos-x86-64:
+ <<: *cirrus_build_job_definition
ci/cirrus-ci-fedora.yml new file +65 -0
new file mode 100644
index 0000000..aba6ae7
@@ -0,0 +1,65 @@
+
+fedora_task:
+  container:
+    image: fedora:latest
+    cpu: 4
+    memory: 4Gb
+    kvm: true
+  install_script:
+    - dnf update -y
+    - dnf install -y diffutils gcc git make qemu-system-x86
+  clone_script:
+    - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+    - git fetch origin "@CI_COMMIT_REF_NAME@"
+    - git reset --hard "@CI_COMMIT_SHA@"
+  script:
+    - mkdir build
+    - cd build
+    - ../configure
+    - make -j$(nproc)
+    - ./run_tests.sh
+        access
+        asyncpf
+        debug
+        emulator
+        ept
+        hypercall
+        hyperv_clock
+        hyperv_connections
+        hyperv_stimer
+        hyperv_synic
+        idt_test
+        intel_iommu
+        ioapic
+        ioapic-split
+        kvmclock_test
+        msr
+        pcid
+        pcid-disabled
+        rdpru
+        realmode
+        rmap_chain
+        s3
+        setjmp
+        sieve
+        smptest
+        smptest3
+        syscall
+        tsc
+        tsc_adjust
+        tsx-ctrl
+        umip
+        vmexit_cpuid
+        vmexit_inl_pmtimer
+        vmexit_ipi
+        vmexit_ipi_halt
+        vmexit_mov_from_cr8
+        vmexit_mov_to_cr8
+        vmexit_ple_round_robin
+        vmexit_tscdeadline
+        vmexit_tscdeadline_immed
+        vmexit_vmcall
+        vmx_apic_passthrough_thread
+        xsave
+        | tee results.txt
+    - grep -q PASS results.txt && ! grep -q FAIL results.txt
ci/cirrus-ci-macos-i386.yml new file +36 -0
new file mode 100644
index 0000000..b837101
@@ -0,0 +1,36 @@
+
+macos_i386_task:
+  osx_instance:
+    image: catalina-base
+  install_script:
+    - brew install coreutils bash git gnu-getopt make qemu i686-elf-gcc
+  clone_script:
+    - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+    - git fetch origin "@CI_COMMIT_REF_NAME@"
+    - git reset --hard "@CI_COMMIT_SHA@"
+  script:
+    - export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+    - mkdir build
+    - cd build
+    - ../configure --arch=i386 --cross-prefix=i686-elf-
+    - gmake -j$(sysctl -n hw.ncpu)
+    - ACCEL=tcg ./run_tests.sh
+         cmpxchg8b
+         eventinj
+         realmode
+         setjmp
+         sieve
+         taskswitch
+         tsc
+         umip
+         vmexit_cpuid
+         vmexit_inl_pmtimer
+         vmexit_ipi
+         vmexit_ipi_halt
+         vmexit_mov_from_cr8
+         vmexit_mov_to_cr8
+         vmexit_ple_round_robin
+         vmexit_tscdeadline
+         vmexit_tscdeadline_immed
+         | tee results.txt
+    - grep -q PASS results.txt && ! grep -q FAIL results.txt
ci/cirrus-ci-macos-x86-64.yml new file +31 -0
new file mode 100644
index 0000000..00cc1a2
@@ -0,0 +1,41 @@
+
+macos_task:
+  osx_instance:
+    image: catalina-base
+  install_script:
+    - brew install coreutils bash git gnu-getopt make qemu x86_64-elf-gcc
+  clone_script:
+    - git clone --depth 100 "@CI_REPOSITORY_URL@" .
+    - git fetch origin "@CI_COMMIT_REF_NAME@"
+    - git reset --hard "@CI_COMMIT_SHA@"
+  script:
+    - export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+    - mkdir build
+    - cd build
+    - ../configure --cross-prefix=x86_64-elf-
+    - gmake -j$(sysctl -n hw.ncpu)
+    - ACCEL=tcg ./run_tests.sh
+         eventinj
+         intel_iommu
+         ioapic-split
+         msr
+         realmode
+         rmap_chain
+         setjmp
+         sieve
+         smptest
+         smptest3
+         syscall
+         tsc
+         umip
+         vmexit_cpuid

ci/cirrus-ci-macos-x86-64.yml line 41

Quoted 10 lines
ci/cirrus-ci-macos-x86-64.yml new file +10 -0
+         vmexit_inl_pmtimer
+         vmexit_ipi
+         vmexit_ipi_halt
+         vmexit_mov_from_cr8
+         vmexit_mov_to_cr8
+         vmexit_ple_round_robin
+         vmexit_tscdeadline
+         vmexit_tscdeadline_immed
+         | tee results.txt
+    - grep -q PASS results.txt && ! grep -q FAIL results.txt

Queued, thanks.

Paolo