-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathobject_test.go
44 lines (36 loc) · 984 Bytes
/
object_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
package qcli
import "testing"
var (
memPathString = "-mem-path /dev/hugepages/vm1 -mem-prealloc"
deviceNVDIMMString = "-device nvdimm,id=nv0,memdev=mem0,unarmed=on -object memory-backend-file,id=mem0,mem-path=/root,size=65536,readonly=on"
objectEPCString = "-object memory-backend-epc,id=epc0,size=65536,prealloc=on"
)
func TestAppendObjectLegacy(t *testing.T) {
object := Object{
Type: LegacyMemPath,
MemPath: "/dev/hugepages/vm1",
Prealloc: true,
}
testAppend(object, memPathString, t)
}
func TestAppendObjectDeviceNVDIMM(t *testing.T) {
object := Object{
Driver: NVDIMM,
Type: MemoryBackendFile,
DeviceID: "nv0",
ID: "mem0",
MemPath: "/root",
Size: 1 << 16,
ReadOnly: true,
}
testAppend(object, deviceNVDIMMString, t)
}
func TestAppendObjectEPC(t *testing.T) {
object := Object{
Type: MemoryBackendEPC,
ID: "epc0",
Size: 1 << 16,
Prealloc: true,
}
testAppend(object, objectEPCString, t)
}