2017-07-31 16:27:15 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2017-07-24 21:45:22 +00:00
|
|
|
|
2017-07-31 16:27:15 +00:00
|
|
|
if [ ! -e Makefile -o ! -d bin ]; then
|
2017-07-24 21:45:22 +00:00
|
|
|
echo 'run this from the build dir'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-31 16:27:15 +00:00
|
|
|
if [ ! -d /tmp/ceph-disk-virtualenv -o ! -d /tmp/ceph-detect-init-virtualenv ]; then
|
|
|
|
echo '/tmp/*-virtualenv directories not built'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-26 10:01:37 +00:00
|
|
|
if [ `uname` = FreeBSD ]; then
|
2017-07-28 06:18:09 +00:00
|
|
|
# otherwise module prettytable will not be found
|
|
|
|
export PYTHONPATH=/usr/local/lib/python2.7/site-packages
|
|
|
|
exec_mode=+111
|
2017-08-04 19:34:47 +00:00
|
|
|
KERNCORE="kern.corefile"
|
|
|
|
COREPATTERN="core.%N.%P"
|
2017-07-28 06:18:09 +00:00
|
|
|
else
|
2017-07-31 16:27:15 +00:00
|
|
|
export PYTHONPATH=/usr/lib/python2.7/dist-packages
|
2017-07-28 06:18:09 +00:00
|
|
|
exec_mode=/111
|
2017-08-04 19:34:47 +00:00
|
|
|
KERNCORE="kernel.core_pattern"
|
|
|
|
COREPATTERN="core.%e.%p.%t"
|
2017-07-26 10:01:37 +00:00
|
|
|
fi
|
|
|
|
|
2017-07-31 16:27:15 +00:00
|
|
|
PATH=$(pwd)/bin:$PATH
|
|
|
|
|
|
|
|
# TODO: Use getops
|
|
|
|
dryrun=false
|
|
|
|
if [[ "$1" = "--dry-run" ]]; then
|
|
|
|
dryrun=true
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
|
|
|
all=false
|
|
|
|
if [ "$1" = "" ]; then
|
|
|
|
all=true
|
|
|
|
fi
|
|
|
|
|
|
|
|
select=("$@")
|
|
|
|
|
|
|
|
location="../qa/standalone"
|
|
|
|
|
|
|
|
count=0
|
|
|
|
errors=0
|
2017-08-01 23:04:10 +00:00
|
|
|
userargs=""
|
2017-08-04 19:34:47 +00:00
|
|
|
precore="$(sysctl -n $KERNCORE)"
|
|
|
|
sudo sysctl -w ${KERNCORE}=${COREPATTERN}
|
|
|
|
ulimit -c unlimited
|
2017-07-31 16:27:15 +00:00
|
|
|
for f in $(cd $location ; find . -perm $exec_mode -type f)
|
2017-07-24 21:45:22 +00:00
|
|
|
do
|
2017-07-31 16:27:15 +00:00
|
|
|
f=$(echo $f | sed 's/\.\///')
|
2017-08-01 20:42:29 +00:00
|
|
|
# This is tested with misc/test-ceph-helpers.sh
|
|
|
|
if [[ "$f" = "ceph-helpers.sh" ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
2017-07-31 16:27:15 +00:00
|
|
|
if [[ "$all" = "false" ]]; then
|
|
|
|
found=false
|
|
|
|
for c in "${!select[@]}"
|
|
|
|
do
|
2017-08-01 23:04:10 +00:00
|
|
|
# Get command and any arguments of subset of tests ro tun
|
|
|
|
allargs="${select[$c]}"
|
|
|
|
arg1=$(echo "$allargs" | cut --delimiter " " --field 1)
|
|
|
|
# Get user args for this selection for use below
|
|
|
|
userargs="$(echo $allargs | cut -s --delimiter " " --field 2-)"
|
|
|
|
if [[ "$arg1" = $(basename $f) ]]; then
|
2017-07-31 16:27:15 +00:00
|
|
|
found=true
|
|
|
|
break
|
|
|
|
fi
|
2017-08-01 23:04:10 +00:00
|
|
|
if [[ "$arg1" = "$f" ]]; then
|
2017-07-31 16:27:15 +00:00
|
|
|
found=true
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [[ "$found" = "false" ]]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
fi
|
2017-07-31 16:28:12 +00:00
|
|
|
# Don't run test-failure.sh unless explicitly specified
|
|
|
|
if [ "$all" = "true" -a "$f" = "special/test-failure.sh" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
2017-08-01 23:04:10 +00:00
|
|
|
cmd="$location/$f $userargs"
|
2017-07-31 16:27:15 +00:00
|
|
|
count=$(expr $count + 1)
|
2017-08-01 23:04:10 +00:00
|
|
|
echo "--- $cmd ---"
|
2017-07-31 16:27:15 +00:00
|
|
|
if [[ "$dryrun" != "true" ]]; then
|
|
|
|
if ! PATH=$PATH:bin \
|
|
|
|
CEPH_ROOT=.. \
|
|
|
|
CEPH_LIB=lib \
|
2017-08-04 19:34:47 +00:00
|
|
|
LOCALRUN=yes \
|
2017-08-01 23:04:10 +00:00
|
|
|
$cmd ; then
|
2017-07-31 16:27:15 +00:00
|
|
|
echo "$f .............. FAILED"
|
|
|
|
errors=$(expr $errors + 1)
|
|
|
|
fi
|
|
|
|
fi
|
2017-07-24 21:45:22 +00:00
|
|
|
done
|
2017-08-04 19:34:47 +00:00
|
|
|
sudo sysctl -w ${KERNCORE}=${precore}
|
2017-07-24 21:45:22 +00:00
|
|
|
|
2017-07-31 16:27:15 +00:00
|
|
|
if [ "$errors" != "0" ]; then
|
|
|
|
echo "$errors TESTS FAILED, $count TOTAL TESTS"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "ALL $count TESTS PASSED"
|
2017-07-24 21:45:22 +00:00
|
|
|
exit 0
|