File: run-cli-tests

package info (click to toggle)
ceph 10.2.5-6~bpo8+1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 75,544 kB
  • sloc: cpp: 790,884; ansic: 53,544; sh: 26,745; python: 24,230; java: 16,950; asm: 10,148; makefile: 5,521; perl: 2,666; php: 603
file content (60 lines) | stat: -rwxr-xr-x 1,673 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
set -e

if ! command -v virtualenv >/dev/null; then
    echo "$0: virtualenv not installed, skipping python-using tests." 1>&2
    exit 1
fi

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
    virtualenv --system-site-packages "$VENV" && $VENV/bin/pip --log "$VENV"/log.txt install "$SRCDIR/downloads/cram-0.5.0ceph.2011-01-14.tar.gz"
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
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 \
	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
    fi
done

exit "$FAILED"