Commit | Line | Data |
---|---|---|
a4772a4d MP |
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 | ||
4df7868d MP |
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 | |
2f22174f MP |
17 | # build scripts. At the moment we assume we are invoked from the |
18 | # source directory. | |
4df7868d | 19 | |
3459d319 MP |
20 | # testdir is a scratch directory for holding temporary test files. |
21 | ||
4df7868d MP |
22 | # The pwd is undefined when this script starts. |
23 | ||
b53713d3 MP |
24 | set -x |
25 | ||
3459d319 MP |
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 | ||
2f22174f | 36 | echo "srcdir is originally \"$srcdir\"" |
b9277bdb MP |
37 | if [ "$srcdir" != "" ] |
38 | then | |
39 | srcdir=`cd "$srcdir" && pwd` | |
40 | fi | |
4df7868d | 41 | |
a4772a4d | 42 | echo "============================================================" |
4df7868d MP |
43 | echo "$0 running in `pwd`" |
44 | echo " rsync_bin=$rsync_bin" | |
45 | echo " srcdir=$srcdir" | |
3459d319 | 46 | echo " testdir=$testdir" |
a4772a4d | 47 | |
068a7221 | 48 | test_names="rsync-hello hands" |
a4772a4d MP |
49 | |
50 | export rsync_bin | |
51 | export testdir | |
52 | ||
5b7be6ee MP |
53 | skipped=0 |
54 | missing=0 | |
55 | passed=0 | |
56 | failed=0 | |
57 | ||
fafeb69c | 58 | suitedir="$srcdir/testsuite" |
4df7868d | 59 | echo " suitedir=$suitedir" |
a4772a4d | 60 | |
e340a820 MP |
61 | . "$suitedir/config.sh" |
62 | ||
a4772a4d MP |
63 | for testbase in $test_names |
64 | do | |
2f22174f | 65 | testscript="$suitedir/$testbase.test" |
a4772a4d MP |
66 | if test \! -f "$testscript" |
67 | then | |
68 | echo "$testscript does not exist" >&2 | |
5b7be6ee | 69 | missing=`expr $missing + 1` |
a4772a4d MP |
70 | continue |
71 | fi | |
72 | ||
951351a5 MP |
73 | echo "------------------------------------------------------------" |
74 | echo "----- $testbase running" | |
75 | ||
2f22174f | 76 | if sh "$testscript" |
a4772a4d MP |
77 | then |
78 | echo "----- $testbase completed succesfully" | |
5b7be6ee | 79 | passed=`expr $passed + 1` |
a4772a4d MP |
80 | else |
81 | echo "----- $testbase failed!" | |
5b7be6ee | 82 | failed=`expr $failed + 1` |
a4772a4d MP |
83 | fi |
84 | done | |
85 | ||
86 | echo '------------------------------------------------------------' | |
5b7be6ee MP |
87 | echo "----- overall results:" |
88 | echo " $passed passed" | |
89 | echo " $failed failed" | |
90 | echo " $skipped skipped" | |
91 | echo " $missing missing" | |
92 | echo '------------------------------------------------------------' | |
a426e396 MP |
93 | |
94 | if test $failed -gt 0 | |
95 | then | |
96 | exit 1 | |
97 | else | |
98 | exit 0 | |
99 | fi |