-
Notifications
You must be signed in to change notification settings - Fork 1
/
vm_test.go
58 lines (49 loc) · 1.2 KB
/
vm_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2016-2021 the u-root Authors. All rights reserved
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !race
// +build !race
package smbios
import (
"runtime"
"testing"
"time"
"github.com/hugelgupf/vmtest/govmtest"
"github.com/hugelgupf/vmtest/guest"
"github.com/hugelgupf/vmtest/qemu"
)
func TestIntegration(t *testing.T) {
qemu.SkipIfNotArch(t, qemu.ArchAMD64)
govmtest.Run(t, "vm",
govmtest.WithPackageToTest("github.com/u-root/smbios"),
govmtest.WithQEMUFn(
qemu.WithVMTimeout(time.Minute),
qemu.ArbitraryArgs("-smbios", "type=2,manufacturer=u-root"),
),
)
}
func TestLegacyQEMU(t *testing.T) {
guest.SkipIfNotInVM(t)
if runtime.GOARCH != "amd64" {
t.Skip("amd64 only")
}
addr, size, err := EntryBaseFromLegacy()
if err != nil {
t.Error(err)
}
if size != 0x18 {
t.Errorf("QEMU expected to use SMBIOS3")
}
t.Logf("addr: %#x", addr)
t.Logf("size: %#x", size)
gaddr, gsize, err := EntryBase()
if err != nil {
t.Error(err)
}
if gsize != 0x18 {
t.Errorf("QEMU expected to use SMBIOS3")
}
if gaddr != addr {
t.Errorf("EntryBase address (%#x) not same as EntryBaseFromLegacy (%#x)", gaddr, addr)
}
}