const pkName … var verbflag … var loopitflag … var seedflag … var execflag … var numpkgsflag … var numfcnsflag … var emitbadflag … var selbadpkgflag … var selbadfcnflag … var forcetmpcleanflag … var cleancacheflag … var raceflag … func verb(vlevel int, s string, a ...interface{ … } func warn(s string, a ...interface{ … } func fatal(s string, a ...interface{ … } type config … func usage(msg string) { … } // docmd executes the specified command in the dir given and pipes the // output to stderr. return status is 0 if command passed, 1 // otherwise. func docmd(cmd []string, dir string) int { … } // docmdout forks and execs command 'cmd' in dir 'dir', redirecting // stderr and stdout from the execution to file 'outfile'. func docmdout(cmd []string, dir string, outfile string) int { … } // gen is the main hook for kicking off code generation. For // non-minimization runs, 'singlepk' and 'singlefn' will both be -1 // (indicating that we want all functions and packages to be // generated). If 'singlepk' is set to a non-negative value, then // code generation will be restricted to the single package with that // index (as a try at minimization), similarly with 'singlefn' // restricting the codegen to a single specified function. func (c *config) gen(singlepk int, singlefn int) { … } // action performs a selected action/command in the generated code dir. func (c *config) action(cmd []string, outfile string, emitout bool) int { … } func binaryName() string { … } // build builds a generated corpus of Go code. If 'emitout' is set, then dump out the // results of the build after it completes (during minimization emitout is set to false, // since there is no need to see repeated errors). func (c *config) build(emitout bool) int { … } // run invokes a binary built from a generated corpus of Go code. If // 'emitout' is set, then dump out the results of the run after it // completes. func (c *config) run(emitout bool) int { … } type minimizeMode … const minimizeBuildFailure … const minimizeRuntimeFailure … // minimize tries to minimize a failing scenario down to a single // package and/or function if possible. This is done using an // iterative search. Here 'minimizeMode' tells us whether we're // looking for a compile-time error or a runtime error. func (c *config) minimize(mode minimizeMode) int { … } // cleanTemp removes the temp dir we've been working with. func (c *config) cleanTemp() { … } // perform is the top level driver routine for the program, containing the // main loop. Each iteration of the loop performs a generate/build/run // sequence, and then updates the seed afterwards if no failure is found. // If a failure is detected, we try to minimize it and then return without // attempting any additional tests. func (c *config) perform() int { … } func main() { … }