diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 355cd59c22..18ebd70c84 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -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" @@ -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/..." + - "-//test/rustfmt/..." - "@examples//..." - "-@examples//ffi/rust_calling_c:matrix_dylib_test" - "-@examples//ffi/rust_calling_c:matrix_dynamically_linked" diff --git a/test/BUILD b/test/BUILD index fb5c838cba..be389ad7d4 100644 --- a/test/BUILD +++ b/test/BUILD @@ -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", ) diff --git a/test/unit/cc_info/cc_info_test.bzl b/test/unit/cc_info/cc_info_test.bzl index 23674769df..c645f15197 100644 --- a/test/unit/cc_info/cc_info_test.bzl +++ b/test/unit/cc_info/cc_info_test.bzl @@ -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] @@ -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) @@ -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():