| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
PROGNAME="$(basename "${0}")" |
| 6 |
function usage() { |
| 7 |
cat <<EOF |
| 8 |
Usage: |
| 9 |
${PROGNAME} [-h|--help] [-b|--bootstrap] <build-directory> [lit options...] tests... |
| 10 |
|
| 11 |
Shortcut to build the libc++ testing dependencies and run the libc++ tests with Lit. |
| 12 |
|
| 13 |
[-b|--bootstrap] Configure tests to run against a bootstrap build of libcxx. |
| 14 |
<build-directory> The path to the build directory to use for building the library. |
| 15 |
[lit options...] Optional options to pass to 'llvm-lit'. |
| 16 |
tests... Paths of the tests to run. Those paths are relative to '<monorepo-root>'. |
| 17 |
|
| 18 |
Example |
| 19 |
======= |
| 20 |
$ cmake -S runtimes -B build/ -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" |
| 21 |
$ libcxx-lit build/ -sv libcxx/test/std/utilities/ |
| 22 |
EOF |
| 23 |
} |
| 24 |
|
| 25 |
type="cxx" |
| 26 |
if [[ "${1}" == "-h" || "${1}" == "--help" ]]; then |
| 27 |
usage |
| 28 |
exit 0 |
| 29 |
fi |
| 30 |
|
| 31 |
if [[ "${1}" == "-b" || "${1}" == "--bootstrap" ]]; then |
| 32 |
type="runtimes" |
| 33 |
shift |
| 34 |
fi |
| 35 |
|
| 36 |
if [[ $# -lt 1 ]]; then |
| 37 |
usage |
| 38 |
exit 1 |
| 39 |
fi |
| 40 |
|
| 41 |
build_dir="${1}" |
| 42 |
shift |
| 43 |
|
| 44 |
if [[ "${type}" == "runtimes" ]]; then |
| 45 |
echo "N.B.: In a bootstrap build, lit needs a prefix to work correctly;" |
| 46 |
echo " See libcxx/docs/Testinglibcxx.rst for more information." |
| 47 |
fi |
| 48 |
cmake --build "${build_dir}" --target ${type}-test-depends |
| 49 |
"${build_dir}/bin/llvm-lit" ${@} |