123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- #! /bin/sh
- set -e
- . "./shconfig"
- RUNSHFLAGS='-e'
- export RUNSHFLAGS
- if [ -d /usr/xpg4/bin ]; then
- PATH="/usr/xpg4/bin/:$PATH"
- export PATH
- fi
- if [ "x$loglevel" != x ] && [ "$loglevel" -gt 8 ]; then
- if set -x; then
-
- RUNSHFLAGS="$RUNSHFLAGS -x"
- fi
- fi
- POSIXLY_CORRECT=1
- if test x"$TOOLDIR" = x; then
- TOOLDIR=`pwd`
- fi
- srcdir=`dirname $0`
- if test x"$srcdir" = x -o x"$srcdir" = x.; then
- srcdir="$TOOLDIR"
- fi
- if test x"$rsync_bin" = x; then
- rsync_bin="$TOOLDIR/rsync"
- fi
- RSYNC="$rsync_bin $*"
- TLS_ARGS=''
- if egrep '^#define HAVE_LUTIMES 1' config.h >/dev/null; then
- TLS_ARGS="$TLS_ARGS -l"
- fi
- if egrep '#undef CHOWN_MODIFIES_SYMLINK' config.h >/dev/null; then
- TLS_ARGS="$TLS_ARGS -L"
- fi
- export POSIXLY_CORRECT TOOLDIR srcdir RSYNC TLS_ARGS
- echo "============================================================"
- echo "$0 running in $TOOLDIR"
- echo " rsync_bin=$RSYNC"
- echo " srcdir=$srcdir"
- echo " TLS_ARGS=$TLS_ARGS"
- if [ -f /usr/bin/whoami ]; then
- testuser=`/usr/bin/whoami`
- elif [ -f /usr/ucb/whoami ]; then
- testuser=`/usr/ucb/whoami`
- elif [ -f /bin/whoami ]; then
- testuser=`/bin/whoami`
- else
- testuser=`id -un 2>/dev/null || echo ${LOGNAME:-${USERNAME:-${USER:-'UNKNOWN'}}}`
- fi
- echo " testuser=$testuser"
- echo " os=`uname -a`"
- if [ "x$preserve_scratch" = xyes ]; then
- echo " preserve_scratch=yes"
- else
- echo " preserve_scratch=no"
- fi
- if setacl -k u::7,g::5,o:5 testsuite 2>/dev/null; then
- setfacl_nodef='setacl -k'
- elif setfacl --help 2>&1 | grep ' -k,\|\[-[a-z]*k' >/dev/null; then
- setfacl_nodef='setfacl -k'
- elif setfacl -s u::7,g::5,o:5 testsuite 2>/dev/null; then
- setfacl_nodef='setfacl -s u::7,g::5,o:5'
- else
-
- setfacl_nodef=true
- fi
- export setfacl_nodef
- if [ ! -f "$rsync_bin" ]; then
- echo "rsync_bin $rsync_bin is not a file" >&2
- exit 2
- fi
- if [ ! -d "$srcdir" ]; then
- echo "srcdir $srcdir is not a directory" >&2
- exit 2
- fi
- skipped=0
- missing=0
- passed=0
- failed=0
- scratchbase="$TOOLDIR"/testtmp
- echo " scratchbase=$scratchbase"
- [ -d "$scratchbase" ] || mkdir "$scratchbase"
- suitedir="$srcdir/testsuite"
- export scratchdir suitedir
- prep_scratch() {
- [ -d "$scratchdir" ] && chmod -R u+rwX "$scratchdir" && rm -rf "$scratchdir"
- mkdir "$scratchdir"
-
- $setfacl_nodef "$scratchdir" || true
- chmod g-s "$scratchdir"
- case "$srcdir" in
- /*) ln -s "$srcdir" "$scratchdir/src" ;;
- *) ln -s "$TOOLDIR/$srcdir" "$scratchdir/src" ;;
- esac
- return 0
- }
- maybe_discard_scratch() {
- [ x"$preserve_scratch" != xyes ] && [ -d "$scratchdir" ] && rm -rf "$scratchdir"
- return 0
- }
- if [ "x$whichtests" = x ]; then
- whichtests="*.test"
- fi
- for testscript in $suitedir/$whichtests
- do
- testbase=`echo $testscript | sed -e 's!.*/!!' -e 's/.test\$//'`
- scratchdir="$scratchbase/$testbase"
- prep_scratch
- set +e
- sh $RUNSHFLAGS "$testscript" >"$scratchdir/test.log" 2>&1
- result=$?
- set -e
- if [ "x$always_log" = xyes -o \( $result != 0 -a $result != 77 -a $result != 78 \) ]
- then
- echo "----- $testbase log follows"
- cat "$scratchdir/test.log"
- echo "----- $testbase log ends"
- if [ -f "$scratchdir/rsyncd.log" ]; then
- echo "----- $testbase rsyncd.log follows"
- cat "$scratchdir/rsyncd.log"
- echo "----- $testbase rsyncd.log ends"
- fi
- fi
- case $result in
- 0)
- echo "PASS $testbase"
- passed=`expr $passed + 1`
- maybe_discard_scratch
- ;;
- 77)
-
- whyskipped=`cat "$scratchdir/whyskipped"`
- echo "SKIP $testbase ($whyskipped)"
- skipped=`expr $skipped + 1`
- maybe_discard_scratch
- ;;
- 78)
-
-
-
- echo "XFAIL $testbase"
- failed=`expr $failed + 1`
- ;;
- *)
- echo "FAIL $testbase"
- failed=`expr $failed + 1`
- if [ "x$nopersist" = xyes ]; then
- exit 1
- fi
- esac
- done
- echo '------------------------------------------------------------'
- echo "----- overall results:"
- echo " $passed passed"
- [ "$failed" -gt 0 ] && echo " $failed failed"
- [ "$skipped" -gt 0 ] && echo " $skipped skipped"
- [ "$missing" -gt 0 ] && echo " $missing missing"
- echo '------------------------------------------------------------'
- result=`expr $failed + $missing || true`
- echo "overall result is $result"
- exit $result
|