Move out dmesg cleaning from run
This commit is contained in:
parent
e1ffda19d2
commit
0f569c88cc
14
main.go
14
main.go
@ -157,10 +157,10 @@ func build(tmp string, ka artifact, ki kernelInfo) (outPath string, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func run(q *qemu.QemuSystem, ka artifact, ki kernelInfo, file string) (output string, err error) {
|
func cleanDmesg(q *qemu.QemuSystem) (err error) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
for {
|
for {
|
||||||
output, err = q.Command("root", "dmesg -c")
|
_, err = q.Command("root", "dmesg -c")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -168,10 +168,13 @@ func run(q *qemu.QemuSystem, ka artifact, ki kernelInfo, file string) (output st
|
|||||||
|
|
||||||
if time.Now().After(start.Add(time.Minute)) {
|
if time.Now().After(start.Add(time.Minute)) {
|
||||||
err = errors.New("Can't connect to qemu")
|
err = errors.New("Can't connect to qemu")
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
func run(q *qemu.QemuSystem, ka artifact, ki kernelInfo, file string) (output string, err error) {
|
||||||
switch ka.Type {
|
switch ka.Type {
|
||||||
case KernelModule:
|
case KernelModule:
|
||||||
output, err = q.CopyAndInsmod(file)
|
output, err = q.CopyAndInsmod(file)
|
||||||
@ -257,6 +260,11 @@ func whatever(swg *sizedwaitgroup.SizedWaitGroup, ka artifact, ki kernelInfo) {
|
|||||||
}
|
}
|
||||||
build_ok = true
|
build_ok = true
|
||||||
|
|
||||||
|
err = cleanDmesg(q)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// TODO Write run log to file or database
|
// TODO Write run log to file or database
|
||||||
_, err = run(q, ka, ki, outFile)
|
_, err = run(q, ka, ki, outFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user