Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
illicitonion committed Dec 8, 2022
1 parent cc78849 commit 264ad0c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ tasks:
- tests/core/cgo/generate_imported_dylib.sh
build_targets:
- "//..."
- "--"
- "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6
test_targets:
- "//..."
ubuntu2004:
Expand All @@ -19,6 +23,10 @@ tasks:
- "--config=incompatible"
build_targets:
- "//..."
- "--"
- "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6
test_targets:
- "//..."
ubuntu2004_bcr_tests:
Expand All @@ -42,13 +50,21 @@ tasks:
- tests/core/cgo/generate_imported_dylib.sh
build_targets:
- "//..."
- "--"
- "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6
test_targets:
- "//..."
rbe_ubuntu1604:
shell_commands:
- tests/core/cgo/generate_imported_dylib.sh
build_targets:
- "//..."
- "--"
- "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6
test_flags:
# Some tests depend on this feature being disabled. However, because it's
# enabled by default in the rbe_ubuntu1604 platform, we cannot simply remove
Expand Down Expand Up @@ -249,6 +265,9 @@ tasks:
- "-//tests/legacy/test_chdir:go_default_test"
- "-//tests/legacy/test_rundir:go_default_test"
- "-//tests/legacy/transitive_data:go_default_test"
- "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6
- "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6
test_flags:
# Go requires a C toolchain that accepts options and emits errors like
# gcc or clang. The Go SDK does not support MSVC.
Expand Down
24 changes: 24 additions & 0 deletions tests/core/cross/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,30 @@ go_cross_binary(
target = ":native_bin",
)

# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it).
# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo.
go_cross_binary(
name = "windows_go_cross_cgo",
platform = "@io_bazel_rules_go//go/toolchain:windows_amd64_cgo",
target = ":native_bin",
)

# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it).
# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo.
go_cross_binary(
name = "linux_go_cross_cgo",
platform = "@io_bazel_rules_go//go/toolchain:linux_amd64_cgo",
target = ":native_bin",
)

# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it).
# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo.
go_cross_binary(
name = "darwin_go_cross_cgo",
platform = "@io_bazel_rules_go//go/toolchain:darwin_amd64_cgo",
target = ":native_bin",
)

go_library(
name = "platform_lib",
srcs = select({
Expand Down

0 comments on commit 264ad0c

Please sign in to comment.