]> git.proxmox.com Git - ceph.git/blob - ceph/src/test/run-cli-tests
import ceph 16.2.7
[ceph.git] / ceph / src / test / run-cli-tests
1 #!/bin/sh
2 set -e
3
4 SRCDIR="$(dirname "$0")"
5
6 # build directory, if different, can be passed as an argument;
7 # it is expected to point to the equivalent subdirectory of the
8 # tree as where this script is stored
9 BUILDDIR="$SRCDIR"
10 case "$1" in
11 ''|-*)
12 # not set or looks like a flag to cram
13 ;;
14 *)
15 # looks like the builddir
16 BUILDDIR="$1"
17 shift
18 ;;
19 esac
20
21 VENV="$BUILDDIR/virtualenv"
22 CRAM_BIN="$VENV/bin/cram"
23 if [ ! -e "$CRAM_BIN" ]; then
24 # With "make distcheck", the source directory must be read-only. I
25 # patched cram to support that. See upstream ticket at
26 # https://bitbucket.org/brodie/cram/issue/9/allow-read-only-directories-for-t
27 # -- tv@inktank.com
28 python3 -m venv "$VENV" && $VENV/bin/pip --log "$VENV"/log.txt \
29 install git+https://github.com/ceph/cram.git@0.7-error-dir#egg=cram
30 fi
31
32 SRCDIR_ABS="$(readlink -f "$SRCDIR")"
33 BUILDDIR_ABS="$(readlink -f "$BUILDDIR")"
34 FAKE_HOME="$BUILDDIR_ABS/fake_home"
35 mkdir -p "$FAKE_HOME"
36
37 # cram doesn't like seeing the same foo.t basename twice on the same
38 # run, so run it once per directory
39 FAILED=0
40 FAILEDTOOLS=""
41 for tool in "$SRCDIR"/cli/*; do
42 toolname="$(basename "$tool")"
43 install -d -m0755 -- "$BUILDDIR/cli/$toolname"
44 if ! env -i \
45 PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \
46 CEPH_CONF=/dev/null \
47 CEPH_ARGS="--no-mon-config" \
48 CCACHE_DIR="$CCACHE_DIR" \
49 CC="$CC" \
50 CXX="$CXX" \
51 HOME="$FAKE_HOME" \
52 "$SRCDIR/run-cli-tests-maybe-unset-ccache" \
53 "$CRAM_BIN" -v "$@" --error-dir="$BUILDDIR/cli/$toolname" -- "$tool"/*.t
54 then
55 FAILED=1
56 FAILEDTOOLS="$FAILEDTOOLS $toolname"
57 fi
58 done
59
60 if [ $FAILED -eq 1 ]; then
61 echo "Tests that failed: $FAILEDTOOLS"
62 fi
63
64 exit "$FAILED"