blob: 49c3f3f75de88a7d72d6b656313b26d754ad66b7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
# $OpenBSD: dasho.sh,v 1.2 2016/09/28 11:46:45 bluhm Exp $
: ${FTP:=ftp}
tmpdir=$(readlink -f temp) &&
mkdir $tmpdir || exit 1
trap 'rm -rf "$tmpdir"' EXIT
trap 'rm -rf "$tmpdir"; exit 1' INT HUP TERM
cd "$tmpdir" || exit 1
mkdir src dest &&
cd dest || exit 1
echo 'DASH' >> ../src/-
echo 'XXXX' >> ../src/X
args=$1
exitcode=$2
stdout=$3
stderr=$4
files=$5
echo "Testing ${FTP} $1"
eval "\"\$FTP\" $1" >../stdout 2>../stderr
echo -n $? > ../exitcode
for a in *; do
test -e $a || continue
print -rn -- "[$a] "
cat ./$a
done >../files
result=0
for a in exitcode stdout stderr files; do
if ! eval "[ X\"\$$a\" == X\"$(<../$a)\" ]"; then
echo "*** $a ***"
echo "expected:"
eval "print -r -- \"\$$a\"" | sed 's/^/> /'
echo "got:"
cat ../$a | sed 's/^/> /'
echo
result=1
fi
done
exit $result
|