Skip to content

testing: -bench regexp doesn't apply to subbenchmarks #15126

@valyala

Description

@valyala

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
go version devel +1f5b1b2 Mon Apr 4 10:05:05 2016 +0000 linux/amd64
  1. What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build773049645=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
  1. What did you do?

Given the following subbenchmarks:

func BenchmarkFoo(b *testing.B) {
    b.Run("sub1", subbenchmark1)
    b.Run("sub2", subbenchamrk2)
}

I wanted to run only BenchmarkFoo/sub1 with:

go test -bench=BenchmarkFoo/sub1
  1. What did you expect to see?

Only BenchmarkFoo/sub1 should be executed

  1. What did you see instead?

No benchmarks are executed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions