7 ###--------------------------------------------------------------------------
8 ### Set up the test cases.
10 ### The mdup-test program takes a command-line representation of an mdup_fd
11 ### array, calls mdup, and checks the result. In particular, it ensures that
12 ### the file descriptors returned are the ones asked for, and that the
13 ### resulting file descriptors actually correspond to the requested files.
14 ### (It does the latter by comparing inodes before and after.)
20 ## Overlapping sources and destinations.
21 cases
="$cases 4:3,3:5,5:6"
24 cases
="$cases 3:4,3:3,3:-1"
25 cases
="$cases 5:8,3:4,3:5,4:6"
28 cases
="$cases 5:7,3:4,3:5,4:6,5:3"
29 cases
="$cases 5:8,3:4,3:5,4:6,5:3"
31 ###--------------------------------------------------------------------------
32 ### Actually run the tests.
34 ## Initialize counters.
40 for case in $cases; do
41 total
=$
(expr $total + 1)
42 case=$
(echo "$case" |
sed 'y/,/ /')
43 printf "%d: %-60s " $total "$case"
44 if $test $case >mdup.
$total.out
2>mdup.
$total.err
; then
47 rm mdup.
$total.out mdup.
$total.err
50 lose
=$
(expr $lose + 1)
54 ## Announce the outcome.
55 if [ $win = $total ]; then
56 echo "All $total tests successful."
59 echo "FAILED $lose of $total tests."
66 ###----- That's all, folks --------------------------------------------------