diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/test/run-cli-tests | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/run-cli-tests')
-rwxr-xr-x | src/test/run-cli-tests | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/test/run-cli-tests b/src/test/run-cli-tests new file mode 100755 index 000000000..9572c6834 --- /dev/null +++ b/src/test/run-cli-tests @@ -0,0 +1,64 @@ +#!/bin/sh +set -e + +SRCDIR="$(dirname "$0")" + +# build directory, if different, can be passed as an argument; +# it is expected to point to the equivalent subdirectory of the +# tree as where this script is stored +BUILDDIR="$SRCDIR" +case "$1" in + ''|-*) + # not set or looks like a flag to cram + ;; + *) + # looks like the builddir + BUILDDIR="$1" + shift + ;; +esac + +VENV="$BUILDDIR/virtualenv" +CRAM_BIN="$VENV/bin/cram" +if [ ! -e "$CRAM_BIN" ]; then + # With "make distcheck", the source directory must be read-only. I + # patched cram to support that. See upstream ticket at + # https://bitbucket.org/brodie/cram/issue/9/allow-read-only-directories-for-t + # -- tv@inktank.com + python3 -m venv "$VENV" && $VENV/bin/pip --log "$VENV"/log.txt \ + install git+https://github.com/ceph/cram.git@0.7-error-dir#egg=cram +fi + +SRCDIR_ABS="$(readlink -f "$SRCDIR")" +BUILDDIR_ABS="$(readlink -f "$BUILDDIR")" +FAKE_HOME="$BUILDDIR_ABS/fake_home" +mkdir -p "$FAKE_HOME" + +# cram doesn't like seeing the same foo.t basename twice on the same +# run, so run it once per directory +FAILED=0 +FAILEDTOOLS="" +for tool in "$SRCDIR"/cli/*; do + toolname="$(basename "$tool")" + install -d -m0755 -- "$BUILDDIR/cli/$toolname" + if ! env -i \ + PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \ + CEPH_CONF=/dev/null \ + CEPH_ARGS="--no-mon-config" \ + CCACHE_DIR="$CCACHE_DIR" \ + CC="$CC" \ + CXX="$CXX" \ + HOME="$FAKE_HOME" \ + "$SRCDIR/run-cli-tests-maybe-unset-ccache" \ + "$CRAM_BIN" -v "$@" --error-dir="$BUILDDIR/cli/$toolname" -- "$tool"/*.t + then + FAILED=1 + FAILEDTOOLS="$FAILEDTOOLS $toolname" + fi +done + +if [ $FAILED -eq 1 ]; then + echo "Tests that failed: $FAILEDTOOLS" +fi + +exit "$FAILED" |