qemu: enable "-pflash"

flash image can store some critical data like firmware, enable it here.

Fixes: #140
Signed-off-by: Edmond AK Dantes <edmond.dantes.ak47@outlook.com>
This commit is contained in:
Edmond AK Dantes
2020-10-21 20:25:57 +08:00
parent 99f43ec188
commit 2079c15c26
2 changed files with 31 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"io/ioutil"
"os"
"reflect"
"strings"
"testing"
)
@@ -1026,6 +1027,25 @@ func TestBadGlobalParam(t *testing.T) {
}
}
func TestBadPFlash(t *testing.T) {
c := &Config{}
c.appendPFlashParam()
if len(c.qemuParams) != 0 {
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
}
}
func TestValidPFlash(t *testing.T) {
c := &Config{}
c.PFlash = []string{"flash0", "flash1"}
c.appendPFlashParam()
expected := []string{"-pflash", "flash0", "-pflash", "flash1"}
ok := reflect.DeepEqual(expected, c.qemuParams)
if !ok {
t.Errorf("Expected %v, found %v", expected, c.qemuParams)
}
}
func TestBadVGA(t *testing.T) {
c := &Config{}
c.appendVGA()