diff options
Diffstat (limited to 'example/packet/pktio_run.sh')
-rwxr-xr-x | example/packet/pktio_run.sh | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/example/packet/pktio_run.sh b/example/packet/pktio_run.sh index 3adb2d62e..f08c45936 100755 --- a/example/packet/pktio_run.sh +++ b/example/packet/pktio_run.sh @@ -1,62 +1,68 @@ #!/bin/bash # -# Copyright (c) 2016, Linaro Limited -# All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2016-2018 Linaro Limited # -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` -PCAP_OUT="pcapout.pcap" -PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}` -echo "using PCAP in=${PCAP_IN}:out=${PCAP_OUT} size %${PCAP_IN_SIZE}" +TEST_TIME=0.1 + +if [ -f ./pktio_env ]; then + . ./pktio_env +else + echo "BUG: unable to find pktio_env!" + echo "pktio_env has to be in current directory" + exit 1 +fi + +setup_interfaces # burst mode -./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0 +./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 0 STATUS=$? -PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` -rm -f ${PCAP_OUT} - -if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then - echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" exit 1 fi -echo "Pass -m 0: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + +validate_result +echo "Pass -m 0: status ${STATUS}" # queue mode -./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 1 +./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 1 STATUS=$? -PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` -rm -f ${PCAP_OUT} -if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then - echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" exit 2 fi -echo "Pass -m 1: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + +validate_result +echo "Pass -m 1: status ${STATUS}" # sched/queue mode -./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 2 +./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 2 STATUS=$? -PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` -rm -f ${PCAP_OUT} -if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then - echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" exit 3 fi -echo "Pass -m 2: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + +validate_result +echo "Pass -m 2: status ${STATUS}" # cpu number option test 1 -./odp_pktio -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0 -c 1 +./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 0 -c 1 STATUS=$? -PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` -rm -f ${PCAP_OUT} -if [ ${STATUS} -ne 0 ] || [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then - echo "Error: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" exit 4 fi -echo "Pass -m 0 -c 1: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + +validate_result +echo "Pass -m 0 -c 1: status ${STATUS}" + +cleanup_interfaces exit 0 |