qemu: Add a Knobs unit test

We test that all true and all false knobs parameters are properly built.

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

View File

@ -46,6 +46,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
}
params = appendObjects([]string{}, config)
case Knobs:
config := Config{
Knobs: s,
}
params = appendKnobs([]string{}, config)
}
result := strings.Join(params, " ")
@ -119,3 +126,25 @@ func TestAppendEmptyObject(t *testing.T) {
testAppend(device, "", t)
}
var knobsString = "-no-user-config -nodefaults -nographic"
func TestAppendKnobsAllTrue(t *testing.T) {
knobs := Knobs{
NoUserConfig: true,
NoDefaults: true,
NoGraphic: true,
}
testAppend(knobs, knobsString, t)
}
func TestAppendKnobsAllFalse(t *testing.T) {
knobs := Knobs{
NoUserConfig: false,
NoDefaults: false,
NoGraphic: false,
}
testAppend(knobs, "", t)
}