4 echo "Usage: $0 target [tempfile [timeout [filesize]]]" > /dev/stderr
8 [ "xXFAIL" == "x$1" ] && { XFAIL="XFAIL"; shift; }
10 if [ "x" == "x$2" ]; then TMP=tftpdata; else TMP=$2; fi
11 if [ "x" == "x$3" ]; then TIMEOUT=10; else TIMEOUT=$3; fi
12 if [ "x" == "x$4" ]; then SIZE=unknown; else SIZE=$4; fi
23 [ $SIZE == unknown ] || \
24 { echo "FAIL: '$SRC' exists but size given" > /dev/stderr; exit 1; }
26 [ $SIZE == unknown ] && SIZE=876543
27 tmpfile $SRC $SIZE $$ || \
28 { echo "FAIL: Sourcefile '$SRC' create" > /dev/stderr; exit 1; }
31 if [ ! -f $SRC ]; then
32 echo "FAIL: Sourcefile '$SRC' not found" > /dev/stderr; exit 1
35 if [ "x$XFAIL" != "xXFAIL" ]; then
36 if ping -n -c5 $TARGET > /dev/null ; then
37 echo "INFO:<$$: $TARGET is up>" > /dev/stderr
39 echo "FAIL:<$$: $TARGET is down>" > /dev/stderr; exit 1
52 # This test is to test tftp GET not PUT so gloss over one failed put
53 # (ie. if it reports corrupt the first time, put it again).
60 if ! cmp -s $SRC $TMP; then
61 echo "INFO:<$$: putting $SIZE bytes to $TARGET a second time>"
71 while [ $SECONDS -le $TIMEOUT ]; do
78 [ -f $TMP ] || [ "x$XFAIL" == "xXFAIL" ] || break
79 cmp -s $SRC $TMP || { ((FAILS++)); [ "x$XFAIL" == "xXFAIL" ]; } || break
83 if [ "x$XFAIL" == "xXFAIL" ]; then
84 echo "PASS:<$$: tftp get XFAIL, $TIMEOUT seconds $SIZE bytes $FAILS/$COUNT fails>" > /dev/stderr
88 if [ 1 -lt $FAILS ]; then
89 echo "FAIL:<$$: wierd, multiple failures $FAILS in $COUNT xfers>" > /dev/stderr
92 if [ ! -f $TMP ]; then
93 echo "FAIL:<$$: temp file $TMP nonexistent $COUNT xfers>" > /dev/stderr
97 if ! cmp -s $SRC $TMP; then
98 echo "FAIL:<$$: temp file $TMP corrupt $COUNT xfers>" > /dev/stderr
102 echo "PASS:<$$: tftp get OK, $TIMEOUT seconds $SIZE bytes $COUNT xfers>" > /dev/stderr