8856783a20fc22b07777537480feb87bc2b5bbd5
[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 -x
25
26 set -e
27
28 if ! [ -d "$testdir" ] && ! mkdir "$testdir"
29 then
30     echo "warning: testdir $testdir is not a directory!" >&2
31     exit 1
32 fi
33
34 testdir=`cd $testdir && pwd`
35
36 echo "srcdir is originally \"$srcdir\""
37 srcdir=`cd "$srcdir" && pwd`
38
39 echo "============================================================"
40 echo "$0 running in `pwd`"
41 echo "    rsync_bin=$rsync_bin"
42 echo "    srcdir=$srcdir"
43 echo "    testdir=$testdir"
44
45 test_names="rsync-hello hands"
46
47 export rsync_bin
48 export testdir
49
50 skipped=0
51 missing=0
52 passed=0
53 failed=0
54
55 suitedir=`cd ./testsuite && pwd`
56 echo "    suitedir=$suitedir"
57
58 . "$suitedir/config.sh"
59
60 for testbase in $test_names
61 do
62     testscript="$suitedir/$testbase.test"
63     if test \! -f "$testscript" 
64     then
65         echo "$testscript does not exist" >&2
66         missing=`expr $missing + 1`
67         continue
68     fi
69
70     echo "------------------------------------------------------------"
71     echo "----- $testbase running"
72
73     if sh "$testscript"
74     then
75         echo "----- $testbase completed succesfully"
76         passed=`expr $passed + 1`
77     else
78         echo "----- $testbase failed!"
79         failed=`expr $failed + 1`
80     fi  
81 done
82
83 echo '------------------------------------------------------------'
84 echo "----- overall results:"
85 echo "      $passed passed"
86 echo "      $failed failed"
87 echo "      $skipped skipped"
88 echo "      $missing missing"
89 echo '------------------------------------------------------------'