#18 Passing extra args to `go test`
Opened 3 years ago by qulogic. Modified 3 years ago

While gocheckflags exists, it gets passed to go-rpm-integration, but ignored after that. For example, if I add:

%global gocheckflags -timeout 30m

then it appears when go-rpm-integration is called:

+ go-rpm-integration check -i go.etcd.io/bbolt -b /builddir/build/BUILD/bbolt-1.3.3/_build/bin -s /builddir/build/BUILD/bbolt-1.3.3/_build -V 1.3.3-1.fc31 -p /builddir/build/BUILDROOT/golang-etcd-bbolt-1.3.3-1.fc31.x86_64 -g /usr/share/gocode -timeout 30m -v
Testing    in: /builddir/build/BUILD/bbolt-1.3.3/_build/src
         PATH: /builddir/build/BUILD/bbolt-1.3.3/_build/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
       GOPATH: /builddir/build/BUILD/bbolt-1.3.3/_build:/usr/share/gocode
  GO111MODULE: off
      command: go test -buildmode pie -compiler gc -ldflags "-X go.etcd.io/bbolt/version=1.3.3 -extldflags '-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
      testing: go.etcd.io/bbolt

but it's not there in the command: go test ....

I also tried export GO_TEST_FLAGS="-timeout 30m", but this gets overwritten by something else.

gocheckflags is here to pass exclusion information to go-rpm-integration in gocheck, the same way goinstallflags works in goinstall.

To pass information explicitely to the go test layer, you need gotestflags.

Be careful because this variable is already set by the macro parts inherited from go-compilers, add to it do not overwrite it.

OK, this seems like it works:

%global gotestflags %{gotestflags} -timeout 30m

I guess something like this needs to be mentioned in the templates at least.

Login to comment on this ticket.