Skip to content

Commit

Permalink
Increase CI coverage (#612)
Browse files Browse the repository at this point in the history
* Add CI coverage

* Disable bindgen on windows

* Fix a test

* Fix more tests

* Disable test/test_env/

* Disable rust analyzer

* Disable test/proto

* Disable //tools/runfiles

* Disable //test/rustfmt
  • Loading branch information
hlopko committed Feb 26, 2021
1 parent 5285ebc commit 9b135bf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
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/..."
- "-//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

0 comments on commit 9b135bf

Please sign in to comment.