aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBotao Sun <botao.sun@linaro.org>2014-10-22 22:27:07 +1100
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2014-11-26 21:49:06 +0000
commite7c7473592f93af62a317e7eeebc2125684b713f (patch)
tree33d1ba02f289874ff9f94f4826380e485d9307f1
parent872b4241c461bc18df2e0de2bdb7b52aac854543 (diff)
generator.sh: POSIX Compliant Update.2014.11
This change is to make the test script to be POSIX compliant. Original patch comes from: Lucas Dutra Nunes <ldnunes@ossystems.com.br> Signed-off by: Botao Sun <botao.sun@linaro.org> Change-Id: I5045bfb582a630699a39b077cfb4ee3f32263ae3
-rwxr-xr-xcommon/scripts/generator.sh41
1 files changed, 30 insertions, 11 deletions
diff --git a/common/scripts/generator.sh b/common/scripts/generator.sh
index 61808c83..e06a1177 100755
--- a/common/scripts/generator.sh
+++ b/common/scripts/generator.sh
@@ -1,18 +1,35 @@
#!/bin/sh
+#
+# Copyright (C) 2010 - 2014, Linaro Limited.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
set -x
usage()
{
- echo "usage:\n" \
- " - $1 (interface.Primary traffic output interface.)\n" \
- " - $2 (address.The IP address that the packages will be replayed to.)\n" \
- " - $3 (rate.Replay packets at a given packets/sec.It takes an integer number or 'max' as its argument.)\n" \
- " - $4 (loop number.Loop through the capture file X times.)"
+ echo "usage:"
+ echo " - $1 (interface.Primary traffic output interface.)"
+ echo " - $2 (address.The IP address that the packages will be replayed to.)"
+ echo " - $3 (rate.Replay packets at a given packets/sec.It takes an integer number or 'max' as its argument.)"
+ echo " - $4 (loop number.Loop through the capture file X times.)"
}
if [ $# -ne 4 ]; then
- echo "param miss!"
- usage
- exit 1
+ echo "param miss!"
+ usage
+ exit 1
fi
INTF=$1
@@ -24,16 +41,18 @@ local_ip=$(ifconfig $INTF |grep "inet addr"|grep -v "127.0.0.1"|cut -d: -f2|cut
remote_ip=$ADDR
local_mac=$(ifconfig $INTF | grep "HWaddr" | awk '{print $5}')
ping -c 1 ${remote_ip}
+
if [ $? -ne 0 ]; then
- echo "Address $remote_ip isn't reachable"
- exit 1
+ echo "Address $remote_ip isn't reachable"
+ exit 1
fi
remote_mac=$(arp -a | grep "${remote_ip}" | awk '{print $4}')
opt="-t"
if [ $RATE != 'max' ]; then
- opt="-p $RATE"
+ opt="-p $RATE"
fi
+
infile="./common/scripts/pcapfiles/iperf.pcap"
tcpreplay -V
tcpprep -a client -i $infile -o tmpcap.cache