]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/net/autotest/v2_0/host/obey.sh
Initial revision
[karo-tx-redboot.git] / packages / net / autotest / v2_0 / host / obey.sh
1 #!/bin/sh
2
3 if [ $# -gt 1 ]; then
4     echo "Usage: $0 [acknowledgement-agent]" > /dev/stderr
5     exit 1
6 fi
7
8 # add . to the path for testing.
9 export PATH=$PATH:.
10
11 # get a script for returning results to the testcase; its API is
12 #      echo .... | SENDACK [XFAIL] <target>
13 if [ $# -gt 0 ]; then
14     SENDACK=$1; shift
15 else
16     SENDACK=sendack.sh
17 fi
18
19 TMP=/tmp/auto   ;# root of temporary filespace
20
21 WF=${TMP}/wf    ;# work files for tftp et al
22 LG=${TMP}/log   ;# log files for individual tests
23
24 declare -i unique=0 ;# unique IDs for workfiles and logfiles
25
26 while [ true ]; do
27
28     ((unique++))
29
30     read -a ORDERS || { echo "FAIL: EOF on read" > /dev/stderr; exit 1; }
31
32     set ${ORDERS[@]}
33
34     [ "xQUIT" == "x$1" ] && break
35
36     [ "xORDERS:" != "x$1" ] && \
37         { echo "No ORDERS tag" > /dev/stderr; continue; }
38
39     XFAIL=""; [ "xXFAIL" == "x$2" ] && { XFAIL="XFAIL"; shift; }
40
41     shift; TEST=$1
42     shift; TARGET=$1
43     shift; PARAMS=($@)
44
45     echo "test $TEST [$XFAIL]; target $TARGET; params ${PARAMS[@]}"
46
47     # Be robust against zealous GC of workfiles - as late as possible
48     # before we use them, it's in the read above that we sleep.
49     [ ! -d ${TMP} ] && mkdir ${TMP}
50     [ ! -d ${WF}  ] && mkdir ${WF}
51     [ ! -d ${LG}  ] && mkdir ${LG}
52
53     # Now the main switch that runs the test script: this is where
54     # new testcases are added:
55     case $TEST in
56
57     TFTP_SERV_GET)
58     tftpget.sh $XFAIL $TARGET $WF/tftpget.$unique ${PARAMS[@]} \
59             2>&1 >$LG/tftpget.$unique   | $SENDACK $XFAIL $TARGET & ;;
60
61     TFTP_SERV_PUT)
62     tftpput.sh $XFAIL $TARGET $WF/tftpput.$unique ${PARAMS[@]} \
63             2>&1 >$LG/tftpput.$unique   | $SENDACK $XFAIL $TARGET & ;;
64
65     SLOW_PING)
66     slowping.sh $XFAIL $TARGET ${PARAMS[@]} \
67             2>&1 >$LG/slowping.$unique  | $SENDACK $XFAIL $TARGET & ;;
68
69     FLOOD_PING)
70     floodping.sh $XFAIL $TARGET ${PARAMS[@]} \
71             2>&1 >$LG/floodping.$unique  | $SENDACK $XFAIL $TARGET & ;;
72
73     SNMP_WALK)
74     snmpwalk.sh $XFAIL $TARGET ${PARAMS[@]} \
75             2>&1 >$LG/snmpwalk.$unique  | $SENDACK $XFAIL $TARGET & ;;
76
77     *) echo "Unknown order $TEST" > /dev/stderr ;;
78
79     esac
80
81 done
82
83 # EOF