aboutsummaryrefslogtreecommitdiff
path: root/example/switch/switch_run.sh
blob: 9b32973e573f5dca6933ed8e5d1652a1bc1a41db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
#
# Copyright (c) 2016, Linaro Limited
# All rights reserved.
#
# SPDX-License-Identifier:     BSD-3-Clause
#

NUM_RX_PORT=3
RETVAL=0

PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`

echo "Switch test using PCAP_IN = ${PCAP_IN}"

RX_PORTS=""
for i in `seq 1 $NUM_RX_PORT`;
do
	RX_PORTS="${RX_PORTS},pcap:out=pcapout${i}.pcap"
done

./odp_switch -i pcap:in=${PCAP_IN}${RX_PORTS} &

sleep 1
kill $!
wait $!
STATUS=$?

if [ "$STATUS" -ne 143 ]; then
  echo "Error: status was: $STATUS, expected 143"
  RETVAL=1
fi

for i in `seq 1 $NUM_RX_PORT`;
do
	if [ `stat -c %s pcapout${i}.pcap` -ne `stat -c %s udp64.pcap` ]; then
		echo "Error: Output file $i size not matching"
		RETVAL=1
	fi
	rm -f pcapout${i}.pcap
done

exit $RETVAL