Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ tasks:
rbe_ubuntu1604:
test_targets:
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "//test/..."
- "@examples//..."
- "-//test/conflicting_deps:conflicting_deps_test"
Expand All @@ -53,6 +54,14 @@ tasks:
- "--enable_runfiles" # this is not enabled by default on windows and is necessary for the cargo build scripts
windows_targets: &windows_targets
- "--" # Allows negative patterns; hack for https://github.com/bazelbuild/continuous-integration/pull/245
- "..."
- "-//bindgen/..."
- "-//test/load_arbitrary_tool/..."
- "-//test/test_env/..."
- "-//test/proto/..."
- "-//tools/rust_analyzer/..."
- "-//tools/runfiles/..."
Comment thread
hlopko marked this conversation as resolved.
- "-//test/rustfmt/..."
- "@examples//..."
- "-@examples//ffi/rust_calling_c:matrix_dylib_test"
- "-@examples//ffi/rust_calling_c:matrix_dynamically_linked"
Expand Down
5 changes: 4 additions & 1 deletion test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ rule_test(

rule_test(
name = "hello_world_rule_test",
generates = ["hello_world"],
generates = select({
"//rust/platform:windows": ["hello_world.exe"],
"//conditions:default": ["hello_world"],
}),
rule = "@examples//hello_world:hello_world",
)

Expand Down
12 changes: 10 additions & 2 deletions test/unit/cc_info/cc_info_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
load("//rust:defs.bzl", "rust_binary", "rust_library", "rust_proc_macro", "rust_shared_library", "rust_static_library")

def _is_dylib_on_windows(ctx):
return ctx.target_platform_has_constraint(ctx.attr._windows[platform_common.ConstraintValueInfo])

def _assert_cc_info_has_library_to_link(env, tut, type):
asserts.true(env, CcInfo in tut, "rust_library should provide CcInfo")
cc_info = tut[CcInfo]
Expand All @@ -20,7 +23,10 @@ def _assert_cc_info_has_library_to_link(env, tut, type):
if type == "cdylib":
asserts.true(env, library_to_link.dynamic_library != None)
asserts.equals(env, None, library_to_link.interface_library)
asserts.true(env, library_to_link.resolved_symlink_dynamic_library != None)
if _is_dylib_on_windows(env.ctx):
asserts.true(env, library_to_link.resolved_symlink_dynamic_library == None)
else:
asserts.true(env, library_to_link.resolved_symlink_dynamic_library != None)
asserts.equals(env, None, library_to_link.resolved_symlink_interface_library)
asserts.equals(env, None, library_to_link.static_library)
asserts.equals(env, None, library_to_link.pic_static_library)
Expand Down Expand Up @@ -66,7 +72,9 @@ def _staticlib_provides_cc_info_test_impl(ctx):
rlib_provides_cc_info_test = analysistest.make(_rlib_provides_cc_info_test_impl)
bin_does_not_provide_cc_info_test = analysistest.make(_bin_does_not_provide_cc_info_test_impl)
staticlib_provides_cc_info_test = analysistest.make(_staticlib_provides_cc_info_test_impl)
cdylib_provides_cc_info_test = analysistest.make(_cdylib_provides_cc_info_test_impl)
cdylib_provides_cc_info_test = analysistest.make(_cdylib_provides_cc_info_test_impl, attrs = {
"_windows": attr.label(default = Label("@platforms//os:windows")),
})
proc_macro_does_not_provide_cc_info_test = analysistest.make(_proc_macro_does_not_provide_cc_info_test_impl)

def _cc_info_test():
Expand Down