diff options
author | 2017-10-12 18:30:29 +0200 | |
---|---|---|
committer | 2017-10-13 13:52:14 +0200 | |
commit | 600ab49a98bcb6d96231174b44bd4ae335de4dbf (patch) | |
tree | a32ad8675cae674ee499ecb23051d0e38dc9ef1c /src | |
parent | 1b98de65873054b148ced772cfa827a7bfb5ad9a (diff) |
Fix osx_cc_wrapper to also update dylibs
In https://github.com/bazelbuild/bazel/commit/f426544e67170d31b9d228ecf4cdc4b6ce1ba00d I updated osx_cc_wrapper to work correctly in case both
precompiled .so and cc_library-made .so are linked into a single binary. This cl
makes osx_cc_wrapper work also when a precompiled .dylib is provided.
This is roll-forward of https://github.com/bazelbuild/bazel/commit/0257c29f496719bb8414d012334155de6bbefa11.
Fixes #3450 again for dylibs
Fixes #407
One step closer to finishing #1576
RELNOTES: None.
PiperOrigin-RevId: 171969333
Diffstat (limited to 'src')
-rwxr-xr-x | src/test/shell/bazel/cpp_darwin_integration_test.sh | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/test/shell/bazel/cpp_darwin_integration_test.sh b/src/test/shell/bazel/cpp_darwin_integration_test.sh index 8b5eabb7c9..08cf924f0f 100755 --- a/src/test/shell/bazel/cpp_darwin_integration_test.sh +++ b/src/test/shell/bazel/cpp_darwin_integration_test.sh @@ -30,22 +30,49 @@ cc_library( ) cc_binary( name = "libbar.so", + srcs = [ "bar.cc" ], + linkshared = 1, +) +cc_binary( + name = "libbaz.dylib", + srcs = [ "baz.cc" ], linkshared = 1, ) cc_test( name = "test", - srcs = [ "test.cc", ":libbar.so" ], + srcs = [ "test.cc", ":libbar.so", ":libbaz.dylib" ], deps = [":foo"], ) EOF cat > cpp/rpaths/foo.cc <<EOF - int foo() { return 42; } + int foo() { return 2; } +EOF + cat > cpp/rpaths/bar.cc <<EOF + int bar() { return 12; } +EOF + cat > cpp/rpaths/baz.cc <<EOF + int baz() { return 42; } EOF cat > cpp/rpaths/test.cc <<EOF - int main() {} + int foo(); + int bar(); + int baz(); + int main() { + int result = foo() + bar() + baz(); + if (result == 56) { + return 0; + } else { + return result; + } + } EOF assert_build //cpp/rpaths:test >& $TEST_log || fail "//cpp/rpaths:test didn't build" - ./bazel-bin/cpp/rpaths/test >& $TEST_log || fail "//cpp/rpaths:test execution failed" + # Paths originally hardcoded in the binary assume workspace directory. Let's change the + # directory and execute the binary to test whether the paths in the binary have been + # updated to use @loader_path. + cd bazel-bin + ./cpp/rpaths/test >& $TEST_log || \ + fail "//cpp/rpaths:test execution failed, expected to return 0, but got $?" } run_suite "Tests for Bazel's C++ rules on Darwin" |