2011-01-12 00:43:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
|
|
|
|
if ! command -v pip >/dev/null; then
|
|
|
|
echo "$0: PIP not installed, skipping python-using tests." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-01-13 20:52:26 +00:00
|
|
|
SRCDIR="$(dirname "$0")"
|
2011-01-13 20:59:11 +00:00
|
|
|
|
|
|
|
# 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"
|
2011-01-12 00:43:46 +00:00
|
|
|
CRAM_BIN="$VENV/bin/cram"
|
|
|
|
if [ ! -e "$CRAM_BIN" ]; then
|
2011-01-14 18:39:32 +00:00
|
|
|
pip -E "$VENV" install "$SRCDIR/downloads/cram-0.5.0ceph.2011-01-14.tar.gz"
|
2011-01-12 00:43:46 +00:00
|
|
|
fi
|
|
|
|
|
2011-01-13 20:52:26 +00:00
|
|
|
SRCDIR_ABS="$(readlink -f "$SRCDIR")"
|
2011-01-14 18:39:32 +00:00
|
|
|
BUILDDIR_ABS="$(readlink -f "$BUILDDIR")"
|
2011-01-12 00:43:46 +00:00
|
|
|
|
|
|
|
# cram doesn't like seeing the same foo.t basename twice on the same
|
|
|
|
# run, so run it once per directory
|
2011-01-13 20:52:26 +00:00
|
|
|
for tool in "$SRCDIR"/cli/*; do
|
2011-01-14 18:39:32 +00:00
|
|
|
toolname="$(basename "$tool")"
|
|
|
|
install -d -m0755 -- "$BUILDDIR/cli/$toolname"
|
2011-01-15 00:39:38 +00:00
|
|
|
env --ignore-environment \
|
|
|
|
PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \
|
|
|
|
"$CRAM_BIN" -v "$@" --error-dir="$BUILDDIR/cli/$toolname" -- "$tool"/*.t
|
2011-01-12 00:43:46 +00:00
|
|
|
done
|