-
Notifications
You must be signed in to change notification settings - Fork 2
/
usb-controller_test.go
51 lines (46 loc) · 1.3 KB
/
usb-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
package qcli
import "testing"
var (
deviceUSBControllerQemuXHCIStr = "-device qemu-xhci,id=usb0,addr=0x1e"
deviceUSBControllerQemuXHCIBusAddrStr = "-device qemu-xhci,id=usb0,addr=0x1e,romfile=romfile,rombar=1024,multifunction=on"
)
func TestAppendDeviceUSBController(t *testing.T) {
usbCon := USBControllerDevice{
ID: "usb0",
Driver: USBXHCIController,
}
testAppend(usbCon, deviceUSBControllerQemuXHCIStr, t)
usbCon.Addr = "0x5"
usbCon.ROMFile = "romfile"
usbCon.ROMBar = "1024"
usbCon.Multifunction = true
testAppend(usbCon, deviceUSBControllerQemuXHCIBusAddrStr, t)
}
func TestAppendDeviceUSBControllerAndUSBCDROM(t *testing.T) {
conf := &Config{
USBControllerDevices: []USBControllerDevice{
USBControllerDevice{
ID: "usb0",
Driver: USBXHCIController,
},
},
BlkDevices: []BlockDevice{
BlockDevice{
Driver: USBStorage,
SCSI: true,
Interface: NoInterface,
ID: "drive1",
AIO: Threads,
Serial: "disk0-usb",
File: "disk0-usb.img",
Format: RAW,
Cache: CacheModeUnsafe,
Discard: DiscardUnmap,
DetectZeroes: DetectZeroesUnmap,
BlockSize: 512,
},
},
}
expected := deviceUSBControllerQemuXHCIStr + " " + deviceBlockUSBHDStr
testConfig(conf, expected, t)
}