aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-07-05 16:23:30 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-07-24 14:22:54 +0200
commite83310d8a2b1bb6418d041c8e48aad4ae2a8ae81 (patch)
tree592bfb4f06afad627a92397caaed3c348b66661f /pkg/csource/csource.go
parent65a2d5fb58431828105bc0be91acb631c8d1097d (diff)
pkg/csource: make all usleeps random
We can't know the exact values of those sleeps in advance, they can be different for different bugs. Making them random increases the chance that the C repro executes with the right timings at some point.
Diffstat (limited to 'pkg/csource/csource.go')
-rw-r--r--pkg/csource/csource.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/csource/csource.go b/pkg/csource/csource.go
index e52be3e88..32415e982 100644
--- a/pkg/csource/csource.go
+++ b/pkg/csource/csource.go
@@ -219,7 +219,7 @@ func generateTestFunc(w io.Writer, opts Options, calls []string, name string) {
}
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")
+ fmt.Fprintf(w, "\t\tusleep(rand()%%10000);\n")
fmt.Fprintf(w, "\t}\n")
if opts.Collide {
fmt.Fprintf(w, "\tfor (i = 0; i < %v; i++) {\n", len(calls))
@@ -228,7 +228,7 @@ func generateTestFunc(w io.Writer, opts Options, calls []string, name string) {
fmt.Fprintf(w, "\t\t\tusleep(rand()%%10000);\n")
fmt.Fprintf(w, "\t}\n")
}
- fmt.Fprintf(w, "\tusleep(100000);\n")
+ fmt.Fprintf(w, "\tusleep(rand()%%100000);\n")
fmt.Fprintf(w, "}\n\n")
}
}