Skip to content

Commit f301dd1

Browse files
committed
wip
1 parent 7d8cba0 commit f301dd1

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

test/unit/check_runfiles/check_runfiles_test.bzl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
44
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
5+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
56
load(
67
"//rust:defs.bzl",
78
"rust_binary",
@@ -17,6 +18,11 @@ def _check_runfiles_test_impl(ctx):
1718

1819
asserts.true(env, _is_in_runfiles("libbar.so", runfiles))
1920

21+
# cc_libraries put shared libs to data runfiles even when linking statically
22+
# and there is a static library alternative. We must be careful not to put
23+
# these shared libs to default runfiles.
24+
asserts.false(env, _is_in_runfiles("libtest_Sunit_Scheck_Urunfiles_Slibcc_Ulib.so", runfiles))
25+
2026
return analysistest.end(env)
2127

2228
def _is_in_runfiles(name, runfiles):
@@ -28,11 +34,15 @@ def _is_in_runfiles(name, runfiles):
2834
check_runfiles_test = analysistest.make(_check_runfiles_test_impl)
2935

3036
def _check_runfiles_test():
37+
cc_library(
38+
name = "cc_lib",
39+
srcs = ["bar.cc"],
40+
)
3141
rust_library(
3242
name = "foo_lib",
3343
srcs = ["foo.rs"],
3444
edition = "2018",
35-
deps = [":libbar.so"],
45+
deps = [":libbar.so", ":cc_lib"],
3646
)
3747

3848
rust_binary(
@@ -99,4 +109,4 @@ def check_runfiles_test_suite(name):
99109
":check_runfiles_dylib_test",
100110
":check_runfiles_static_test",
101111
],
102-
)
112+
)

0 commit comments

Comments
 (0)