-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/build: add test coverage for netgo and osusergo build tags #24845
Comments
Change https://golang.org/cl/106837 mentions this issue: |
Fixes #24841 Updates #24845 Change-Id: I4a5c05f4cbf9692bd6cab48baf3cc51fa43fe5a9 Reviewed-on: https://go-review.googlesource.com/106837 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
The And it turns out it never worked, even when it was first committed:
|
Change https://golang.org/cl/107299 mentions this issue: |
Change https://golang.org/cl/107300 mentions this issue: |
I am not sure what would be an elegant way of implementing this, but this is what I came up with: kir@kd:~/git/golang/go/src$ cat os/user/build_test.go
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package user_test
import (
"internal/testenv"
"os"
"os/exec"
"testing"
)
// TestBuild checks if the package can be built with the "osusergo" tag set
func TestBuild(t *testing.T) {
testenv.MustHaveGoBuild(t)
cmd := exec.Command(testenv.GoToolPath(t), "build", "-tags", "osusergo", ".")
run(cmd, t)
}
func run(c *exec.Cmd, t *testing.T) {
t.Helper()
c.Stdout = os.Stdout
c.Stderr = os.Stderr
err := c.Run()
if err != nil {
t.Fatal(err)
}
} Let me know if this looks decent, and I'll add the same for netgo |
And yes, the above test catches the #24841 when I revert the patch manually:
|
@kolyshkin, I had already sent https://golang.org/cl/107300 |
Fixes #24841 Updates #24845 Change-Id: Ia7e2deefe64c12ee8a76ce6ed9f9e003e912b161 Reviewed-on: https://go-review.googlesource.com/107299 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
… windows Would've caught two regressions so far, and found two more. Updates #24841 Updates #24845 (package net remains) Change-Id: I57ad06eb54e04b8c99b5d2e7f24c77ad865224e8 Reviewed-on: https://go-review.googlesource.com/107300 Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/107304 mentions this issue: |
Verified that on on Linux, with: CGO_ENABLED=1 GOOS=solaris go install --tags=osusergo ... it builds now. Updates #24841 Updates #24845 Change-Id: I49f40532bc2a13a9d282771592fc8d7f116b1902 Reviewed-on: https://go-review.googlesource.com/107304 Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Closing as fixed enough. The |
In #24841 we learned that the osusergo build tag resulted in an os/user package that didn't even compile.
We should make sure we have some test or builder coverage for those build tags.
The text was updated successfully, but these errors were encountered: