check: fix typecheck failure in qemu_arm64_test.go

fix typecheck failure in qemu_arm64_test.go

Fixes: #2789
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
This commit is contained in:
Jianyong Wu 2021-10-05 16:38:36 +08:00 committed by Jakob Naucke
parent 5b02d54e23
commit 8acfc154de
No known key found for this signature in database
GPG Key ID: 45FA1C7D310C0EBE
2 changed files with 14 additions and 15 deletions

View File

@ -158,19 +158,23 @@ const (
//Intel Trust Domain Extensions
//https://software.intel.com/content/www/us/en/develop/articles/intel-trust-domain-extensions.html
tdxProtection
// Exclude from lint checking for it won't be used on arm64 code
tdxProtection //nolint
// AMD Secure Encrypted Virtualization
// https://developer.amd.com/sev/
sevProtection
// Exclude from lint checking for it won't be used on arm64 code
sevProtection //nolint
// IBM POWER 9 Protected Execution Facility
// https://www.kernel.org/doc/html/latest/powerpc/ultravisor.html
pefProtection
// Exclude from lint checking for it won't be used on arm64 code
pefProtection //nolint
// IBM Secure Execution (IBM Z & LinuxONE)
// https://www.kernel.org/doc/html/latest/virt/kvm/s390-pv.html
seProtection
// Exclude from lint checking for it won't be used on arm64 code
seProtection //nolint
)
type qemuArchBase struct {

View File

@ -105,14 +105,11 @@ func TestQemuArm64AppendImage(t *testing.T) {
imageStat, err := f.Stat()
assert.NoError(err)
// save default supportedQemuMachines options
machinesCopy := make([]govmmQemu.Machine, len(supportedQemuMachines))
assert.Equal(len(supportedQemuMachines), copy(machinesCopy, supportedQemuMachines))
cfg := qemuConfig(QemuVirt)
cfg.ImagePath = f.Name()
arm64 := newQemuArch(cfg)
assert.Contains(m.machine().Options, qemuNvdimmOption)
arm64, err := newQemuArch(cfg)
assert.NoError(err)
assert.Contains(arm64.machine().Options, qemuNvdimmOption)
expectedOut := []govmmQemu.Device{
govmmQemu.Object{
@ -128,9 +125,6 @@ func TestQemuArm64AppendImage(t *testing.T) {
devices, err = arm64.appendImage(context.Background(), devices, f.Name())
assert.NoError(err)
assert.Equal(expectedOut, devices)
//restore default supportedQemuMachines options
assert.Equal(len(supportedQemuMachines), copy(supportedQemuMachines, machinesCopy))
}
func TestQemuArm64AppendNvdimmImage(t *testing.T) {
@ -171,7 +165,8 @@ func TestQemuArm64WithInitrd(t *testing.T) {
cfg := qemuConfig(QemuVirt)
cfg.InitrdPath = "dummy-initrd"
arm64 := newQemuArch(cfg)
arm64, err := newQemuArch(cfg)
assert.NoError(err)
assert.NotContains(m.machine().Options, qemuNvdimmOption)
assert.NotContains(arm64.machine().Options, qemuNvdimmOption)
}