Skip to content

Commit

Permalink
[libc++] CI: Allow pointing to specific dylib roots during backdeploy…
Browse files Browse the repository at this point in the history
…ment testing

This can be useful when the CI jobs don't have internet access.
  • Loading branch information
ldionne committed Apr 14, 2020
1 parent 6a7e958 commit 509cbc2
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions libcxx/utils/ci/macos-backdeployment.sh
Expand Up @@ -4,7 +4,7 @@ set -ue

function usage() {
cat <<EOM
$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --arch <ARCHITECTURE> --deployment-target <TARGET> --sdk-version <SDK-VERSION> [--lit-args <ARGS...>]
$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --arch <ARCHITECTURE> --deployment-target <TARGET> --sdk-version <SDK-VERSION> [--libcxx-roots <DIR>] [--lit-args <ARGS...>] [--no-cleanup]
This script is used to continually test the back-deployment use case of libc++ and libc++abi on MacOS.
Expand All @@ -13,6 +13,7 @@ This script is used to continually test the back-deployment use case of libc++ a
--arch Architecture to build the tests for (32, 64).
--deployment-target The deployment target to run the tests for. This should be a version number of MacOS (e.g. 10.12). All MacOS versions until and including 10.9 are supported.
--sdk-version The version of the SDK to test with. This should be a version number of MacOS (e.g. 10.12). We'll link against the libc++ dylib in that SDK, but we'll run against the one on the given deployment target. The SDK version must be no older than the deployment target.
[--libcxx-roots] The path to previous libc++/libc++abi dylibs to use for back-deployment testing. Those are normally downloaded automatically, but if specified, this option will override the directory used. The directory should have the same layout as the roots downloaded automatically.
[--lit-args] Additional arguments to pass to lit (optional). If there are multiple arguments, quote them to pass them as a single argument to this script.
[--no-cleanup] Do not cleanup the temporary directory that was used for testing at the end. This can be useful to debug failures. Make sure to clean up manually after.
[-h, --help] Print this help.
Expand Down Expand Up @@ -58,6 +59,10 @@ while [[ $# -gt 0 ]]; do
ADDITIONAL_LIT_ARGS="${2}"
shift; shift
;;
--libcxx-roots)
PREVIOUS_DYLIBS_DIR="${2}"
shift; shift
;;
--no-cleanup)
NO_CLEANUP=""
shift
Expand All @@ -80,6 +85,7 @@ if [[ -z ${ARCH+x} ]]; then echo "--arch is a required parameter"; usage; exit 1
if [[ -z ${DEPLOYMENT_TARGET+x} ]]; then echo "--deployment-target is a required parameter"; usage; exit 1; fi
if [[ -z ${MACOS_SDK_VERSION+x} ]]; then echo "--sdk-version is a required parameter"; usage; exit 1; fi
if [[ -z ${ADDITIONAL_LIT_ARGS+x} ]]; then ADDITIONAL_LIT_ARGS=""; fi
if [[ -z ${PREVIOUS_DYLIBS_DIR+x} ]]; then PREVIOUS_DYLIBS_DIR=""; fi

if version-less "${MACOS_SDK_VERSION}" "${DEPLOYMENT_TARGET}"; then
echo "SDK version ${MACOS_SDK_VERSION} shouldn't be older than the deployment target (${DEPLOYMENT_TARGET})"
Expand Down Expand Up @@ -134,16 +140,18 @@ ninja -C "${LLVM_BUILD_DIR}" install-cxx-headers
echo "@@@@@@"


echo "@@@ Downloading dylibs for older deployment targets @@@"
# TODO: We should also link against the libc++abi.dylib that was shipped in the SDK
PREVIOUS_DYLIBS_DIR="${TEMP_DIR}/libcxx-dylibs"
mkdir "${PREVIOUS_DYLIBS_DIR}"
curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${PREVIOUS_DYLIBS_DIR}"
if [[ ${PREVIOUS_DYLIBS_DIR} == "" ]]; then
echo "@@@ Downloading dylibs for older deployment targets @@@"
PREVIOUS_DYLIBS_DIR="${TEMP_DIR}/libcxx-dylibs"
mkdir "${PREVIOUS_DYLIBS_DIR}"
curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${PREVIOUS_DYLIBS_DIR}"
echo "@@@@@@"
fi

LIBCXX_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/${DEPLOYMENT_TARGET}/libc++.dylib"
LIBCXXABI_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/${DEPLOYMENT_TARGET}/libc++abi.dylib"
LIBCXX_IN_SDK="${PREVIOUS_DYLIBS_DIR}/macOS/${MACOS_SDK_VERSION}/libc++.dylib"
echo "@@@@@@"


# TODO: We need to also run the tests for libc++abi.
echo "@@@ Running tests for libc++ @@@"
Expand Down

0 comments on commit 509cbc2

Please sign in to comment.