[libcxx-commits] [libcxx] 8f55578 - [libc++] Link back-deployment tests against the latest libc++ and libc++abi

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 21 11:47:14 PDT 2020


Author: Louis Dionne
Date: 2020-05-21T14:47:04-04:00
New Revision: 8f555780ef3502021a0237a6ace100f728fd0f5b

URL: https://github.com/llvm/llvm-project/commit/8f555780ef3502021a0237a6ace100f728fd0f5b
DIFF: https://github.com/llvm/llvm-project/commit/8f555780ef3502021a0237a6ace100f728fd0f5b.diff

LOG: [libc++] Link back-deployment tests against the latest libc++ and libc++abi

Instead of linking the tests against a library in some version of the
SDK, always link against the latest library, but still run against the
specified back-deployment target dylib.

This makes more sense since what we're really trying to test is that
the current library can be used to produce binaries that run on some
deployment target -- not that linking against the library in some
previous SDK makes that possible.

This solves an additional issue that when linking against a system dylib,
the -rpath argument given to the tests is ignored because the install_name
of the system library we link against is absolute.

rdar://63241847

Added: 
    

Modified: 
    libcxx/utils/ci/macos-backdeployment.sh

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/ci/macos-backdeployment.sh b/libcxx/utils/ci/macos-backdeployment.sh
index 71687c2f521e..4ed3bda2e3af 100755
--- a/libcxx/utils/ci/macos-backdeployment.sh
+++ b/libcxx/utils/ci/macos-backdeployment.sh
@@ -4,14 +4,15 @@ set -ue
 
 function usage() {
   cat <<EOM
-$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --deployment-target <TARGET> --sdk-version <SDK-VERSION> [--libcxx-roots <DIR>] [--lit-args <ARGS...>] [--no-cleanup]
+$(basename ${0}) [-h|--help] --monorepo-root <MONOREPO-ROOT> --std <STD> --deployment-target <TARGET> [--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.
 
+Specifically, this script runs the libc++ test suite against the just-built headers and linking against the just-built dylib, but it runs the tests against the dylibs for the given deployment target.
+
   --monorepo-root     Full path to the root of the LLVM monorepo. Both libc++ and libc++abi headers from the monorepo are used.
   --std               Version of the C++ Standard to run the tests under (c++03, c++11, etc..).
   --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.
@@ -19,14 +20,6 @@ This script is used to continually test the back-deployment use case of libc++ a
 EOM
 }
 
-function version-less-equal() {
-    [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
-}
-
-function version-less() {
-    [ "$1" = "$2" ] && return 1 || version-less-equal $1 $2
-}
-
 while [[ $# -gt 0 ]]; do
   case "$1" in
     --monorepo-root)
@@ -46,10 +39,6 @@ while [[ $# -gt 0 ]]; do
     DEPLOYMENT_TARGET="${2}"
     shift; shift
     ;;
-    --sdk-version)
-    MACOS_SDK_VERSION="${2}"
-    shift; shift
-    ;;
     --lit-args)
     ADDITIONAL_LIT_ARGS="${2}"
     shift; shift
@@ -77,16 +66,9 @@ done
 if [[ -z ${MONOREPO_ROOT+x} ]]; then echo "--monorepo-root is a required parameter"; usage; exit 1; fi
 if [[ -z ${STD+x} ]]; then echo "--std is a required parameter"; usage; exit 1; fi
 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})"
-  usage
-  exit 1
-fi
-
 TEMP_DIR="$(mktemp -d)"
 echo "Created temporary directory ${TEMP_DIR}"
 function cleanup {
@@ -121,12 +103,11 @@ mkdir -p "${LLVM_BUILD_DIR}"
 echo "@@@@@@"
 
 
-echo "@@@ Installing the latest libc++ headers @@@"
-ninja -C "${LLVM_BUILD_DIR}" install-cxx-headers
+echo "@@@ Building and installing libc++ and libc++abi @@@"
+ninja -C "${LLVM_BUILD_DIR}" install-cxx install-cxxabi
 echo "@@@@@@"
 
 
-# TODO: We should also link against the libc++abi.dylib that was shipped in the SDK
 if [[ ${PREVIOUS_DYLIBS_DIR} == "" ]]; then
   echo "@@@ Downloading dylibs for older deployment targets @@@"
   PREVIOUS_DYLIBS_DIR="${TEMP_DIR}/libcxx-dylibs"
@@ -137,7 +118,6 @@ fi
 
 LIBCXX_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++/${DEPLOYMENT_TARGET}"
 LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET="${PREVIOUS_DYLIBS_DIR}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
-LIBCXX_ROOT_IN_SDK="${PREVIOUS_DYLIBS_DIR}/macOS/libc++/${MACOS_SDK_VERSION}"
 
 # TODO: We need to also run the tests for libc++abi.
 echo "@@@ Running tests for libc++ @@@"
@@ -146,7 +126,7 @@ echo "@@@ Running tests for libc++ @@@"
                                  --param=cxx_headers="${LLVM_INSTALL_DIR}/include/c++/v1" \
                                  --param=std="${STD}" \
                                  --param=platform="macosx${DEPLOYMENT_TARGET}" \
-                                 --param=cxx_library_root="${LIBCXX_ROOT_IN_SDK}" \
+                                 --param=cxx_library_root="${LLVM_INSTALL_DIR}/lib" \
                                  --param=cxx_runtime_root="${LIBCXX_ROOT_ON_DEPLOYMENT_TARGET}" \
                                  --param=abi_library_path="${LIBCXXABI_ROOT_ON_DEPLOYMENT_TARGET}" \
                                  --param=use_system_cxx_lib="True" \


        


More information about the libcxx-commits mailing list