Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled -race for go test in Makefile #48

Closed
wants to merge 1 commit into from
Closed

Enabled -race for go test in Makefile #48

wants to merge 1 commit into from

Conversation

tsconn23
Copy link
Member

After reviewing the initial issue, it appears that all tests do pass
with the go test -race flag. However this flag is not enabled during
build verification b/c it is not included in the Makefile. I made the
change to include it.

In order to test locally with -race enabled, simply type make test.

Fix #35

Signed-off-by: Trevor Conn [email protected]

After reviewing the initial issue, it appears that all tests do pass
with the `go test -race` flag. However this flag is not enabled during
build verification b/c it is not included in the Makefile. I made the
change to include it.

In order to test locally with `-race` enabled, simply type `make test`.

Fix #35

Signed-off-by: Trevor Conn <[email protected]>
@tsconn23 tsconn23 added hanoi Hanoi release ci issue_type denoting non-code changes such as testing or compilation 1-low priority denoting isolated changes labels Aug 18, 2020
@tsconn23 tsconn23 added this to the Hanoi milestone Aug 18, 2020
@tsconn23 tsconn23 requested a review from lenny-goodell August 18, 2020 19:00
@tsconn23 tsconn23 self-assigned this Aug 18, 2020
@tsconn23
Copy link
Member Author

JJB pipeline fails on Test step with the following

[edgeXBuildGoApp] Building Code With image [nexus3.edgexfoundry.org:10003/edgex-devops/edgex-golang-base:1.13-alpine]
[2020-08-18T19:07:49.590Z] + make test
[2020-08-18T19:07:49.590Z] CGO_ENABLED=1 GO111MODULE=on go test -race ./... -coverprofile=coverage.out ./...
[2020-08-18T19:07:51.525Z] # runtime/race
[2020-08-18T19:07:51.525Z] /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: race_linux_amd64.syso: in function `__sanitizer::GetArgv()':
[2020-08-18T19:07:51.525Z] gotsan.cc:(.text+0x4183): undefined reference to `__libc_stack_end'
[2020-08-18T19:07:51.525Z] /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: race_linux_amd64.syso: in function `__sanitizer::ReExec()':
[2020-08-18T19:07:51.525Z] gotsan.cc:(.text+0x9797): undefined reference to `__libc_stack_end'
[2020-08-18T19:07:51.525Z] /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: race_linux_amd64.syso: in function `__sanitizer::InternalAlloc(unsigned long, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >*, unsigned long)':
[2020-08-18T19:07:51.525Z] gotsan.cc:(.text+0xaac1): undefined reference to `__libc_malloc'
[2020-08-18T19:07:51.525Z] /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: race_linux_amd64.syso: in function `__sanitizer::InternalRealloc(void*, unsigned long, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >*)':
[2020-08-18T19:07:51.525Z] gotsan.cc:(.text+0xca20): undefined reference to `__libc_realloc'
[2020-08-18T19:07:51.525Z] /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: race_linux_amd64.syso: in function `__sanitizer::InternalFree(void*, __sanitizer::SizeClassAllocatorLocalCache<__sanitizer::SizeClassAllocator32<__sanitizer::AP32> >*)':
[2020-08-18T19:07:51.525Z] gotsan.cc:(.text+0x66e8): undefined reference to `__libc_free'
[2020-08-18T19:07:51.525Z] collect2: error: ld returned 1 exit status
[2020-08-18T19:08:06.519Z] FAIL	github.com/edgexfoundry/go-mod-registry/internal/pkg/consul [build failed]
[2020-08-18T19:08:06.519Z] ?   	github.com/edgexfoundry/go-mod-registry/pkg/types	[no test files]
[2020-08-18T19:08:06.519Z] FAIL	github.com/edgexfoundry/go-mod-registry/registry [build failed]
[2020-08-18T19:08:06.519Z] FAIL
[2020-08-18T19:08:06.519Z] make: *** [Makefile:6: test] Error 2
script returned exit code 2

Unfortunately it doesn't look like this will be doable until the EdgeX project adopts Go v1.15. There's a long-lived issue on the Golang repo about not being able to use -race in an Alpine-based container.

golang/go#14481

If you scroll to the end, you'll see some comments indicating this should be fixed in 1.15.

Closing PR for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-low priority denoting isolated changes ci issue_type denoting non-code changes such as testing or compilation hanoi Hanoi release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests should run cleanly when passed the -race option
1 participant