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-15 01:27:23 +00:00
|
|
|
FAILED=0
|
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 01:27:23 +00:00
|
|
|
if ! env --ignore-environment \
|
2011-01-15 00:39:38 +00:00
|
|
|
PATH="$BUILDDIR_ABS/..:$SRCDIR_ABS/..:$PATH" \
|
2011-01-15 01:25:41 +00:00
|
|
|
CEPH_CONF=/dev/null \
|
run-cli-tests: Pass through CCACHE_DIR and such env vars.
Commit 7cd50f29d5cbf8deb64d00318b39c281119c0e03 makes the binaries
use libtool's "executable wrappers", which will transparently relink
the executables if they think that's needed. The test for that is
somewhat flawed: if the mtimes match, the binary might or might not
get relinked. In practise, this causes relinks on gitbuilder all the
time.
As of earlier commit 5a0bc6b78f2e40ec9255a1ea49f77ef9ea4690a6, we
started sanitizing the environment passed to the clitests. This meant
we also stripped away CCACHE_DIR and other settings, needed to
properly relink the binaries. Re-add CCACHE_DIR, CC, CXX to clitests
environment.
To handle the case where CCACHE_DIR etc are not set in the first
place, we need an extra wrapper script. Otherwise, ccache might see an
empty string as the env value, and naturally couldn't access a
directory by that name.
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
2011-06-22 22:23:14 +00:00
|
|
|
CCACHE_DIR="$CCACHE_DIR" \
|
|
|
|
CC="$CC" \
|
|
|
|
CXX="$CXX" \
|
|
|
|
"$SRCDIR/run-cli-tests-maybe-unset-ccache" \
|
2011-01-15 01:27:23 +00:00
|
|
|
"$CRAM_BIN" -v "$@" --error-dir="$BUILDDIR/cli/$toolname" -- "$tool"/*.t; then
|
|
|
|
FAILED=1
|
|
|
|
fi
|
2011-01-12 00:43:46 +00:00
|
|
|
done
|
2011-01-15 01:27:23 +00:00
|
|
|
|
|
|
|
exit "$FAILED"
|