Skip to content

Commit

Permalink
qemu: Add a Kernel unit test
Browse files Browse the repository at this point in the history
We test that the kernel path and the kernel parameters are properly
built.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
  • Loading branch information
Samuel Ortiz committed Sep 16, 2016
1 parent 8e495f6 commit 2ea9b9a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions qemu_test.go
Expand Up @@ -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, " ")
Expand Down Expand Up @@ -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)
}

0 comments on commit 2ea9b9a

Please sign in to comment.