ab0cd4f7186f22b437f03af92fd5930787890782
[rsync/rsync.git] / testsuite / master.test
1 #! /bin/sh
2
3 # Copyright (C) 2001 by Martin Pool <mbp@samba.org>
4
5 # rsync top-level test script -- this invokes all the other more
6 # detailed tests in order.  This script can either be called by 'make
7 # check' or through 'runlist' from the build farm.
8
9 # We need a few environment variables to know what to test.
10
11 # rsync_bin gives the location of the rsync binary.  This is either
12 # builddir/rsync if we're testing an uninstalled copy, or
13 # install_prefix/bin/rsync if we're testing an installed copy.  On the
14 # build farm rsync will be installed, but into a scratch /usr.
15
16 # srcdir gives the location of the source tree, which lets us find the
17 # build scripts.  At the moment we assume we are invoked from the
18 # source directory.
19
20 # testdir is a scratch directory for holding temporary test files.
21
22 # The pwd is undefined when this script starts.
23
24 set -e
25
26 if ! [ -d "$testdir" ] && ! mkdir "$testdir"
27 then
28     echo "warning: testdir $testdir is not a directory!" >&2
29     exit 1
30 fi
31
32 testdir=`cd $testdir && pwd`
33
34 echo "srcdir is originally \"$srcdir\""
35 srcdir=`cd "$srcdir" && pwd`
36
37 echo "============================================================"
38 echo "$0 running in `pwd`"
39 echo "    rsync_bin=$rsync_bin"
40 echo "    srcdir=$srcdir"
41 echo "    testdir=$testdir"
42
43 test_names="rsync-hello hands"
44
45 export rsync_bin
46 export testdir
47
48 skipped=0
49 missing=0
50 passed=0
51 failed=0
52
53 suitedir=`cd ./testsuite && pwd`
54 echo "    suitedir=$suitedir"
55
56 . "$suitedir/config.sh"
57
58 for testbase in $test_names
59 do
60     testscript="$suitedir/$testbase.test"
61     if test \! -f "$testscript" 
62     then
63         echo "$testscript does not exist" >&2
64         missing=`expr $missing + 1`
65         continue
66     fi
67
68     echo "------------------------------------------------------------"
69     echo "----- $testbase running"
70
71     if sh "$testscript"
72     then
73         echo "----- $testbase completed succesfully"
74         passed=`expr $passed + 1`
75     else
76         echo "----- $testbase failed!"
77         failed=`expr $failed + 1`
78     fi  
79 done
80
81 echo '------------------------------------------------------------'
82 echo "----- overall results:"
83 echo "      $passed passed"
84 echo "      $failed failed"
85 echo "      $skipped skipped"
86 echo "      $missing missing"
87 echo '------------------------------------------------------------'