1
0

Add timeout for enough time for qemu to be runned

This commit is contained in:
dump_stack() 2018-11-25 14:43:58 +00:00
parent 4a247b229a
commit 6d7f6c5435
2 changed files with 20 additions and 8 deletions

26
pew.go
View File

@ -300,6 +300,22 @@ func exists(path string) bool {
return true
}
func kernelMask(kernel string) (km config.KernelMask, err error) {
parts := strings.Split(kernel, ":")
if len(parts) != 2 {
err = errors.New("Kernel is not 'distroType:regex'")
return
}
dt, err := config.NewDistroType(parts[0])
if err != nil {
return
}
km = config.KernelMask{DistroType: dt, ReleaseMask: parts[1]}
return
}
func pewHandler(kcfg config.KernelConfig,
workPath, ovrrdKrnl, binary, test string, guess bool,
qemuTimeout, dockerTimeout time.Duration) (err error) {
@ -314,18 +330,12 @@ func pewHandler(kcfg config.KernelConfig,
}
if ovrrdKrnl != "" {
parts := strings.Split(ovrrdKrnl, ":")
if len(parts) != 2 {
return errors.New("Kernel is not 'distroType:regex'")
}
var dt config.DistroType
dt, err = config.NewDistroType(parts[0])
var km config.KernelMask
km, err = kernelMask(ovrrdKrnl)
if err != nil {
return
}
km := config.KernelMask{DistroType: dt, ReleaseMask: parts[1]}
ka.SupportedKernels = []config.KernelMask{km}
}

View File

@ -333,6 +333,8 @@ func TestQemuSystemDebug(t *testing.T) {
}
defer q.Stop()
time.Sleep(time.Second)
if !openedPort(port) {
t.Fatal("Qemu debug port does not opened")
}