-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathide-controller_test.go
62 lines (55 loc) · 1.65 KB
/
ide-controller_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
59
60
61
62
package qcli
import "testing"
var (
deviceIDEControllerPIIX3Str = "-device piix3-ide,id=ide0,addr=0x1e,bus=ide.0"
deviceIDEControllerPIIX4Str = "-device piix4-ide,id=ide0,addr=0x1e,bus=ide.0"
deviceIDEControllerAHCIStr = "-device ich9-ahci,id=ide0,addr=0x1e,bus=ide.0"
deviceIDEControllerAHCIBusAddrStr = "-device ich9-ahci,id=ide0,addr=0x1e,bus=ide.1,romfile=romfile,rombar=1024,multifunction=on"
)
func TestAppendDeviceIDEController(t *testing.T) {
ideCon := IDEControllerDevice{
ID: "ide0",
Bus: "ide.0",
Driver: ICH9AHCIController,
}
testAppend(ideCon, deviceIDEControllerAHCIStr, t)
ideCon.Driver = PIIX3IDEController
testAppend(ideCon, deviceIDEControllerPIIX3Str, t)
ideCon.Driver = PIIX4IDEController
testAppend(ideCon, deviceIDEControllerPIIX4Str, t)
ideCon.Driver = ICH9AHCIController
ideCon.Bus = "ide.1"
ideCon.Addr = "0x5"
ideCon.ROMFile = "romfile"
ideCon.ROMBar = "1024"
ideCon.Multifunction = true
testAppend(ideCon, deviceIDEControllerAHCIBusAddrStr, t)
}
func TestAppendDeviceIDEControllerAndIDECDROM(t *testing.T) {
conf := &Config{
IDEControllerDevices: []IDEControllerDevice{
IDEControllerDevice{
ID: "ide0",
Driver: ICH9AHCIController,
Bus: "ide.0",
},
},
BlkDevices: []BlockDevice{
BlockDevice{
Driver: IDECDROM,
Interface: NoInterface,
ID: "cdrom0",
AIO: Threads,
Serial: "ubuntu.iso",
File: "ubuntu.iso",
Format: RAW,
ReadOnly: true,
Media: "cdrom",
BootIndex: "0",
Bus: "ide.0",
},
},
}
expected := deviceIDEControllerAHCIStr + " " + deviceBlockIDECDRom
testConfig(conf, expected, t)
}