2020-09-23 09:20:03 -04:00
|
|
|
#!/usr/bin/env bash
|
2024-09-04 16:47:20 -04:00
|
|
|
# ===----------------------------------------------------------------------===##
|
2020-09-23 09:20:03 -04:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
2024-09-04 16:47:20 -04:00
|
|
|
# ===----------------------------------------------------------------------===##
|
2020-09-23 09:20:03 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
set -e
|
2021-02-04 21:13:22 +01:00
|
|
|
set -o pipefail
|
2021-04-30 14:43:33 -04:00
|
|
|
unset LANG
|
|
|
|
unset LC_ALL
|
|
|
|
unset LC_COLLATE
|
2020-09-23 09:20:03 -04:00
|
|
|
|
2020-11-05 19:02:32 -05:00
|
|
|
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.
|
|
|
|
|
2020-11-05 19:09:03 -05:00
|
|
|
--build-dir <DIR> The directory to use for building the library. By default,
|
|
|
|
this is '<llvm-root>/build/<builder>'.
|
|
|
|
|
2022-12-22 19:47:54 +01:00
|
|
|
Environment variables
|
|
|
|
CC The C compiler to use, this value is used by CMake. This
|
|
|
|
variable is optional.
|
2023-02-28 20:29:26 +01:00
|
|
|
|
2022-12-22 19:47:54 +01:00
|
|
|
CXX The C++ compiler to use, this value is used by CMake. This
|
|
|
|
variable is optional.
|
|
|
|
|
2023-02-28 20:29:26 +01:00
|
|
|
CMAKE The CMake binary to use. This variable is optional.
|
|
|
|
|
[libc++] Enforce formatting for already formatted and new files and ignore the formatting of tests
It is quite confusing to newcomers that the formatting check gets mostly ignored. To fix that, enforce the formatting for new file and already formatted files, but ignore it for any files that aren't formatted already. We ignore the tests for now, since almost no test is formatted currently, and they are changed almost never.
Reviewed By: ldionne, Mordante, #libc
Spies: arichardson, fedor.sergeev, phosek, sstefan1, libcxx-commits, abrachet
Differential Revision: https://reviews.llvm.org/D142180
2023-01-20 07:42:44 +01:00
|
|
|
CLANG_FORMAT The clang-format binary to use when generating the format
|
|
|
|
ignore list.
|
|
|
|
|
2020-11-05 19:02:32 -05:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2022-12-22 19:47:54 +01:00
|
|
|
if [[ $# == 0 ]]; then
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2020-11-05 19:02:32 -05:00
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
case ${1} in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--llvm-root)
|
|
|
|
MONOREPO_ROOT="${2}"
|
|
|
|
shift; shift
|
|
|
|
;;
|
2020-11-05 19:09:03 -05:00
|
|
|
--build-dir)
|
|
|
|
BUILD_DIR="${2}"
|
|
|
|
shift; shift
|
|
|
|
;;
|
2020-11-05 19:02:32 -05:00
|
|
|
*)
|
|
|
|
BUILDER="${1}"
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
|
2020-11-05 19:09:03 -05:00
|
|
|
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build/${BUILDER}}"
|
2021-01-07 17:37:09 -05:00
|
|
|
INSTALL_DIR="${BUILD_DIR}/install"
|
2020-09-23 09:20:03 -04:00
|
|
|
|
2021-05-07 13:14:57 -04:00
|
|
|
# If we can find Ninja/CMake provided by Xcode, use those since we know their
|
|
|
|
# version will generally work with the Clang shipped in Xcode (e.g. if Clang
|
|
|
|
# knows about -std=c++20, the CMake bundled in Xcode will probably know about
|
|
|
|
# that flag too).
|
2023-02-28 20:29:26 +01:00
|
|
|
if xcrun --find ninja &>/dev/null; then
|
|
|
|
NINJA="$(xcrun --find ninja)"
|
|
|
|
elif which ninja &>/dev/null; then
|
|
|
|
# The current implementation of modules needs the absolute path to the ninja
|
|
|
|
# binary.
|
|
|
|
# TODO MODULES Is this still needed when CMake has libc++ module support?
|
|
|
|
NINJA="$(which ninja)"
|
|
|
|
else
|
|
|
|
NINJA="ninja"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "${CMAKE}" ]; then
|
|
|
|
if xcrun --find cmake &>/dev/null; then
|
|
|
|
CMAKE="$(xcrun --find cmake)"
|
|
|
|
else
|
|
|
|
CMAKE="cmake"
|
|
|
|
fi
|
|
|
|
fi
|
2021-03-04 16:01:36 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
function step() {
|
|
|
|
endstep
|
|
|
|
set +x
|
|
|
|
if [[ ! -z ${GITHUB_ACTIONS+x} ]]; then
|
|
|
|
echo "::group::$1"
|
|
|
|
export IN_GROUP=1
|
|
|
|
else
|
|
|
|
echo "--- $1"
|
|
|
|
fi
|
|
|
|
set -x
|
|
|
|
}
|
|
|
|
|
|
|
|
function endstep() {
|
|
|
|
set +x
|
|
|
|
if [[ ! -z ${GITHUB_ACTIONS+x} ]] && [[ ! -z ${IN_GROUP+x} ]]; then
|
|
|
|
echo "::endgroup::"
|
|
|
|
unset IN_GROUP
|
|
|
|
fi
|
|
|
|
set -x
|
|
|
|
}
|
|
|
|
|
|
|
|
function error() {
|
|
|
|
echo "::error::$1"
|
|
|
|
}
|
|
|
|
|
2020-11-05 19:02:32 -05:00
|
|
|
function clean() {
|
|
|
|
rm -rf "${BUILD_DIR}"
|
|
|
|
}
|
|
|
|
|
2021-04-06 00:17:30 +03:00
|
|
|
function generate-cmake-base() {
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Generating CMake"
|
2021-05-07 13:14:57 -04:00
|
|
|
${CMAKE} \
|
2021-10-07 16:19:11 -04:00
|
|
|
-S "${MONOREPO_ROOT}/runtimes" \
|
2020-10-23 10:02:14 -04:00
|
|
|
-B "${BUILD_DIR}" \
|
2021-03-04 16:01:36 -05:00
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
2020-10-23 10:02:14 -04:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
|
2022-02-10 13:08:24 +02:00
|
|
|
-DLIBCXX_ENABLE_WERROR=YES \
|
2022-03-31 11:51:30 +03:00
|
|
|
-DLIBCXXABI_ENABLE_WERROR=YES \
|
|
|
|
-DLIBUNWIND_ENABLE_WERROR=YES \
|
2023-10-25 18:10:29 -04:00
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
2021-04-06 00:17:30 +03:00
|
|
|
"${@}"
|
|
|
|
}
|
|
|
|
|
|
|
|
function generate-cmake() {
|
|
|
|
generate-cmake-base \
|
2021-10-07 16:19:11 -04:00
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
|
2020-10-23 10:02:14 -04:00
|
|
|
-DLIBCXX_CXX_ABI=libcxxabi \
|
2020-11-05 10:47:06 -05:00
|
|
|
"${@}"
|
|
|
|
}
|
|
|
|
|
2021-04-06 00:17:30 +03:00
|
|
|
function generate-cmake-libcxx-win() {
|
|
|
|
generate-cmake-base \
|
2021-10-07 16:19:11 -04:00
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx" \
|
2021-04-06 00:17:30 +03:00
|
|
|
-DCMAKE_C_COMPILER=clang-cl \
|
|
|
|
-DCMAKE_CXX_COMPILER=clang-cl \
|
|
|
|
"${@}"
|
|
|
|
}
|
|
|
|
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
function generate-cmake-android() {
|
|
|
|
generate-cmake-base \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
|
|
|
-DLIBCXX_CXX_ABI=libcxxabi \
|
|
|
|
"${@}"
|
|
|
|
}
|
|
|
|
|
2021-09-30 15:11:48 -04:00
|
|
|
function check-runtimes() {
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Building libc++ test dependencies"
|
|
|
|
${NINJA} -vC "${BUILD_DIR}" cxx-test-depends
|
|
|
|
|
|
|
|
step "Running the libc++ tests"
|
2021-03-19 16:26:15 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
2020-10-23 10:02:14 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++abi tests"
|
2021-03-19 16:26:15 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxxabi
|
2021-09-30 15:11:48 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libunwind tests"
|
2021-09-30 15:11:48 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-unwind
|
2020-10-23 10:02:14 -04:00
|
|
|
}
|
|
|
|
|
2020-11-26 15:00:42 -05:00
|
|
|
# TODO: The goal is to test this against all configurations. We should also move
|
|
|
|
# this to the Lit test suite instead of being a separate CMake target.
|
|
|
|
function check-abi-list() {
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ ABI list test"
|
2021-03-19 16:26:15 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx-abilist || (
|
2024-10-11 09:29:47 -04:00
|
|
|
error "Generating the libc++ ABI list after failed check"
|
2021-03-19 16:26:15 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" generate-cxx-abilist
|
2020-12-02 08:57:02 +01:00
|
|
|
false
|
|
|
|
)
|
2020-11-26 15:00:42 -05:00
|
|
|
}
|
|
|
|
|
2023-12-18 16:25:50 +01:00
|
|
|
function test-armv7m-picolibc() {
|
|
|
|
clean
|
|
|
|
|
|
|
|
# To make it easier to get this builder up and running, build picolibc
|
|
|
|
# from scratch. Anecdotally, the build-picolibc script takes about 16 seconds.
|
|
|
|
# This could be optimised by building picolibc into the Docker container.
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Building picolibc from source"
|
2023-12-18 16:25:50 +01:00
|
|
|
${MONOREPO_ROOT}/libcxx/utils/ci/build-picolibc.sh \
|
|
|
|
--build-dir "${BUILD_DIR}" \
|
|
|
|
--install-dir "${INSTALL_DIR}" \
|
|
|
|
--target armv7m-none-eabi
|
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Generating CMake for compiler-rt"
|
2023-12-18 16:25:50 +01:00
|
|
|
flags="--sysroot=${INSTALL_DIR}"
|
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/compiler-rt" \
|
|
|
|
-B "${BUILD_DIR}/compiler-rt" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
|
|
|
|
-DCMAKE_C_FLAGS="${flags}" \
|
|
|
|
-DCMAKE_CXX_FLAGS="${flags}" \
|
|
|
|
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON \
|
|
|
|
"${@}"
|
2024-10-11 09:29:47 -04:00
|
|
|
|
|
|
|
step "Generating CMake for libc++"
|
2023-12-18 16:25:50 +01:00
|
|
|
generate-cmake \
|
|
|
|
-DLIBCXX_TEST_CONFIG="armv7m-picolibc-libc++.cfg.in" \
|
|
|
|
-DLIBCXXABI_TEST_CONFIG="armv7m-picolibc-libc++abi.cfg.in" \
|
|
|
|
-DLIBUNWIND_TEST_CONFIG="armv7m-picolibc-libunwind.cfg.in" \
|
|
|
|
-DCMAKE_C_FLAGS="${flags}" \
|
|
|
|
-DCMAKE_CXX_FLAGS="${flags}" \
|
|
|
|
"${@}"
|
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing compiler-rt"
|
2023-12-18 16:25:50 +01:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/compiler-rt" install
|
2024-05-01 15:10:01 +01:00
|
|
|
|
|
|
|
# Prior to clang 19, armv7m-none-eabi normalised to armv7m-none-unknown-eabi.
|
|
|
|
# clang 19 changed this to armv7m-unknown-none-eabi. So for as long as 18.x
|
|
|
|
# is supported, we have to ask clang what the triple will be.
|
|
|
|
NORMALISED_TARGET_TRIPLE=$(${CC-cc} --target=armv7m-none-eabi -print-target-triple)
|
|
|
|
# Without this step linking fails later in the build.
|
|
|
|
mv "${BUILD_DIR}/install/lib/${NORMALISED_TARGET_TRIPLE}"/* "${BUILD_DIR}/install/lib"
|
2023-12-18 16:25:50 +01:00
|
|
|
|
|
|
|
check-runtimes
|
|
|
|
}
|
|
|
|
|
2021-04-01 13:40:04 -04:00
|
|
|
# Print the version of a few tools to aid diagnostics in some cases
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Diagnose tools in use"
|
2021-05-07 13:14:57 -04:00
|
|
|
${CMAKE} --version
|
2021-04-01 13:40:04 -04:00
|
|
|
${NINJA} --version
|
2022-09-01 18:38:03 +02:00
|
|
|
if [ ! -z "${CXX}" ]; then ${CXX} --version; fi
|
|
|
|
|
2020-09-23 09:20:03 -04:00
|
|
|
case "${BUILDER}" in
|
2021-04-04 20:11:48 +02:00
|
|
|
check-generated-output)
|
2021-04-28 19:13:52 +02:00
|
|
|
# `! foo` doesn't work properly with `set -e`, use `! foo || false` instead.
|
|
|
|
# https://stackoverflow.com/questions/57681955/set-e-does-not-respect-logical-not
|
2021-04-04 20:11:48 +02:00
|
|
|
clean
|
2021-07-15 10:19:39 -04:00
|
|
|
generate-cmake
|
|
|
|
|
|
|
|
# Reject patches that forgot to re-run the generator scripts.
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Making sure the generator scripts were run"
|
|
|
|
set +x # Printing all the commands below just creates extremely confusing output
|
2021-07-15 10:19:39 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" libcxx-generate-files
|
2021-04-04 20:11:48 +02:00
|
|
|
git diff | tee ${BUILD_DIR}/generated_output.patch
|
2021-07-22 11:17:53 +02:00
|
|
|
git ls-files -o --exclude-standard | tee ${BUILD_DIR}/generated_output.status
|
2021-04-28 19:13:52 +02:00
|
|
|
! grep -q '^--- a' ${BUILD_DIR}/generated_output.patch || false
|
2021-07-22 11:17:53 +02:00
|
|
|
if [ -s ${BUILD_DIR}/generated_output.status ]; then
|
|
|
|
echo "It looks like not all the generator scripts were run,"
|
|
|
|
echo "did you forget to build the libcxx-generate-files target?"
|
|
|
|
echo "Did you add all new files it generated?"
|
|
|
|
false
|
|
|
|
fi
|
2021-07-15 10:19:39 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
# This depends on LC_COLLATE set at the top of this script.
|
|
|
|
step "Reject patches that introduce non-ASCII characters or hard tabs."
|
2024-10-10 07:57:45 -04:00
|
|
|
! grep -rn '[^ -~]' libcxx/include libcxx/src libcxx/test \
|
2022-08-18 17:41:13 -04:00
|
|
|
--exclude '*.dat' \
|
2023-07-12 08:20:26 +02:00
|
|
|
--exclude '*unicode*.cpp' \
|
|
|
|
--exclude '*print*.sh.cpp' \
|
2022-05-05 08:03:58 +02:00
|
|
|
--exclude 'escaped_output.*.pass.cpp' \
|
2022-03-20 13:40:02 +01:00
|
|
|
--exclude 'format_tests.h' \
|
2022-05-05 18:57:32 +02:00
|
|
|
--exclude 'format.functions.tests.h' \
|
2022-03-20 13:40:02 +01:00
|
|
|
--exclude 'formatter.*.pass.cpp' \
|
2022-08-18 17:41:13 -04:00
|
|
|
--exclude 'grep.pass.cpp' \
|
|
|
|
--exclude 'locale-specific_form.pass.cpp' \
|
2022-03-20 13:40:02 +01:00
|
|
|
--exclude 'ostream.pass.cpp' \
|
2023-04-21 08:09:06 +02:00
|
|
|
--exclude 'transcoding.pass.cpp' \
|
2022-11-18 15:01:33 -05:00
|
|
|
--exclude 'underflow.pass.cpp' \
|
2022-03-20 13:40:02 +01:00
|
|
|
|| false
|
2021-04-04 20:11:48 +02:00
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Various Standard modes
|
|
|
|
#
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-cxx03)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2023-01-09 17:45:45 +01:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx03.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-11-26 15:00:42 -05:00
|
|
|
check-abi-list
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-cxx11)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2023-01-09 17:45:45 +01:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-11-26 15:00:42 -05:00
|
|
|
check-abi-list
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-cxx14)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2023-01-09 17:45:45 +01:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx14.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-11-26 15:00:42 -05:00
|
|
|
check-abi-list
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-cxx17)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2023-01-09 17:45:45 +01:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx17.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-11-26 15:00:42 -05:00
|
|
|
check-abi-list
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2021-01-07 12:29:04 +01:00
|
|
|
generic-cxx20)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2023-01-09 17:45:45 +01:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx20.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-01-08 18:40:42 +01:00
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-05-17 17:54:53 +02:00
|
|
|
generic-cxx23)
|
2021-01-08 18:40:42 +01:00
|
|
|
clean
|
2023-05-17 17:54:53 +02:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx23.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-11-26 15:00:42 -05:00
|
|
|
check-abi-list
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2023-05-20 12:38:57 +02:00
|
|
|
generic-cxx26)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx26.cmake"
|
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Other compiler support
|
|
|
|
#
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-gcc)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -DLIBCXX_ENABLE_WERROR=NO \
|
2022-03-31 11:51:30 +03:00
|
|
|
-DLIBCXXABI_ENABLE_WERROR=NO \
|
|
|
|
-DLIBUNWIND_ENABLE_WERROR=NO
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2021-07-15 09:46:36 -04:00
|
|
|
generic-gcc-cxx11)
|
|
|
|
clean
|
2021-10-07 14:54:14 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-cxx11.cmake" \
|
2022-03-31 11:51:30 +03:00
|
|
|
-DLIBCXX_ENABLE_WERROR=NO \
|
|
|
|
-DLIBCXXABI_ENABLE_WERROR=NO \
|
|
|
|
-DLIBUNWIND_ENABLE_WERROR=NO
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-07-15 09:46:36 -04:00
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Sanitizers
|
|
|
|
#
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-asan)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-asan.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-msan)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-msan.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-tsan)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-tsan.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2020-10-01 13:55:39 -04:00
|
|
|
generic-ubsan)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-ubsan.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Various build configurations
|
|
|
|
#
|
|
|
|
bootstrapping-build)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-11-18 16:17:10 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Generating CMake"
|
2022-11-18 16:17:10 -05:00
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/llvm" \
|
|
|
|
-B "${BUILD_DIR}" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
2023-05-18 14:16:24 -07:00
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
2024-04-10 08:02:13 +02:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
2022-11-18 16:17:10 -05:00
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
|
2024-04-15 17:58:37 +02:00
|
|
|
-DLLVM_ENABLE_PROJECTS="clang;lldb" \
|
2022-11-18 16:17:10 -05:00
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
|
2023-04-20 15:06:41 -04:00
|
|
|
-DLLVM_RUNTIME_TARGETS="$(${CXX} --print-target-triple)" \
|
2024-04-15 17:58:37 +02:00
|
|
|
-DLLVM_HOST_TRIPLE="$(${CXX} --print-target-triple)" \
|
2022-11-18 16:17:10 -05:00
|
|
|
-DLLVM_TARGETS_TO_BUILD="host" \
|
|
|
|
-DRUNTIMES_BUILD_ALLOW_DARWIN=ON \
|
2023-08-25 18:40:48 +02:00
|
|
|
-DLLVM_ENABLE_ASSERTIONS=ON \
|
2023-10-25 18:10:29 -04:00
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests"
|
2022-11-18 16:17:10 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the LLDB libc++ data formatter tests"
|
2024-10-08 10:21:51 +02:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" lldb-api-test-deps
|
|
|
|
${BUILD_DIR}/bin/llvm-lit -sv --param dotest-args='--category libc++' "${MONOREPO_ROOT}/lldb/test/API"
|
2024-04-15 17:58:37 +02:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ and libc++abi tests"
|
2023-08-25 18:40:48 +02:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-runtimes
|
2022-11-18 16:17:10 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libc++ and libc++abi to a fake location"
|
2023-08-25 18:40:48 +02:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" install-runtimes
|
2023-06-01 13:16:19 -07:00
|
|
|
|
|
|
|
ccache -s
|
2022-11-18 16:17:10 -05:00
|
|
|
;;
|
|
|
|
generic-static)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-static.cmake"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
|
|
|
generic-merged)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-merged.cmake" \
|
|
|
|
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared.cfg.in" \
|
|
|
|
-DLIBCXXABI_TEST_CONFIG="llvm-libc++abi-merged.cfg.in" \
|
|
|
|
-DLIBUNWIND_TEST_CONFIG="llvm-libunwind-merged.cfg.in"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
2023-11-08 09:10:00 -10:00
|
|
|
generic-hardening-mode-fast)
|
2023-07-12 10:12:51 -07:00
|
|
|
clean
|
2023-11-08 09:10:00 -10:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast.cmake"
|
2023-07-12 10:12:51 -07:00
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-11-08 09:10:00 -10:00
|
|
|
generic-hardening-mode-fast-with-abi-breaks)
|
2023-11-03 06:46:19 -07:00
|
|
|
clean
|
2023-11-08 09:10:00 -10:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-fast-with-abi-breaks.cmake"
|
2023-11-03 06:46:19 -07:00
|
|
|
check-runtimes
|
2024-08-26 17:16:37 -04:00
|
|
|
# Not checking ABI list since we purposefully enable ABI breaking changes
|
2023-11-03 06:46:19 -07:00
|
|
|
;;
|
2023-11-08 09:10:00 -10:00
|
|
|
generic-hardening-mode-extensive)
|
2023-09-12 12:01:36 -07:00
|
|
|
clean
|
2023-11-08 09:10:00 -10:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-extensive.cmake"
|
2023-09-12 12:01:36 -07:00
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-11-08 09:10:00 -10:00
|
|
|
generic-hardening-mode-debug)
|
2023-07-12 10:12:51 -07:00
|
|
|
clean
|
2023-11-08 09:10:00 -10:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-hardening-mode-debug.cmake"
|
2023-07-12 10:12:51 -07:00
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-02-28 20:29:26 +01:00
|
|
|
#
|
|
|
|
# Module builds
|
|
|
|
#
|
2022-11-18 16:17:10 -05:00
|
|
|
generic-modules)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules.cmake"
|
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-02-02 18:50:10 -05:00
|
|
|
generic-modules-lsv)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-modules-lsv.cmake"
|
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Parts removed
|
|
|
|
#
|
2022-05-24 09:58:04 -04:00
|
|
|
generic-no-threads)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-threads.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-09-23 09:20:03 -04:00
|
|
|
;;
|
2021-01-18 12:18:18 -05:00
|
|
|
generic-no-filesystem)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-filesystem.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-01-18 12:18:18 -05:00
|
|
|
;;
|
2020-10-15 10:32:09 -04:00
|
|
|
generic-no-random_device)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-random_device.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-10-15 10:32:09 -04:00
|
|
|
;;
|
2020-10-09 15:31:05 -04:00
|
|
|
generic-no-localization)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-localization.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2020-10-09 15:31:05 -04:00
|
|
|
;;
|
2024-08-21 08:48:53 -05:00
|
|
|
generic-no-terminal)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-terminal.cmake"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
2021-05-25 20:11:08 +02:00
|
|
|
generic-no-unicode)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-unicode.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-05-25 20:11:08 +02:00
|
|
|
;;
|
2021-08-23 15:32:36 -04:00
|
|
|
generic-no-wide-characters)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-wide-characters.cmake"
|
2021-08-23 15:32:36 -04:00
|
|
|
check-runtimes
|
|
|
|
;;
|
2022-09-23 18:33:20 +02:00
|
|
|
generic-no-tzdb)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-tzdb.cmake"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
2022-02-01 16:32:39 -05:00
|
|
|
generic-no-experimental)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-experimental.cmake"
|
2022-02-01 16:32:39 -05:00
|
|
|
check-runtimes
|
2022-02-14 14:39:17 -05:00
|
|
|
check-abi-list
|
2022-02-01 16:32:39 -05:00
|
|
|
;;
|
2023-05-16 07:48:13 -07:00
|
|
|
generic-no-exceptions)
|
2022-11-18 16:17:10 -05:00
|
|
|
clean
|
2023-05-16 07:48:13 -07:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-exceptions.cmake"
|
2022-11-18 16:17:10 -05:00
|
|
|
check-runtimes
|
|
|
|
check-abi-list
|
|
|
|
;;
|
2023-12-12 17:11:53 +01:00
|
|
|
generic-no-rtti)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
2022-11-18 16:17:10 -05:00
|
|
|
#
|
|
|
|
# Other miscellaneous jobs
|
|
|
|
#
|
2022-02-05 14:09:45 +01:00
|
|
|
generic-abi-unstable)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-abi-unstable.cmake"
|
2022-02-05 14:09:45 +01:00
|
|
|
check-runtimes
|
|
|
|
;;
|
2024-01-09 10:39:14 -05:00
|
|
|
generic-optimized-speed)
|
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-optimized-speed.cmake"
|
|
|
|
check-runtimes
|
|
|
|
;;
|
2024-06-21 10:31:22 -04:00
|
|
|
apple-configuration)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
2021-10-15 00:21:26 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libc++ with the Apple system configuration"
|
2021-10-15 00:21:26 -04:00
|
|
|
arch="$(uname -m)"
|
2022-02-03 10:57:49 -05:00
|
|
|
xcrun --sdk macosx \
|
|
|
|
${MONOREPO_ROOT}/libcxx/utils/ci/apple-install-libcxx.sh \
|
|
|
|
--llvm-root ${MONOREPO_ROOT} \
|
|
|
|
--build-dir ${BUILD_DIR} \
|
|
|
|
--install-dir ${INSTALL_DIR} \
|
|
|
|
--symbols-dir "${BUILD_DIR}/symbols" \
|
|
|
|
--architectures "${arch}" \
|
|
|
|
--version "999.99"
|
2021-10-15 00:21:26 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running tests against Apple-configured libc++"
|
2021-10-15 00:21:26 -04:00
|
|
|
# TODO: It would be better to run the tests against the fake-installed version of libc++ instead
|
2022-02-14 14:39:17 -05:00
|
|
|
xcrun --sdk macosx ninja -vC "${BUILD_DIR}/${arch}" check-cxx check-cxxabi check-cxx-abilist
|
2020-10-01 08:55:40 -04:00
|
|
|
;;
|
2024-09-30 17:08:44 -04:00
|
|
|
apple-system-hardened)
|
2022-08-04 15:25:48 -04:00
|
|
|
clean
|
|
|
|
|
2024-09-30 17:08:44 -04:00
|
|
|
arch="$(uname -m)"
|
|
|
|
version="$(sw_vers --productVersion)"
|
|
|
|
params="target_triple=${arch}-apple-macosx${version}"
|
|
|
|
params+=";hardening_mode=fast"
|
2022-08-04 15:25:48 -04:00
|
|
|
|
2024-09-30 17:08:44 -04:00
|
|
|
# In the Apple system configuration, we build libc++ and libunwind separately.
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libc++ and libc++abi in Apple-system configuration"
|
2024-09-30 17:08:44 -04:00
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/runtimes" \
|
|
|
|
-B "${BUILD_DIR}/cxx" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/cxx" \
|
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
|
|
|
-DLIBCXX_CXX_ABI=libcxxabi \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
|
|
|
|
-DLIBCXX_TEST_CONFIG="apple-libc++-system.cfg.in" \
|
|
|
|
-DLIBCXXABI_TEST_CONFIG="apple-libc++abi-system.cfg.in" \
|
|
|
|
-DLIBCXX_TEST_PARAMS="${params}" \
|
|
|
|
-DLIBCXXABI_TEST_PARAMS="${params}"
|
2022-08-04 15:25:48 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libunwind in Apple-system configuration"
|
2024-09-30 17:08:44 -04:00
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/runtimes" \
|
|
|
|
-B "${BUILD_DIR}/unwind" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/unwind" \
|
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES="libunwind" \
|
|
|
|
-DLIBUNWIND_TEST_CONFIG="apple-libunwind-system.cfg.in" \
|
|
|
|
-DLIBUNWIND_TEST_PARAMS="${params}" \
|
|
|
|
-DCMAKE_INSTALL_NAME_DIR="/usr/lib/system"
|
2022-08-04 15:25:48 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/cxx" check-cxx
|
2022-08-04 15:25:48 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++abi tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/cxx" check-cxxabi
|
2022-08-04 15:25:48 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libunwind tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/unwind" check-unwind
|
2022-08-04 15:25:48 -04:00
|
|
|
;;
|
2024-09-30 17:08:44 -04:00
|
|
|
apple-system)
|
2020-11-05 19:02:32 -05:00
|
|
|
clean
|
|
|
|
|
2024-09-30 17:08:44 -04:00
|
|
|
arch="$(uname -m)"
|
|
|
|
version="$(sw_vers --productVersion)"
|
|
|
|
params="target_triple=${arch}-apple-macosx${version}"
|
2020-11-05 19:02:32 -05:00
|
|
|
|
2024-09-30 17:08:44 -04:00
|
|
|
# In the Apple system configuration, we build libc++ and libunwind separately.
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libc++ and libc++abi in Apple-system configuration"
|
2024-09-30 17:08:44 -04:00
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/runtimes" \
|
|
|
|
-B "${BUILD_DIR}/cxx" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/cxx" \
|
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
|
|
|
|
-DLIBCXX_CXX_ABI=libcxxabi \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
|
|
|
|
-DLIBCXX_TEST_CONFIG="apple-libc++-system.cfg.in" \
|
|
|
|
-DLIBCXXABI_TEST_CONFIG="apple-libc++abi-system.cfg.in" \
|
|
|
|
-DLIBCXX_TEST_PARAMS="${params}" \
|
|
|
|
-DLIBCXXABI_TEST_PARAMS="${params}"
|
2020-07-08 16:38:54 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Installing libunwind in Apple-system configuration"
|
2024-09-30 17:08:44 -04:00
|
|
|
${CMAKE} \
|
|
|
|
-S "${MONOREPO_ROOT}/runtimes" \
|
|
|
|
-B "${BUILD_DIR}/unwind" \
|
|
|
|
-GNinja -DCMAKE_MAKE_PROGRAM="${NINJA}" \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}/unwind" \
|
|
|
|
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES="libunwind" \
|
|
|
|
-DLIBUNWIND_TEST_CONFIG="apple-libunwind-system.cfg.in" \
|
|
|
|
-DLIBUNWIND_TEST_PARAMS="${params}" \
|
|
|
|
-DCMAKE_INSTALL_NAME_DIR="/usr/lib/system"
|
2020-07-08 16:38:54 -04:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/cxx" check-cxx
|
2020-11-05 19:02:32 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++abi tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/cxx" check-cxxabi
|
2020-11-05 19:02:32 -05:00
|
|
|
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libunwind tests"
|
2024-09-30 17:08:44 -04:00
|
|
|
${NINJA} -vC "${BUILD_DIR}/unwind" check-unwind
|
2020-11-05 10:47:06 -05:00
|
|
|
;;
|
2021-02-08 10:43:21 +00:00
|
|
|
aarch64)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-02-08 10:43:21 +00:00
|
|
|
;;
|
2023-05-16 07:48:13 -07:00
|
|
|
aarch64-no-exceptions)
|
2021-02-08 10:43:21 +00:00
|
|
|
clean
|
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AArch64.cmake" \
|
2021-07-15 13:29:47 -04:00
|
|
|
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
|
2022-05-26 10:19:25 -04:00
|
|
|
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-02-08 10:43:21 +00:00
|
|
|
;;
|
2021-03-02 15:07:19 +00:00
|
|
|
# Aka Armv8 32 bit
|
|
|
|
armv8)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Arm.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-03-02 15:07:19 +00:00
|
|
|
;;
|
2023-05-16 07:48:13 -07:00
|
|
|
armv8-no-exceptions)
|
2021-03-02 15:07:19 +00:00
|
|
|
clean
|
2023-05-16 07:48:13 -07:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv8Thumb-no-exceptions.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-03-02 15:07:19 +00:00
|
|
|
;;
|
|
|
|
# Armv7 32 bit. One building Arm only one Thumb only code.
|
|
|
|
armv7)
|
|
|
|
clean
|
2022-05-26 10:19:25 -04:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Arm.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2021-03-02 15:07:19 +00:00
|
|
|
;;
|
2023-05-16 07:48:13 -07:00
|
|
|
armv7-no-exceptions)
|
2021-03-02 15:07:19 +00:00
|
|
|
clean
|
2023-05-16 07:48:13 -07:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7Thumb-no-exceptions.cmake"
|
2021-09-30 15:11:48 -04:00
|
|
|
check-runtimes
|
2023-11-29 09:56:20 -05:00
|
|
|
;;
|
|
|
|
armv7m-picolibc)
|
2023-12-18 16:25:50 +01:00
|
|
|
test-armv7m-picolibc \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake"
|
|
|
|
;;
|
|
|
|
armv7m-picolibc-no-exceptions)
|
|
|
|
test-armv7m-picolibc \
|
2023-11-29 09:56:20 -05:00
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/Armv7M-picolibc.cmake" \
|
2023-12-18 16:25:50 +01:00
|
|
|
-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF \
|
|
|
|
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=OFF \
|
|
|
|
-DLIBCXX_ENABLE_EXCEPTIONS=OFF \
|
|
|
|
-DLIBCXX_ENABLE_RTTI=OFF
|
2021-03-02 15:07:19 +00:00
|
|
|
;;
|
2021-10-01 23:08:57 +03:00
|
|
|
clang-cl-dll)
|
2021-03-17 12:10:42 +02:00
|
|
|
clean
|
|
|
|
# TODO: Currently, building with the experimental library breaks running
|
|
|
|
# tests (the test linking look for the c++experimental library with the
|
|
|
|
# wrong name, and the statically linked c++experimental can't be linked
|
|
|
|
# correctly when libc++ visibility attributes indicate dllimport linkage
|
|
|
|
# anyway), thus just disable the experimental library. Remove this
|
|
|
|
# setting when cmake and the test driver does the right thing automatically.
|
2022-07-19 10:44:06 -04:00
|
|
|
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False"
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
2021-04-06 00:17:30 +03:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
|
|
|
;;
|
2021-10-01 23:08:57 +03:00
|
|
|
clang-cl-static)
|
2021-04-06 00:17:30 +03:00
|
|
|
clean
|
2022-03-14 14:23:38 -04:00
|
|
|
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
2021-03-17 12:10:42 +02:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
2021-10-01 23:08:57 +03:00
|
|
|
;;
|
[libcxx] Fix using the vcruntime ABI with _HAS_EXCEPTIONS=0 defined
_HAS_EXCEPTIONS=0 allows disabling the exception parts of the MS STL
and vcruntime, and e.g. compiler-rt/lib/fuzzer sets this define (to
work around issues with MS STL). If using libc++ instead of MS STL,
this define previously broke the libc++ headers.
If _HAS_EXCEPTIONS is set to 0, the vcruntime_exception.h header
doesn't define the ABI base class std::exception. If no exceptions
are going to be thrown, this probably is fine (although it also
breaks using subclasses of it as regular objects that aren't thrown),
but it requires ifdeffing out all subclasses of all exception/error
derived objects (which are sprinkled throughout the headers).
Instead, libc++ will supply an ABI compatible definition when
_HAS_EXCEPTIONS is set to 0, which will make the class hierarchies
complete.
In this build configuration, one can still create instances of
exception subclasses, and those objects will be ABI incompatible
with the ones from when _HAS_EXCEPTIONS isn't defined to 0 - but
one may argue that's a pathological/self-imposed problem in that case.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D103947
2022-08-17 20:57:59 +00:00
|
|
|
clang-cl-no-vcruntime)
|
|
|
|
clean
|
|
|
|
# Building libc++ in the same way as in clang-cl-dll above, but running
|
|
|
|
# tests with -D_HAS_EXCEPTIONS=0, which users might set in certain
|
|
|
|
# translation units while using libc++, even if libc++ is built with
|
|
|
|
# exceptions enabled.
|
|
|
|
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
|
|
|
|
-DLIBCXX_TEST_CONFIG="llvm-libc++-shared-no-vcruntime-clangcl.cfg.in"
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
[libcxx] [test] Fix running tests with Clang-cl in Debug mode
When building in debug mode, the debug version of the MSVC CRT
gets linked in. (This is the default in CMake in general. In the case
of libcxx, we manually link the CRT though - and in debug mode,
we pick the debug version of the CRT.) When building the tests,
we need to use the same version of the CRT as was used for building
the library.
Additionally; the debug CRT defaults to pop up a dialog box when
asserts fail, which blocks running tests. By including the
set_windows_crt_report_mode.h helper header, we change the assert
behaviour back to that of release mode - printing a message and
exiting immediately.
This was supported by the old libcxx test system, where support for
it was added in 7e3ee09ad24cbca3ea7687c50b53be5269127fb1. When porting
over to the newer test setup, this mechanism wasn't brought over (and the
old test infrastructure was removed in
a48f018bb7d8fadc67c08e71409c31713daa0071).
Thus: In debug mode, link against the debug versions of msvcrt and
msvcprt, define _DEBUG (enabling CRT debug mode code patterns),
and include the set_windows_crt_report_mode.h header.
Based on a patch by Andrew Ng.
Linking of the debug version of the CRT can also be done by using
the new -fms-runtime-lib= Clang option. However that option was
added in Clang 16, and libcxx only requires Clang 15 for now;
therefore doing the CRT linking entirely manually for now (just as
before).
Additionally, adjust set_windows_crt_report_mode.h to avoid including
the body of the file when building in C mode or in C++03 mode.
This fixes the following two tests:
libcxx/include_as_c.sh.cpp
libcxx/selftest/dsl/dsl.sh.py
The former test is built in C mode. The latter tries compiling things
as C++03. Some of the vcruntime headers that we include break in
C++03 mode when MS CRT debug mode is enabled.
Differential Revision: https://reviews.llvm.org/D155554
2023-07-14 12:16:23 +03:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
|
|
|
;;
|
|
|
|
clang-cl-debug)
|
|
|
|
clean
|
|
|
|
generate-cmake-libcxx-win -DLIBCXX_TEST_PARAMS="enable_experimental=False" \
|
|
|
|
-DCMAKE_BUILD_TYPE=Debug
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
2023-07-17 12:52:47 +03:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
|
|
|
;;
|
|
|
|
clang-cl-static-crt)
|
|
|
|
clean
|
|
|
|
# Test linking a static libc++ with the static CRT ("MultiThreaded" denotes
|
|
|
|
# the static CRT, as opposed to "MultiThreadedDLL" which is the default).
|
|
|
|
generate-cmake-libcxx-win -DLIBCXX_ENABLE_SHARED=OFF \
|
|
|
|
-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
[libcxx] Fix using the vcruntime ABI with _HAS_EXCEPTIONS=0 defined
_HAS_EXCEPTIONS=0 allows disabling the exception parts of the MS STL
and vcruntime, and e.g. compiler-rt/lib/fuzzer sets this define (to
work around issues with MS STL). If using libc++ instead of MS STL,
this define previously broke the libc++ headers.
If _HAS_EXCEPTIONS is set to 0, the vcruntime_exception.h header
doesn't define the ABI base class std::exception. If no exceptions
are going to be thrown, this probably is fine (although it also
breaks using subclasses of it as regular objects that aren't thrown),
but it requires ifdeffing out all subclasses of all exception/error
derived objects (which are sprinkled throughout the headers).
Instead, libc++ will supply an ABI compatible definition when
_HAS_EXCEPTIONS is set to 0, which will make the class hierarchies
complete.
In this build configuration, one can still create instances of
exception subclasses, and those objects will be ABI incompatible
with the ones from when _HAS_EXCEPTIONS isn't defined to 0 - but
one may argue that's a pathological/self-imposed problem in that case.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D103947
2022-08-17 20:57:59 +00:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
|
|
|
;;
|
2021-10-01 23:08:57 +03:00
|
|
|
mingw-dll)
|
|
|
|
clean
|
|
|
|
generate-cmake \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
|
2023-04-05 15:25:09 +03:00
|
|
|
check-runtimes
|
2021-10-01 23:08:57 +03:00
|
|
|
;;
|
|
|
|
mingw-static)
|
|
|
|
clean
|
|
|
|
generate-cmake \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake" \
|
|
|
|
-DLIBCXX_ENABLE_SHARED=OFF \
|
|
|
|
-DLIBUNWIND_ENABLE_SHARED=OFF
|
2023-04-05 15:25:09 +03:00
|
|
|
check-runtimes
|
2022-05-04 11:05:44 +03:00
|
|
|
;;
|
|
|
|
mingw-dll-i686)
|
|
|
|
clean
|
|
|
|
generate-cmake \
|
|
|
|
-DCMAKE_C_COMPILER=i686-w64-mingw32-clang \
|
|
|
|
-DCMAKE_CXX_COMPILER=i686-w64-mingw32-clang++ \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
|
2023-04-05 15:25:09 +03:00
|
|
|
check-runtimes
|
2021-03-17 12:10:42 +02:00
|
|
|
;;
|
2024-09-05 17:25:41 +03:00
|
|
|
mingw-incomplete-sysroot)
|
|
|
|
# When bringing up a new cross compiler from scratch, we build
|
|
|
|
# libunwind/libcxx in a setup where the toolchain is incomplete and
|
|
|
|
# unable to perform the normal linker checks; this requires a few
|
|
|
|
# special cases in the CMake files.
|
|
|
|
#
|
|
|
|
# Building in an incomplete setup requires setting CMAKE_*_COMPILER_WORKS,
|
|
|
|
# as CMake fails to probe the compiler. This case also requires
|
|
|
|
# setting CMAKE_CXX_COMPILER_TARGET, as LLVM's heuristics for setting
|
|
|
|
# the triple fails when CMake hasn't been able to probe the environment.
|
|
|
|
# (This is what one has to do when building the initial libunwind/libcxx
|
|
|
|
# for a new toolchain.)
|
|
|
|
clean
|
|
|
|
generate-cmake \
|
|
|
|
-DCMAKE_C_COMPILER_WORKS=TRUE \
|
|
|
|
-DCMAKE_CXX_COMPILER_WORKS=TRUE \
|
|
|
|
-DCMAKE_C_COMPILER_TARGET=x86_64-w64-windows-gnu \
|
|
|
|
-DCMAKE_CXX_COMPILER_TARGET=x86_64-w64-windows-gnu \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/MinGW.cmake"
|
|
|
|
# Only test that building succeeds; there's not much extra value in running
|
|
|
|
# the tests here, as it would be equivalent to the mingw-dll config above.
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Building the runtimes"
|
2024-09-05 17:25:41 +03:00
|
|
|
${NINJA} -vC "${BUILD_DIR}"
|
|
|
|
;;
|
2021-10-13 11:41:47 -04:00
|
|
|
aix)
|
|
|
|
clean
|
2021-11-09 12:44:44 -05:00
|
|
|
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/AIX.cmake" \
|
2021-10-13 11:41:47 -04:00
|
|
|
-DLIBCXX_TEST_CONFIG="ibm-libc++-shared.cfg.in" \
|
2021-11-09 12:44:44 -05:00
|
|
|
-DLIBCXXABI_TEST_CONFIG="ibm-libc++abi-shared.cfg.in" \
|
2022-06-02 09:03:10 -04:00
|
|
|
-DLIBUNWIND_TEST_CONFIG="ibm-libunwind-shared.cfg.in"
|
2022-06-14 13:15:46 -04:00
|
|
|
check-abi-list
|
2022-06-02 09:03:10 -04:00
|
|
|
check-runtimes
|
2021-10-13 11:41:47 -04:00
|
|
|
;;
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
android-ndk-*)
|
|
|
|
clean
|
|
|
|
|
|
|
|
ANDROID_EMU_IMG="${BUILDER#android-ndk-}"
|
|
|
|
. "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/emulator-functions.sh"
|
|
|
|
if ! validate_emu_img "${ANDROID_EMU_IMG}"; then
|
2024-10-11 09:29:47 -04:00
|
|
|
error "android-ndk suffix must be a valid emulator image (${ANDROID_EMU_IMG})" >&2
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
ARCH=$(arch_of_emu_img ${ANDROID_EMU_IMG})
|
|
|
|
|
|
|
|
# Use the Android compiler by default.
|
|
|
|
export CC=${CC:-/opt/android/clang/clang-current/bin/clang}
|
|
|
|
export CXX=${CXX:-/opt/android/clang/clang-current/bin/clang++}
|
|
|
|
|
|
|
|
# The NDK libc++_shared.so is always built against the oldest supported API
|
|
|
|
# level. When tests are run against a device with a newer API level, test
|
|
|
|
# programs can be built for any supported API level, but building for the
|
|
|
|
# newest API (i.e. the system image's API) is probably the most interesting.
|
2024-02-26 14:46:15 -05:00
|
|
|
PARAMS="executor=${MONOREPO_ROOT}/libcxx/utils/adb_run.py;target_triple=$(triple_of_arch ${ARCH})$(api_of_emu_img ${ANDROID_EMU_IMG})"
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
generate-cmake-android -C "${MONOREPO_ROOT}/runtimes/cmake/android/Arch-${ARCH}.cmake" \
|
|
|
|
-C "${MONOREPO_ROOT}/libcxx/cmake/caches/AndroidNDK.cmake" \
|
|
|
|
-DCMAKE_SYSROOT=/opt/android/ndk/sysroot \
|
|
|
|
-DLIBCXX_TEST_PARAMS="${PARAMS}" \
|
|
|
|
-DLIBCXXABI_TEST_PARAMS="${PARAMS}"
|
2024-01-12 13:00:16 -08:00
|
|
|
check-abi-list
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" install-cxx install-cxxabi
|
|
|
|
|
|
|
|
# Start the emulator and make sure we can connect to the adb server running
|
|
|
|
# inside of it.
|
|
|
|
"${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/start-emulator.sh" ${ANDROID_EMU_IMG}
|
|
|
|
trap "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/stop-emulator.sh" EXIT
|
|
|
|
. "${MONOREPO_ROOT}/libcxx/utils/ci/vendor/android/setup-env-for-emulator.sh"
|
|
|
|
|
|
|
|
# Create adb_run early to avoid concurrent `mkdir -p` of common parent
|
|
|
|
# directories.
|
|
|
|
adb shell mkdir -p /data/local/tmp/adb_run
|
|
|
|
adb push "${BUILD_DIR}/lib/libc++_shared.so" /data/local/tmp/libc++/libc++_shared.so
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++ tests"
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxx
|
2024-10-11 09:29:47 -04:00
|
|
|
step "Running the libc++abi tests"
|
[libc++][Android] Support libc++ testing on Android (#69274)
I could probably break this commit into more pieces.
---
This patch adds libc++ support for Android L (Android 5.0+) and up,
tested using the Android team's current compiler, a recent version of
the AOSP sysroot, and the x86[-64] Android Emulator.
CMake and Lit Configuration:
Add runtimes/cmake/android/Arch-${ARCH}.cmake files that configure CMake
to cross-compile to Android without using CMake's built-in NDK support
(which only works with an actual packaged NDK).
Add libcxx/cmake/caches/AndroidNDK.cmake that builds and tests libc++
(and libc++abi) for Android. This file configures libc++ to match what
the NDK distributes, e.g.:
- libc++_shared.so (includes libc++abi objects, there is no
libc++abi.so). libunwind is linked statically but not exported.
- libc++_static.a (does not include libc++abi) and libc++abi.a
- `std::__ndk1` namespace
- All the libraries are built with `__ANDROID_API__=21`, even when they
are linked to something targeting a higher API level.
(However, when the Android LLVM team builds these components, they do
not use these CMake cache files. Instead they use Python scripts to
configure the builds. See
https://android.googlesource.com/toolchain/llvm_android/.)
Add llvm-libc++[abi].android-ndk.cfg.in files that test the Android
NDK's libc++_shared.so. These files can target old or new Android
devices. The Android LLVM team uses these test files to test libc++ for
both arm/arm64 and x86/x86_64 architectures.
The Android testing mode works by setting %{executor} to adb_run.py,
which uses `adb push` and `adb shell` to run tests remotely. adb_run.py
always runs tests as the "shell" user even on an old emulator where "adb
unroot" doesn't work. The script has workarounds for old Android
devices. The script uses a Unix domain socket on the host
(--job-limit-socket) to restrict concurrent adb invocations. Compiling
the tests is a major part of libc++ testing run-time, so it's desirable
to exploit all the host cores without overburdening the test devices,
which can have far fewer cores.
BuildKite CI:
Add a builder to run-buildbot, `android-ndk-*`, that uses Android Clang
and an Android sysroot to build libc++, then starts an Android emulator
container to run tests.
Run the emulator and an adb server in a separate Docker container
(libcxx-ci-android-emulator), and create a separate Docker image for
each emulator OS system image. Set ADB_SERVER_SOCKET to connect to the
container's adb server. Running the only adb server inside the container
makes cleanup more reliable between test runs, e.g. the adb client
doesn't create a `~/.android` directory and the adb server can be
restarted along with the emulator using docker stop/run. (N.B. The
emulator insists on connecting to an adb server and will start one
itself if it can't connect to one.)
The suffix to the android-ndk-* job is a label that concisely specifies
an Android SDK emulator image. e.g.:
- "system-images;android-21;default;x86" ==> 21-def-x86
- "system-images;android-33;google_apis;x86_64" ==> 33-goog-x86_64
Fixes: https://github.com/llvm/llvm-project/issues/69270
Differential Revision: https://reviews.llvm.org/D139147
2023-10-19 13:58:30 -07:00
|
|
|
${NINJA} -vC "${BUILD_DIR}" check-cxxabi
|
|
|
|
;;
|
2021-05-27 16:51:38 -04:00
|
|
|
#################################################################
|
|
|
|
# Insert vendor-specific internal configurations below.
|
|
|
|
#
|
|
|
|
# This allows vendors to extend this file with their own internal
|
|
|
|
# configurations without running into merge conflicts with upstream.
|
|
|
|
#################################################################
|
|
|
|
|
|
|
|
#################################################################
|
2020-09-23 09:20:03 -04:00
|
|
|
*)
|
|
|
|
echo "${BUILDER} is not a known configuration"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2024-10-11 09:29:47 -04:00
|
|
|
|
|
|
|
endstep # Make sure we close any still-open output group
|