OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [autotest/] [current/] [host/] [slowping.sh] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#!/bin/sh
2
 
3
if [ $# -lt 1 ]; then
4
    echo "Usage: $0 [XFAIL] target [timeout [size]]" > /dev/stderr
5
    exit 1
6
fi
7
 
8
[ "xXFAIL" == "x$1" ] && { XFAIL="XFAIL"; shift; }
9
TARGET=$1
10
if [ "x" == "x$2" ]; then TIMEOUT=10;   else TIMEOUT=$2; fi
11
if [ "x" == "x$3" ]; then PINGSIZE=64;  else PINGSIZE=$3; fi
12
 
13
if [ "x$XFAIL" != "xXFAIL" ]; then
14
    # first try normal size packets
15
    if ping -n -c 5 $TARGET > /dev/null ; then
16
        echo "INFO:<$$: $TARGET is up>" > /dev/stderr
17
    else
18
        echo "FAIL:<$$: $TARGET is down>" > /dev/stderr; exit 1
19
    fi
20
fi
21
 
22
# then the size we were asked to do, for the time requested
23
ping -n -c $TIMEOUT -s $PINGSIZE $TARGET > /tmp/ping$$ && PINGRESULT=ok
24
 
25
# dump this out for the controller logfile
26
cat /tmp/ping$$
27
 
28
INFO1=$(grep "bytes of data" /tmp/ping$$)
29
INFO2=$(grep "packet loss" /tmp/ping$$)
30
INFO3=$(grep "round-trip" /tmp/ping$$)
31
 
32
rm -f /tmp/ping$$
33
 
34
[ "x" != "x$INFO1" ] && echo "INFO:<$$: $INFO1>" > /dev/stderr
35
[ "x" != "x$INFO2" ] && echo "INFO:<$$: $INFO2>" > /dev/stderr
36
[ "x" != "x$INFO3" ] && echo "INFO:<$$: $INFO3>" > /dev/stderr
37
 
38
if [ "x$XFAIL" == "xXFAIL" ]; then
39
    echo "PASS:<$$: slow ping XFAIL, $PINGSIZE bytes $TIMEOUT packets/seconds>" > /dev/stderr
40
    exit 0
41
fi
42
 
43
if [ "x" == "x$PINGRESULT" ]; then
44
    echo "FAIL:<$$: slow ping failed, $PINGSIZE bytes $TIMEOUT packets/seconds>" > /dev/stderr
45
    exit 1
46
fi
47
 
48
echo "PASS:<$$: slow ping OK, $PINGSIZE bytes $TIMEOUT packets/seconds>" > /dev/stderr
49
 
50
# EOF

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.