qemu: Add a Kernel unit test

We test that the kernel path and the kernel parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2016-09-13 12:50:49 +02:00
parent 8e495f6eff
commit 2ea9b9a385

View File

@ -53,6 +53,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
}
params = appendKnobs([]string{}, config)
case Kernel:
config := Config{
Kernel: s,
}
params = appendKernel([]string{}, config)
}
result := strings.Join(params, " ")
@ -148,3 +155,14 @@ func TestAppendKnobsAllFalse(t *testing.T) {
testAppend(knobs, "", t)
}
var kernelString = "-kernel /opt/vmlinux.container -append root=/dev/pmem0p1 rootflags=dax,data=ordered,errors=remount-ro rw rootfstype=ext4 tsc=reliable"
func TestAppendKernel(t *testing.T) {
kernel := Kernel{
Path: "/opt/vmlinux.container",
Params: "root=/dev/pmem0p1 rootflags=dax,data=ordered,errors=remount-ro rw rootfstype=ext4 tsc=reliable",
}
testAppend(kernel, kernelString, t)
}