From 2ea9b9a385a2d4295257537af11848faeee4b30f Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Tue, 13 Sep 2016 12:50:49 +0200 Subject: [PATCH] qemu: Add a Kernel unit test We test that the kernel path and the kernel parameters are properly built. Signed-off-by: Samuel Ortiz --- qemu_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/qemu_test.go b/qemu_test.go index 3e38ca59c2..e43e39c239 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -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) +}