Adapt tests to new cc_binary file extension on macOS (#834)

As of https://github.com/bazelbuild/bazel/pull/14369, shared libraries
produced with cc_binary on macOS with the auto-configured toolchain use
the correct file extension for dynamic libraries
(.dylib rather than .so). This requires adapting a test.
This commit is contained in:
Fabian Meumertzheim 2021-12-07 00:50:55 +01:00 committed by GitHub
parent ebfeaa08f8
commit 40b03b42eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -20,7 +20,13 @@ int main(int argc, char* argv[])
#ifdef _WIN32
test_opening_file(".\\cmake_with_data\\lib_b\\lib_b.dll");
#else
// Shared libraries used to have the .so file extension on macOS.
// See https://github.com/bazelbuild/bazel/pull/14369.
try {
test_opening_file("./cmake_with_data/lib_b/liblib_b.so");
} catch (std::runtime_error& e) {
test_opening_file("./cmake_with_data/lib_b/liblib_b.dylib");
}
#endif
std::cout << "Everything's fine!";
}