mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 11:29:46 +00:00
tools/syz-prog2c: allow to test build of the resulting program
This commit is contained in:
parent
68ce63c468
commit
a736f2e8e6
@ -18,6 +18,7 @@ import (
|
||||
var (
|
||||
flagOS = flag.String("os", runtime.GOOS, "target os")
|
||||
flagArch = flag.String("arch", runtime.GOARCH, "target arch")
|
||||
flagBuild = flag.Bool("build", false, "also build the generated program")
|
||||
flagThreaded = flag.Bool("threaded", false, "create threaded program")
|
||||
flagCollide = flag.Bool("collide", false, "create collide program")
|
||||
flagRepeat = flag.Bool("repeat", false, "repeat program infinitely or not")
|
||||
@ -87,4 +88,14 @@ func main() {
|
||||
src = formatted
|
||||
}
|
||||
os.Stdout.Write(src)
|
||||
if !*flagBuild {
|
||||
return
|
||||
}
|
||||
bin, err := csource.Build(target, src)
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "failed to build C source: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
os.Remove(bin)
|
||||
fmt.Fprintf(os.Stderr, "binary build OK\n")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user