Skip to content

Commit

Permalink
Tests for unknown commit
Browse files Browse the repository at this point in the history
Adds test for fix to cc_binary in a previous CL which required a Bazel change.

RELNOTES:none
PiperOrigin-RevId: 361152661
Change-Id: Ic7b9cda6636eff6bc231f00f8cdd542e0c88113c
  • Loading branch information
oquenchil authored and copybara-github committed Mar 5, 2021
1 parent d5d830b commit 25193de
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/experimental_cc_shared_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _build_exports_map_from_only_dynamic_deps(merged_shared_library_infos):
if export in exports_map:
fail("Two shared libraries in dependencies export the same symbols. Both " +
exports_map[export].libraries[0].dynamic_library.short_path +
" and " + linker_input.dynamic_library.short_path +
" and " + linker_input.libraries[0].dynamic_library.short_path +
" export " + export)
exports_map[export] = linker_input
return exports_map
Expand Down
22 changes: 22 additions & 0 deletions examples/test_cc_shared_library/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ cc_binary(
deps = ["foo"],
)

cc_binary(
name = "binary_with_bar_so_twice",
srcs = ["main.cc"],
dynamic_deps = [
"foo_so",
"bar_so",
],
deps = ["foo"],
)

cc_shared_library(
name = "foo_so",
additional_linker_inputs = [
Expand Down Expand Up @@ -212,3 +222,15 @@ cc_shared_library_permissions(
],
visibility = ["//examples/test_cc_shared_library/diamond_inheritance:__pkg__"],
)

build_failure_test(
name = "two_dynamic_deps_same_export_in_so_test",
message = "Two shared libraries in dependencies export the same symbols",
target_under_test = "//examples/test_cc_shared_library/failing_targets:two_dynamic_deps_same_export_in_so",
)

build_failure_test(
name = "two_dynamic_deps_same_export_in_binary_test",
message = "Two shared libraries in dependencies export the same symbols",
target_under_test = "//examples/test_cc_shared_library/failing_targets:two_dynamic_deps_same_export_in_binary",
)
55 changes: 54 additions & 1 deletion examples/test_cc_shared_library/failing_targets/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("//cc:defs.bzl", "cc_binary")
load("//cc:defs.bzl", "cc_binary", "cc_library")
load("//examples:experimental_cc_shared_library.bzl", "cc_shared_library", "cc_shared_library_permissions")

package(
Expand Down Expand Up @@ -35,3 +35,56 @@ cc_shared_library_permissions(
"//examples/test_cc_shared_library:foo",
],
)

cc_library(
name = "a",
srcs = ["a.cc"],
)

cc_library(
name = "b",
srcs = ["b.cc"],
)

cc_library(
name = "c",
srcs = ["c.cc"],
)

cc_shared_library(
name = "two_dynamic_deps_same_export_in_so",
dynamic_deps = [
":b_so",
":b2_so",
],
roots = [
":a",
],
tags = TAGS,
)

cc_binary(
name = "two_dynamic_deps_same_export_in_binary",
srcs = ["main.cc"],
dynamic_deps = [
":b_so",
":b2_so",
],
tags = TAGS,
)

cc_shared_library(
name = "b_so",
roots = [
":b",
],
tags = TAGS,
)

cc_shared_library(
name = "b2_so",
roots = [
":b",
],
tags = TAGS,
)
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 25193de

Please sign in to comment.