mirror of https://github.com/bazelbuild/rules_cc
Tests for unknown commit
Adds test for fix to cc_binary in a previous CL which required a Bazel change. RELNOTES:none PiperOrigin-RevId: 361152661 Change-Id: Ic7b9cda6636eff6bc231f00f8cdd542e0c88113c
This commit is contained in:
parent
d5d830baaf
commit
25193de8f5
|
@ -109,7 +109,7 @@ def _build_exports_map_from_only_dynamic_deps(merged_shared_library_infos):
|
||||||
if export in exports_map:
|
if export in exports_map:
|
||||||
fail("Two shared libraries in dependencies export the same symbols. Both " +
|
fail("Two shared libraries in dependencies export the same symbols. Both " +
|
||||||
exports_map[export].libraries[0].dynamic_library.short_path +
|
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)
|
" export " + export)
|
||||||
exports_map[export] = linker_input
|
exports_map[export] = linker_input
|
||||||
return exports_map
|
return exports_map
|
||||||
|
|
|
@ -21,6 +21,16 @@ cc_binary(
|
||||||
deps = ["foo"],
|
deps = ["foo"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
cc_binary(
|
||||||
|
name = "binary_with_bar_so_twice",
|
||||||
|
srcs = ["main.cc"],
|
||||||
|
dynamic_deps = [
|
||||||
|
"foo_so",
|
||||||
|
"bar_so",
|
||||||
|
],
|
||||||
|
deps = ["foo"],
|
||||||
|
)
|
||||||
|
|
||||||
cc_shared_library(
|
cc_shared_library(
|
||||||
name = "foo_so",
|
name = "foo_so",
|
||||||
additional_linker_inputs = [
|
additional_linker_inputs = [
|
||||||
|
@ -212,3 +222,15 @@ cc_shared_library_permissions(
|
||||||
],
|
],
|
||||||
visibility = ["//examples/test_cc_shared_library/diamond_inheritance:__pkg__"],
|
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",
|
||||||
|
)
|
||||||
|
|
|
@ -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")
|
load("//examples:experimental_cc_shared_library.bzl", "cc_shared_library", "cc_shared_library_permissions")
|
||||||
|
|
||||||
package(
|
package(
|
||||||
|
@ -35,3 +35,56 @@ cc_shared_library_permissions(
|
||||||
"//examples/test_cc_shared_library:foo",
|
"//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,
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue