Skip to content

Commit

Permalink
nogo: attempt to get test to pass on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
emmaxy committed Dec 15, 2023
1 parent 5c82944 commit 680bfbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ tasks:
- "-//tests/core/go_proto_library_importmap:importmap_test"
- "-//tests/core/go_test:data_test"
- "-//tests/core/go_test:pwd_test"
- "-//tests/core/nogo/coverage:coverage_cgo_test.go"
- "-//tests/core/nogo/coverage:coverage_test"
- "-//tests/core/nogo/coverage:gen_code_test"
- "-//tests/core/race:race_test" # fails on Windows due to upstream bug, see issue #2911
Expand Down
32 changes: 16 additions & 16 deletions tests/core/nogo/coverage/coverage_cgo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,39 @@ func TestMain(m *testing.M) {
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "nogo")
go_library(
name = "foo",
name = "foo_cgo",
cgo = True,
srcs = ["foo.go"],
importpath = "foo"
srcs = ["foo_cgo.go"],
importpath = "foo_cgo"
)
go_test(
name = "foo_test",
srcs = ["foo_test.go"],
embed = [":foo"]
name = "foo_cgo_test",
srcs = ["foo_cgo_test.go"],
embed = [":foo_cgo"]
)
nogo(
name = "nogo",
deps = ["//noinit"],
visibility = ["//visibility:public"],
)
-- foo.go --
package foo
-- foo_cgo.go --
package foo_cgo
import "C"
func Foo() string {
return "foo"
func FooCgo() string {
return "foo_cgo"
}
-- foo_test.go --
package foo
-- foo_cgo_test.go --
package foo_cgo
import "testing"
func TestFoo(t *testing.T) {
if actual, expected := Foo(), "foo"; actual != expected {
t.Errorf("Foo() should return foo")
func TestFooCgo(t *testing.T) {
if actual, expected := FooCgo(), "foo_cgo"; actual != expected {
t.Errorf("FooCgo() should return foo_cgo")
}
}
-- noinit/BUILD.bazel --
Expand Down Expand Up @@ -117,7 +117,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
}

func TestNogoWithCoverageAndCgo(t *testing.T) {
if out, err := bazel_testing.BazelOutput("coverage", "//:foo_test"); err != nil {
if out, err := bazel_testing.BazelOutput("coverage", "//:foo_cgo_test"); err != nil {
println(string(out))
t.Fatal(err)
}
Expand Down

0 comments on commit 680bfbb

Please sign in to comment.