mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 18:53:29 +00:00
main: fix tests with default TestConfig.Count=0 doesn't skip all tests
This commit is contained in:
@@ -545,7 +545,7 @@ type TestConfig struct {
|
|||||||
Verbose bool
|
Verbose bool
|
||||||
Short bool
|
Short bool
|
||||||
RunRegexp string
|
RunRegexp string
|
||||||
Count int
|
Count *int
|
||||||
BenchRegexp string
|
BenchRegexp string
|
||||||
BenchTime string
|
BenchTime string
|
||||||
BenchMem bool
|
BenchMem bool
|
||||||
|
|||||||
@@ -245,8 +245,8 @@ func Test(pkgName string, stdout, stderr io.Writer, options *compileopts.Options
|
|||||||
if testConfig.BenchMem {
|
if testConfig.BenchMem {
|
||||||
flags = append(flags, "-test.benchmem")
|
flags = append(flags, "-test.benchmem")
|
||||||
}
|
}
|
||||||
if testConfig.Count != 1 {
|
if testConfig.Count != nil && *testConfig.Count != 1 {
|
||||||
flags = append(flags, "-test.count="+strconv.Itoa(testConfig.Count))
|
flags = append(flags, "-test.count="+strconv.Itoa(*testConfig.Count))
|
||||||
}
|
}
|
||||||
|
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
@@ -1420,7 +1420,7 @@ func main() {
|
|||||||
flag.BoolVar(&testConfig.Verbose, "v", false, "verbose: print additional output")
|
flag.BoolVar(&testConfig.Verbose, "v", false, "verbose: print additional output")
|
||||||
flag.BoolVar(&testConfig.Short, "short", false, "short: run smaller test suite to save time")
|
flag.BoolVar(&testConfig.Short, "short", false, "short: run smaller test suite to save time")
|
||||||
flag.StringVar(&testConfig.RunRegexp, "run", "", "run: regexp of tests to run")
|
flag.StringVar(&testConfig.RunRegexp, "run", "", "run: regexp of tests to run")
|
||||||
flag.IntVar(&testConfig.Count, "count", 1, "count: number of times to run tests/benchmarks `count` times")
|
testConfig.Count = flag.Int("count", 1, "count: number of times to run tests/benchmarks `count` times")
|
||||||
flag.StringVar(&testConfig.BenchRegexp, "bench", "", "run: regexp of benchmarks to run")
|
flag.StringVar(&testConfig.BenchRegexp, "bench", "", "run: regexp of benchmarks to run")
|
||||||
flag.StringVar(&testConfig.BenchTime, "benchtime", "", "run each benchmark for duration `d`")
|
flag.StringVar(&testConfig.BenchTime, "benchtime", "", "run each benchmark for duration `d`")
|
||||||
flag.BoolVar(&testConfig.BenchMem, "benchmem", false, "show memory stats for benchmarks")
|
flag.BoolVar(&testConfig.BenchMem, "benchmem", false, "show memory stats for benchmarks")
|
||||||
|
|||||||
Reference in New Issue
Block a user