[libcxx-commits] [libcxx] 3790e17 - [libc++] Allow customizing a few paths when running build bots

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 5 16:03:38 PST 2020


Author: Louis Dionne
Date: 2020-11-05T19:02:32-05:00
New Revision: 3790e17f461e5de60e6f802497d96b7de036e0b2

URL: https://github.com/llvm/llvm-project/commit/3790e17f461e5de60e6f802497d96b7de036e0b2
DIFF: https://github.com/llvm/llvm-project/commit/3790e17f461e5de60e6f802497d96b7de036e0b2.diff

LOG: [libc++] Allow customizing a few paths when running build bots

This allows reusing run-buildbot for downstream testing as well.

Added: 
    libcxx/utils/ci/run-buildbot

Modified: 
    libcxx/utils/ci/buildkite-pipeline.yml

Removed: 
    libcxx/utils/ci/run-buildbot.sh


################################################################################
diff  --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index 9d560f6c14b9..a0672f9d1ab3 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -16,7 +16,7 @@
 
 steps:
   - label: "C++03"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx03"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx03"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -27,7 +27,7 @@ steps:
           limit: 2
 
   - label: "C++11"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx11"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx11"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -38,7 +38,7 @@ steps:
           limit: 2
 
   - label: "C++14"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx14"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx14"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -49,7 +49,7 @@ steps:
           limit: 2
 
   - label: "C++17"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx17"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx17"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -60,7 +60,7 @@ steps:
           limit: 2
 
   - label: "C++20"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx2a"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx2a"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -71,7 +71,7 @@ steps:
           limit: 2
 
   - label: "-fno-exceptions"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-noexceptions"
+    command: "libcxx/utils/ci/run-buildbot generic-noexceptions"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -82,7 +82,7 @@ steps:
           limit: 2
 
   - label: "GCC/C++20"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-gcc"
+    command: "libcxx/utils/ci/run-buildbot generic-gcc"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -93,7 +93,7 @@ steps:
           limit: 2
 
   - label: "ASAN"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-asan"
+    command: "libcxx/utils/ci/run-buildbot generic-asan"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -104,7 +104,7 @@ steps:
           limit: 2
 
   - label: "TSAN"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-tsan"
+    command: "libcxx/utils/ci/run-buildbot generic-tsan"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -115,7 +115,7 @@ steps:
           limit: 2
 
   - label: "UBSAN"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-ubsan"
+    command: "libcxx/utils/ci/run-buildbot generic-ubsan"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -126,7 +126,7 @@ steps:
           limit: 2
 
   - label: "With LLVM's libunwind"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-with_llvm_unwinder"
+    command: "libcxx/utils/ci/run-buildbot generic-with_llvm_unwinder"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -137,7 +137,7 @@ steps:
           limit: 2
 
   - label: "Single-threaded"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-singlethreaded"
+    command: "libcxx/utils/ci/run-buildbot generic-singlethreaded"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -148,7 +148,7 @@ steps:
           limit: 2
 
   - label: "No debug mode"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-nodebug"
+    command: "libcxx/utils/ci/run-buildbot generic-nodebug"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -159,7 +159,7 @@ steps:
           limit: 2
 
   - label: "No random device"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-no-random_device"
+    command: "libcxx/utils/ci/run-buildbot generic-no-random_device"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -170,7 +170,7 @@ steps:
           limit: 2
 
   - label: "No locale"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-no-localization"
+    command: "libcxx/utils/ci/run-buildbot generic-no-localization"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -181,7 +181,7 @@ steps:
           limit: 2
 
   - label: "MacOS C++20"
-    command: "libcxx/utils/ci/run-buildbot.sh generic-cxx2a"
+    command: "libcxx/utils/ci/run-buildbot generic-cxx2a"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -192,7 +192,7 @@ steps:
           limit: 2
 
   - label: "Benchmarks"
-    command: "libcxx/utils/ci/run-buildbot.sh benchmarks"
+    command: "libcxx/utils/ci/run-buildbot benchmarks"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -203,7 +203,7 @@ steps:
           limit: 2
 
   - label: "Documentation"
-    command: "libcxx/utils/ci/run-buildbot.sh documentation"
+    command: "libcxx/utils/ci/run-buildbot documentation"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -214,7 +214,7 @@ steps:
           limit: 2
 
   - label: "Legacy standalone build"
-    command: "libcxx/utils/ci/run-buildbot.sh legacy-standalone"
+    command: "libcxx/utils/ci/run-buildbot legacy-standalone"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -225,7 +225,7 @@ steps:
           limit: 2
 
   - label: "Unified standalone build"
-    command: "libcxx/utils/ci/run-buildbot.sh unified-standalone"
+    command: "libcxx/utils/ci/run-buildbot unified-standalone"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -237,7 +237,7 @@ steps:
 
   # Build with the configuration we use to generate libc++.dylib on Apple platforms
   - label: "Apple system"
-    command: "libcxx/utils/ci/run-buildbot.sh x86_64-apple-system"
+    command: "libcxx/utils/ci/run-buildbot x86_64-apple-system"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -248,7 +248,7 @@ steps:
           limit: 2
 
   - label: "Apple system -fno-exceptions"
-    command: "libcxx/utils/ci/run-buildbot.sh x86_64-apple-system-noexceptions"
+    command: "libcxx/utils/ci/run-buildbot x86_64-apple-system-noexceptions"
     artifact_paths:
       - "**/test-results.xml"
     agents:
@@ -260,7 +260,7 @@ steps:
 
   # Test back-deployment to older Apple platforms
   - label: "Apple back-deployment macosx10.9"
-    command: "libcxx/utils/ci/run-buildbot.sh x86_64-apple-system-backdeployment-10.9"
+    command: "libcxx/utils/ci/run-buildbot x86_64-apple-system-backdeployment-10.9"
     artifact_paths:
       - "**/test-results.xml"
     agents:

diff  --git a/libcxx/utils/ci/run-buildbot.sh b/libcxx/utils/ci/run-buildbot
similarity index 71%
rename from libcxx/utils/ci/run-buildbot.sh
rename to libcxx/utils/ci/run-buildbot
index f22d2a69cc79..e1065d161555 100755
--- a/libcxx/utils/ci/run-buildbot.sh
+++ b/libcxx/utils/ci/run-buildbot
@@ -9,14 +9,56 @@
 
 set -ex
 
-BUILDER="${1}"
-MONOREPO_ROOT="$(git rev-parse --show-toplevel)"
+PROGNAME="$(basename "${0}")"
+
+function usage() {
+cat <<EOF
+Usage:
+${PROGNAME} [options] <BUILDER>
+
+[-h|--help]         Display this help and exit.
+
+--llvm-root <DIR>   Path to the root of the LLVM monorepo. By default, we try
+                    to figure it out based on the current working directory.
+
+--osx-roots <DIR>   Path to pre-downloaded macOS dylibs. By default, we download
+                    them from Green Dragon. This is only relevant at all when
+                    running back-deployment testing if one wants to override
+                    the old dylibs we use to run the tests with 
diff erent ones.
+EOF
+}
+
+while [[ $# -gt 0 ]]; do
+    case ${1} in
+        -h|--help)
+            usage
+            exit 0
+            ;;
+        --llvm-root)
+            MONOREPO_ROOT="${2}"
+            shift; shift
+            ;;
+        --osx-roots)
+            OSX_ROOTS="${2}"
+            shift; shift
+            ;;
+        *)
+            BUILDER="${1}"
+            shift
+            ;;
+    esac
+done
+
+MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
 BUILD_DIR="${MONOREPO_ROOT}/build/${BUILDER}"
 INSTALL_DIR="${MONOREPO_ROOT}/build/${BUILDER}/install"
 
+function clean() {
+    rm -rf "${BUILD_DIR}"
+}
+
 function generate-cmake() {
     echo "--- Generating CMake"
-    rm -rf "${BUILD_DIR}"
     cmake -S "${MONOREPO_ROOT}/llvm" \
           -B "${BUILD_DIR}" \
           -GNinja \
@@ -28,13 +70,6 @@ function generate-cmake() {
           "${@}"
 }
 
-function download-osx-roots() {
-  echo "--- Downloading previous macOS dylibs"
-  PREVIOUS_DYLIBS_URL="http://lab.llvm.org:8080/roots/libcxx-roots.tar.gz"
-  mkdir -p "${BUILD_DIR}/macos-roots"
-  curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${BUILD_DIR}/macos-roots"
-}
-
 function check-cxx-cxxabi() {
     echo "+++ Running the libc++ tests"
     ninja -C "${BUILD_DIR}" check-cxx
@@ -55,48 +90,56 @@ case "${BUILDER}" in
 generic-cxx03)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
     check-cxx-cxxabi
 ;;
 generic-cxx11)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
     check-cxx-cxxabi
 ;;
 generic-cxx14)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
     check-cxx-cxxabi
 ;;
 generic-cxx17)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
     check-cxx-cxxabi
 ;;
 generic-cxx2a)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx2a.cmake"
     check-cxx-cxxabi
 ;;
 generic-noexceptions)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-noexceptions.cmake"
     check-cxx-cxxabi
 ;;
 generic-32bit)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-32bits.cmake"
     check-cxx-cxxabi
 ;;
 generic-gcc)
     export CC=gcc
     export CXX=g++
+    clean
     # FIXME: Re-enable experimental testing on GCC. GCC cares about the order
     #        in which we link -lc++experimental, which causes issues.
     generate-cmake -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=OFF
@@ -105,112 +148,136 @@ generic-gcc)
 generic-asan)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
     check-cxx-cxxabi
 ;;
 generic-msan)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
     check-cxx-cxxabi
 ;;
 generic-tsan)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
     check-cxx-cxxabi
 ;;
 generic-ubsan)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
     check-cxx-cxxabi
 ;;
 generic-with_llvm_unwinder)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -DLIBCXXABI_USE_LLVM_UNWINDER=ON
     check-cxx-cxxabi
 ;;
 generic-singlethreaded)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-singlethreaded.cmake"
     check-cxx-cxxabi
 ;;
 generic-nodebug)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-nodebug.cmake"
     check-cxx-cxxabi
 ;;
 generic-no-random_device)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
     check-cxx-cxxabi
 ;;
 generic-no-localization)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
     check-cxx-cxxabi
 ;;
 x86_64-apple-system)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake"
     check-cxx-cxxabi
 ;;
 x86_64-apple-system-noexceptions)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
                    -DLIBCXX_ENABLE_EXCEPTIONS=OFF \
                    -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
     check-cxx-cxxabi
 ;;
 x86_64-apple-system-backdeployment-*)
-  DEPLOYMENT_TARGET="${BUILDER#x86_64-apple-system-backdeployment-}"
-  PARAMS="target_triple=x86_64-apple-macosx${DEPLOYMENT_TARGET}"
-  PARAMS+=";cxx_runtime_root=${BUILD_DIR}/macos-roots/macOS/libc++/${DEPLOYMENT_TARGET}"
-  PARAMS+=";abi_library_path=${BUILD_DIR}/macos-roots/macOS/libc++abi/${DEPLOYMENT_TARGET}"
-  PARAMS+=";use_system_cxx_lib=True"
-  # Filesystem is supported on Apple platforms starting with macosx10.15.
-  if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then
-      PARAMS+=";enable_filesystem=False"
-  fi
+    clean
+
+    if [[ "${OSX_ROOTS}" == "" ]]; then
+        echo "--- Downloading previous macOS dylibs"
+        PREVIOUS_DYLIBS_URL="http://lab.llvm.org:8080/roots/libcxx-roots.tar.gz"
+        OSX_ROOTS="${BUILD_DIR}/macos-roots"
+        mkdir -p "${OSX_ROOTS}"
+        curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${OSX_ROOTS}"
+    fi
 
-  export CC=clang
-  export CXX=clang++
-  generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
-                 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
-                 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
-  download-osx-roots
+    DEPLOYMENT_TARGET="${BUILDER#x86_64-apple-system-backdeployment-}"
+    PARAMS="target_triple=x86_64-apple-macosx${DEPLOYMENT_TARGET}"
+    PARAMS+=";cxx_runtime_root=${OSX_ROOTS}/macOS/libc++/${DEPLOYMENT_TARGET}"
+    PARAMS+=";abi_library_path=${OSX_ROOTS}/macOS/libc++abi/${DEPLOYMENT_TARGET}"
+    PARAMS+=";use_system_cxx_lib=True"
+    # Filesystem is supported on Apple platforms starting with macosx10.15.
+    if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then
+        PARAMS+=";enable_filesystem=False"
+    fi
 
-  # TODO: Also run the libc++abi tests
-  echo "+++ Running the libc++ tests"
-  ninja -C "${BUILD_DIR}" check-cxx
+    export CC=clang
+    export CXX=clang++
+    generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
+                   -DLIBCXX_TEST_PARAMS="${PARAMS}" \
+                   -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
+
+    # TODO: Also run the libc++abi tests
+    echo "+++ Running the libc++ tests"
+    ninja -C "${BUILD_DIR}" check-cxx
 ;;
 benchmarks)
     export CC=clang
     export CXX=clang++
+    clean
     generate-cmake
     check-cxx-benchmarks
 ;;
 documentation)
-  export CC=clang
-  export CXX=clang++
-  generate-cmake -DLLVM_ENABLE_SPHINX=ON
-  echo "+++ Generating documentation"
-  ninja -C "${BUILD_DIR}" docs-libcxx-html
+    export CC=clang
+    export CXX=clang++
+    clean
+    generate-cmake -DLLVM_ENABLE_SPHINX=ON
+
+    echo "+++ Generating documentation"
+    ninja -C "${BUILD_DIR}" docs-libcxx-html
 ;;
 unified-standalone)
     export CC=clang
     export CXX=clang++
 
+    clean
+
     echo "--- Generating CMake"
-    rm -rf "${BUILD_DIR}"
     cmake -S "${MONOREPO_ROOT}/libcxx/utils/ci/runtimes" \
           -B "${BUILD_DIR}" \
           -GNinja \
@@ -224,8 +291,9 @@ legacy-standalone)
     export CC=clang
     export CXX=clang++
 
+    clean
+
     echo "--- Generating CMake"
-    rm -rf "${BUILD_DIR}"
     cmake -S "${MONOREPO_ROOT}/libcxx" \
           -B "${BUILD_DIR}/libcxx" \
           -GNinja \


        


More information about the libcxx-commits mailing list