From fce462fb99651fe1e4f92fce28c8218ac7daf976 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Mon, 29 May 2017 15:15:39 +0200 Subject: csource: generate includes when necessary --- csource/csource.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'csource/csource.go') 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") } -- cgit mrf-deployment