aboutsummaryrefslogtreecommitdiffstats
path: root/csource/csource.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-05-29 15:15:39 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-06-12 19:48:23 +0200
commitfce462fb99651fe1e4f92fce28c8218ac7daf976 (patch)
tree471b59ee356a0203ad3851b6b284ed39b892bde2 /csource/csource.go
parentab9fabf95864c5183713081c05a3780060e0940f (diff)
csource: generate includes when necessary
Diffstat (limited to 'csource/csource.go')
-rw-r--r--csource/csource.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/csource/csource.go b/csource/csource.go
index 4e51a3ee5..8231a97ac 100644
--- a/csource/csource.go
+++ b/csource/csource.go
@@ -190,7 +190,9 @@ func generateTestFunc(w io.Writer, opts Options, calls []string, name string) {
fmt.Fprintf(w, "\tsyscall(SYS_write, 1, \"executing program\\n\", strlen(\"executing program\\n\"));\n")
}
fmt.Fprintf(w, "\tmemset(r, -1, sizeof(r));\n")
- fmt.Fprintf(w, "\tsrand(getpid());\n")
+ if opts.Collide {
+ fmt.Fprintf(w, "\tsrand(getpid());\n")
+ }
fmt.Fprintf(w, "\tfor (i = 0; i < %v; i++) {\n", len(calls))
fmt.Fprintf(w, "\t\tpthread_create(&th[i], 0, thr, (void*)i);\n")
fmt.Fprintf(w, "\t\tusleep(10000);\n")
@@ -386,6 +388,12 @@ func preprocessCommonHeader(opts Options, handled map[string]int, useBitmasks bo
default:
return "", fmt.Errorf("unknown sandbox mode: %v", opts.Sandbox)
}
+ if opts.Threaded {
+ defines = append(defines, "SYZ_THREADED")
+ }
+ if opts.Collide {
+ defines = append(defines, "SYZ_COLLIDE")
+ }
if opts.Repeat {
defines = append(defines, "SYZ_REPEAT")
}