Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc++][libc++abi] Add tests for vendor-specific properties
Vendors take libc++ and ship it in various ways. Some vendors might ship it differently from what upstream LLVM does, i.e. the install location might be different, some ABI properties might differ, etc. In the past few years, I've come across several instances where having a place to test some of these properties would have been incredibly useful. I also just got bitten by the lack of tests of that kind, so I'm adding some now. The tests added by this commit for Apple platforms have numerous TODOs that capture discrepancies between the upstream LLVM CMake and the slightly-modified build we perform internally to produce Apple's system libc++. In the future, the goal would be to upstream all those differences so that it's possible to build a faithful Apple system libc++ with the upstream LLVM sources only. But this isn't only useful for Apple - this lays out the path for any vendor being able to add their own checks (either upstream or downstream) to libc++. Differential Revision: https://reviews.llvm.org/D110736
- Loading branch information
Showing
23 changed files
with
135 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
libcxx/test/libcxx/vendor/apple/system-install-properties.sh.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: stdlib=apple-libc++ | ||
|
||
// This file checks various properties of the installation of libc++ when built as | ||
// a system library on Apple platforms. | ||
// | ||
// TODO: We should install to `<prefix>/usr` in CMake and check that path instead. | ||
|
||
// Make sure we install the libc++ headers in the right location. | ||
// | ||
// RUN: stat "%{install}/include/c++/v1/__config" | ||
|
||
// Make sure we install libc++.1.dylib in the right location. | ||
// | ||
// RUN: stat "%{install}/lib/libc++.1.dylib" | ||
|
||
// Make sure we install a symlink from libc++.dylib to libc++.1.dylib. | ||
// | ||
// RUN: stat "%{install}/lib/libc++.dylib" | ||
// RUN: readlink "%{install}/lib/libc++.dylib" | grep "libc++.1.dylib" | ||
|
||
// Make sure the install_name is /usr/lib. | ||
// | ||
// In particular, make sure we don't use any @rpath in the load commands. When building as | ||
// a system library, it is important to hardcode the installation paths in the dylib, because | ||
// various tools like dyld and ld64 will treat us specially if they recognize us as being a | ||
// system library. | ||
// | ||
// TODO: We currently don't do that correctly in the CMake build. | ||
// | ||
// XRUNX: otool -L "%{install}/lib/libc++.1.dylib" | grep '/usr/lib/libc++.1.dylib' | ||
// XRUNX: ! otool -l "%{install}/lib/libc++.1.dylib" | grep -E "LC_RPATH|@loader_path|@rpath" | ||
|
||
// Make sure the compatibility_version of libc++ is 1.0.0. | ||
// Failure to respect this can result in applications not being able to find libc++ | ||
// when they are loaded by dyld, if the compatibility version was bumped. | ||
// | ||
// RUN: otool -L "%{install}/lib/libc++.1.dylib" | grep "libc++.1.dylib" | grep "compatibility version 1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
libcxxabi/test/vendor/apple/system-install-properties.sh.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
// REQUIRES: stdlib=apple-libc++ | ||
|
||
// This file checks various properties of the installation of libc++abi when built | ||
// as a system library on Apple platforms. | ||
// | ||
// TODO: We should install to `<prefix>/usr` in CMake and check that path instead. | ||
|
||
// Make sure we install the libc++abi headers in the right location. | ||
// TODO: We don't currently install them, but we should. | ||
// | ||
// XRUNX: stat "%{install}/include/cxxabi.h" | ||
|
||
// Make sure we install libc++abi.dylib in the right location. | ||
// | ||
// RUN: stat "%{install}/lib/libc++abi.dylib" | ||
|
||
// Make sure we don't install a symlink from libc++abi.dylib to libc++abi.1.dylib, | ||
// unlike what we do for libc++.dylib. | ||
// TODO: We currently don't do that correctly in the CMake build. | ||
// | ||
// XRUNX: ! readlink "%{install}/lib/libc++abi.dylib" | ||
// XRUNX: ! stat "%{install}/lib/libc++abi.1.dylib" | ||
|
||
// Make sure the install_name is /usr/lib. | ||
// | ||
// In particular, make sure we don't use any @rpath in the load commands. When building as | ||
// a system library, it is important to hardcode the installation paths in the dylib, because | ||
// various tools like dyld and ld64 will treat us specially if they recognize us as being a | ||
// system library. | ||
// | ||
// TODO: We currently don't do that correctly in the CMake build. | ||
// | ||
// XRUNX: otool -L "%{install}/lib/libc++abi.dylib" | grep '/usr/lib/libc++abi.dylib' | ||
// XRUNX: ! otool -l "%{install}/lib/libc++abi.dylib" | grep -E "LC_RPATH|@loader_path|@rpath" | ||
|
||
// Make sure the compatibility_version of libc++abi is 1.0.0. Failure to respect this can result | ||
// in applications not being able to find libc++abi when they are loaded by dyld, if the | ||
// compatibility version was bumped. | ||
// | ||
// RUN: otool -L "%{install}/lib/libc++abi.dylib" | grep "libc++abi.1.dylib" | grep "compatibility version 1.0.0" |