Jochen Voss <jochen.v...@gmail.com> wrote: > Now I just want to run one of these sub-benchmarks. I tried -bench > '^BenchmarkTextLayout/CFFSimple1$' but this runs two of the benchmarks: > > > go test -run=^$ -bench '^BenchmarkTextLayout/CFFSimple1$' > goos: darwin > goarch: arm64 > pkg: seehuhn.de/go/pdf/graphics > BenchmarkTextLayout/CFFSimple1-8 49 24198452 ns/op > BenchmarkTextLayout/OpenTypeCFFSimple1-8 48 24209569 ns/op > PASS > ok seehuhn.de/go/pdf/graphics 3.804s > > How do I just run "BenchmarkTextLayout/CFFSimple1"? >
The regexp matches against the benchmark name, not the "full name". Slashes are interpreted as a separator for names to be matched against, thus your regexp first matches "^BenchmarkTextLayout" against all top-level benchmarks, then matches "CFFSimple1$" against all sub-benchmarks names found in "BenchmarkTextLayout" which indeed "CFFSimple1" and "OpenTypeCFFSimple1" are matches of. So the following regexp should only match "BenchmarkTextLayout/CFFSimple1". $ go test -bench='^BenchmarkTextLayout/^CFFSimple1$' Note the '^' before CFF. BR. -w -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3LG0U1KAOYT9L.3Q5IDPUXR8DP8%40104d.net.