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
45 # Just put the file without checking the data; the get test tests that.
46 while [ $SECONDS -le $TIMEOUT ]; do
55 if [ "x$XFAIL" == "xXFAIL" ]; then
56 echo "PASS:<$$: tftp put XFAIL, $TIMEOUT seconds $SIZE bytes $COUNT tries>" > /dev/stderr
60 # Verify it once at the end.
68 if [ ! -f $TMP ]; then
69 echo "FAIL:<$$: temp file $TMP nonexistent $COUNT xfers>" > /dev/stderr
73 if ! cmp -s $SRC $TMP; then
74 echo "FAIL:<$$: temp file $TMP corrupt $COUNT xfers>" > /dev/stderr
78 echo "PASS:<$$: tftp put OK, $TIMEOUT seconds $SIZE bytes $COUNT xfers>" > /dev/stderr