From e18e1ec3a8755c053769ffcf919d49e17883d8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Thu, 27 Feb 2025 12:18:35 +0100 Subject: [PATCH] ci: arm64: Skip tests that depend on virt on non-virt capable runners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The GitHub hosted runners for ARM64 do not provide virtualisation support, thus we're just skipping the tests as those would check whether or not the system is "VMContainerCapable". Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/build-checks.yaml | 4 ++++ .../cmd/kata-runtime/kata-check_arm64_test.go | 4 ++++ src/runtime/cmd/kata-runtime/kata-env_arm64_test.go | 4 ++++ src/runtime/cmd/kata-runtime/kata-env_test.go | 12 ++++++++++++ 4 files changed, 24 insertions(+) diff --git a/.github/workflows/build-checks.yaml b/.github/workflows/build-checks.yaml index 30d4c00cba..0ff280b6a7 100644 --- a/.github/workflows/build-checks.yaml +++ b/.github/workflows/build-checks.yaml @@ -99,6 +99,10 @@ jobs: run: | XDG_RUNTIME_DIR=$(mktemp -d "/tmp/kata-tests-$USER.XXX" | tee >(xargs chmod 0700)) echo "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR}" >> "$GITHUB_ENV" + - name: Skip tests that depend on virtualization capable runners when needed + if: ${{ endsWith(inputs.instance, '-arm') }} + run: | + echo "GITHUB_RUNNER_CI_ARM64=true" >> "$GITHUB_ENV" - name: Running `${{ matrix.command }}` for ${{ matrix.component }} run: | cd ${{ matrix.component-path }} diff --git a/src/runtime/cmd/kata-runtime/kata-check_arm64_test.go b/src/runtime/cmd/kata-runtime/kata-check_arm64_test.go index a35cd65b0a..f11e922084 100644 --- a/src/runtime/cmd/kata-runtime/kata-check_arm64_test.go +++ b/src/runtime/cmd/kata-runtime/kata-check_arm64_test.go @@ -25,6 +25,10 @@ func setupCheckHostIsVMContainerCapable(assert *assert.Assertions, cpuInfoFile s } func TestCCCheckCLIFunction(t *testing.T) { + if os.Getenv("GITHUB_RUNNER_CI_ARM64") == "true" { + t.Skip("Skipping the test as the GitHub self hosted runners for ARM64 do not support Virtualization") + } + var cpuData []testCPUData moduleData := []testModuleData{ {filepath.Join(sysModuleDir, "kvm"), "", true}, diff --git a/src/runtime/cmd/kata-runtime/kata-env_arm64_test.go b/src/runtime/cmd/kata-runtime/kata-env_arm64_test.go index c2dcbb7be1..1c6de1af71 100644 --- a/src/runtime/cmd/kata-runtime/kata-env_arm64_test.go +++ b/src/runtime/cmd/kata-runtime/kata-env_arm64_test.go @@ -6,6 +6,7 @@ package main import ( + "os" "testing" ) @@ -17,5 +18,8 @@ func getExpectedHostDetails(tmpdir string) (HostInfo, error) { } func TestEnvGetEnvInfoSetsCPUType(t *testing.T) { + if os.Getenv("GITHUB_RUNNER_CI_ARM64") == "true" { + t.Skip("Skipping the test as the GitHub self hosted runners for ARM64 do not support Virtualization") + } testEnvGetEnvInfoSetsCPUTypeGeneric(t) } diff --git a/src/runtime/cmd/kata-runtime/kata-env_test.go b/src/runtime/cmd/kata-runtime/kata-env_test.go index 4d09955e1f..2057a177a6 100644 --- a/src/runtime/cmd/kata-runtime/kata-env_test.go +++ b/src/runtime/cmd/kata-runtime/kata-env_test.go @@ -375,6 +375,10 @@ func TestEnvGetMetaInfo(t *testing.T) { } func TestEnvGetHostInfo(t *testing.T) { + if os.Getenv("GITHUB_RUNNER_CI_ARM64") == "true" { + t.Skip("Skipping the test as the GitHub self hosted runners for ARM64 do not support Virtualization") + } + tmpdir := t.TempDir() expectedHostDetails, err := getExpectedHostDetails(tmpdir) @@ -435,6 +439,10 @@ func TestEnvGetHostInfoNoProcVersion(t *testing.T) { } func TestEnvGetEnvInfo(t *testing.T) { + if os.Getenv("GITHUB_RUNNER_CI_ARM64") == "true" { + t.Skip("Skipping the test as the GitHub self hosted runners for ARM64 do not support Virtualization") + } + tmpdir := t.TempDir() // Run test twice to ensure the individual component debug+trace @@ -463,6 +471,10 @@ func TestEnvGetEnvInfo(t *testing.T) { } func TestEnvGetEnvInfoNoHypervisorVersion(t *testing.T) { + if os.Getenv("GITHUB_RUNNER_CI_ARM64") == "true" { + t.Skip("Skipping the test as the GitHub self hosted runners for ARM64 do not support Virtualization") + } + assert := assert.New(t) tmpdir := t.TempDir()