diff options
author | Sunil Kumar Kori <skori@marvell.com> | 2020-09-22 14:25:31 +0530 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2020-10-14 09:23:15 +0300 |
commit | 9a4244c786122d9bf56c0e5c497ddf2bc9e71576 (patch) | |
tree | ed7715836a78817aa5a6299e9821a2c3c7685b69 /example | |
parent | e278ff4f4a705691a18ea7d7013d12288a3c747e (diff) |
example: script: enhance application run script
Currently example applications uses pcap based pktio to validate the
functionality on linux-generic platform during make check but other
platforms may not be supporting pcap interfaces as pktio.
So example application's run scripts are enhanced to use generic framework
to define pktio interfaces and corresponding interface environment scripts
are placed under platform implementation.
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'example')
-rw-r--r-- | example/l2fwd_simple/.gitignore | 1 | ||||
-rw-r--r-- | example/l2fwd_simple/Makefile.am | 2 | ||||
-rwxr-xr-x | example/l2fwd_simple/l2fwd_simple_run.sh | 23 | ||||
-rw-r--r-- | example/l3fwd/.gitignore | 1 | ||||
-rw-r--r-- | example/l3fwd/Makefile.am | 2 | ||||
-rwxr-xr-x | example/l3fwd/odp_l3fwd_run.sh | 26 | ||||
-rw-r--r-- | example/packet/.gitignore | 1 | ||||
-rw-r--r-- | example/packet/Makefile.am | 2 | ||||
-rwxr-xr-x | example/packet/packet_dump_run.sh | 14 | ||||
-rwxr-xr-x | example/packet/pktio_run.sh | 64 | ||||
-rw-r--r-- | example/ping/.gitignore | 1 | ||||
-rw-r--r-- | example/ping/Makefile.am | 2 | ||||
-rwxr-xr-x | example/ping/ping_run.sh | 28 | ||||
-rw-r--r-- | example/simple_pipeline/.gitignore | 1 | ||||
-rw-r--r-- | example/simple_pipeline/Makefile.am | 2 | ||||
-rwxr-xr-x | example/simple_pipeline/simple_pipeline_run.sh | 20 | ||||
-rw-r--r-- | example/switch/.gitignore | 1 | ||||
-rw-r--r-- | example/switch/Makefile.am | 2 | ||||
-rwxr-xr-x | example/switch/switch_run.sh | 30 |
19 files changed, 134 insertions, 89 deletions
diff --git a/example/l2fwd_simple/.gitignore b/example/l2fwd_simple/.gitignore index b59fa7e9b..8d15c2726 100644 --- a/example/l2fwd_simple/.gitignore +++ b/example/l2fwd_simple/.gitignore @@ -1,3 +1,4 @@ odp_l2fwd_simple +pktio_env *.log *.trs diff --git a/example/l2fwd_simple/Makefile.am b/example/l2fwd_simple/Makefile.am index 8a76b4904..c46d7a936 100644 --- a/example/l2fwd_simple/Makefile.am +++ b/example/l2fwd_simple/Makefile.am @@ -24,6 +24,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/l2fwd_simple/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/l2fwd_simple/l2fwd_simple_run.sh b/example/l2fwd_simple/l2fwd_simple_run.sh index 3d1b4130e..cf3e189ca 100755 --- a/example/l2fwd_simple/l2fwd_simple_run.sh +++ b/example/l2fwd_simple/l2fwd_simple_run.sh @@ -6,11 +6,17 @@ # SPDX-License-Identifier: BSD-3-Clause # -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` -echo "using PCAP_IN = ${PCAP_IN}" +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 -./odp_l2fwd_simple${EXEEXT} pcap:in=${PCAP_IN} pcap:out=pcapout.pcap \ - 02:00:00:00:00:01 02:00:00:00:00:02 -t 2 +setup_interfaces + +./odp_l2fwd_simple${EXEEXT} $IF0 $IF1 02:00:00:00:00:01 02:00:00:00:00:02 -t 2 STATUS=$? if [ "$STATUS" -ne 0 ]; then @@ -18,12 +24,7 @@ if [ "$STATUS" -ne 0 ]; then exit 1 fi -if [ `stat -c %s pcapout.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then - echo "File sizes disagree" - exit 1 -fi - -rm -f pcapout.pcap +validate_result ./odp_l2fwd_simple${EXEEXT} null:0 null:1 \ 02:00:00:00:00:01 02:00:00:00:00:02 -t 2 @@ -34,4 +35,6 @@ if [ "$STATUS" -ne 0 ]; then exit 1 fi +cleanup_interfaces + exit 0 diff --git a/example/l3fwd/.gitignore b/example/l3fwd/.gitignore index 3411830e4..8b9e2355f 100644 --- a/example/l3fwd/.gitignore +++ b/example/l3fwd/.gitignore @@ -1,3 +1,4 @@ odp_l3fwd +pktio_env *.log *.trs diff --git a/example/l3fwd/Makefile.am b/example/l3fwd/Makefile.am index f15ac3592..73ef6f3be 100644 --- a/example/l3fwd/Makefile.am +++ b/example/l3fwd/Makefile.am @@ -29,6 +29,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/l3fwd/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/l3fwd/odp_l3fwd_run.sh b/example/l3fwd/odp_l3fwd_run.sh index acffb8431..33ac2258d 100755 --- a/example/l3fwd/odp_l3fwd_run.sh +++ b/example/l3fwd/odp_l3fwd_run.sh @@ -6,23 +6,27 @@ # SPDX-License-Identifier: BSD-3-Clause # -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}, PCAP_OUT = ${PCAP_OUT}" +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 -./odp_l3fwd${EXEEXT} -i pcap:in=${PCAP_IN},pcap:out=${PCAP_OUT} \ - -r "10.0.0.0/24,pcap:out=${PCAP_OUT}" -d 30 +setup_interfaces + +./odp_l3fwd${EXEEXT} -i $IF0,$IF1 -r "10.0.0.0/24,$IF1" -d 30 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: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" +validate_result + +cleanup_interfaces exit 0 diff --git a/example/packet/.gitignore b/example/packet/.gitignore index 02752853e..b3869816f 100644 --- a/example/packet/.gitignore +++ b/example/packet/.gitignore @@ -1,5 +1,6 @@ odp_packet_dump odp_pktio +pktio_env *.log *.trs pcapout.pcap diff --git a/example/packet/Makefile.am b/example/packet/Makefile.am index d3713c981..8db639730 100644 --- a/example/packet/Makefile.am +++ b/example/packet/Makefile.am @@ -27,6 +27,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/packet/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/packet/packet_dump_run.sh b/example/packet/packet_dump_run.sh index fe43aa272..4e7861b1c 100755 --- a/example/packet/packet_dump_run.sh +++ b/example/packet/packet_dump_run.sh @@ -6,15 +6,23 @@ # SPDX-License-Identifier: BSD-3-Clause # -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +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 -echo "Packet dump test using PCAP_IN = ${PCAP_IN}" +setup_interfaces -./odp_packet_dump${EXEEXT} -i pcap:in=${PCAP_IN}:loops=10 -n 10 -o 0 -l 64 +./odp_packet_dump${EXEEXT} -i $IF0 -n 10 -o 0 -l 64 STATUS=$? if [ "$STATUS" -ne 0 ]; then echo "Error: status was: $STATUS, expected 0" exit 1 fi +cleanup_interfaces + exit 0 diff --git a/example/packet/pktio_run.sh b/example/packet/pktio_run.sh index 6abaec16d..8f9e6f7d3 100755 --- a/example/packet/pktio_run.sh +++ b/example/packet/pktio_run.sh @@ -6,57 +6,63 @@ # SPDX-License-Identifier: BSD-3-Clause # -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}" +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${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0 +./odp_pktio${EXEEXT} -i $IF1 -t 5 -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${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 1 +./odp_pktio${EXEEXT} -i $IF1 -t 5 -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${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 2 +./odp_pktio${EXEEXT} -i $IF1 -t 5 -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${EXEEXT} -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} -t 5 -m 0 -c 1 +./odp_pktio${EXEEXT} -i $IF1 -t 5 -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 diff --git a/example/ping/.gitignore b/example/ping/.gitignore index 12b2bef41..6222c2866 100644 --- a/example/ping/.gitignore +++ b/example/ping/.gitignore @@ -1,4 +1,5 @@ odp_ping +pktio_env *.log *.trs pcapout.pcap diff --git a/example/ping/Makefile.am b/example/ping/Makefile.am index 302131c30..f15b3829c 100644 --- a/example/ping/Makefile.am +++ b/example/ping/Makefile.am @@ -24,6 +24,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/ping/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/ping/ping_run.sh b/example/ping/ping_run.sh index d61a352d0..5fa7a649f 100755 --- a/example/ping/ping_run.sh +++ b/example/ping/ping_run.sh @@ -6,21 +6,29 @@ # SPDX-License-Identifier: BSD-3-Clause # -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name icmp_echo_req.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}" +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 # Ping test with 100 ICMP echo request packets (verbose mode) -./odp_ping${EXEEXT} -v -n 100 -ipcap:in=${PCAP_IN}:out=${PCAP_OUT} +./odp_ping${EXEEXT} -v -n 100 -i $IF0 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: status ${STATUS}, in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + +validate_result + +cleanup_interfaces + +echo "Pass: status ${STATUS}" exit 0 diff --git a/example/simple_pipeline/.gitignore b/example/simple_pipeline/.gitignore index 3b1c20744..28cb24d41 100644 --- a/example/simple_pipeline/.gitignore +++ b/example/simple_pipeline/.gitignore @@ -1,3 +1,4 @@ odp_simple_pipeline +pktio_env *.log *.trs diff --git a/example/simple_pipeline/Makefile.am b/example/simple_pipeline/Makefile.am index fba79f680..9e24ac18f 100644 --- a/example/simple_pipeline/Makefile.am +++ b/example/simple_pipeline/Makefile.am @@ -24,6 +24,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/simple_pipeline/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/simple_pipeline/simple_pipeline_run.sh b/example/simple_pipeline/simple_pipeline_run.sh index 3eba3a677..7d84df303 100755 --- a/example/simple_pipeline/simple_pipeline_run.sh +++ b/example/simple_pipeline/simple_pipeline_run.sh @@ -9,15 +9,22 @@ # Exit code expected by automake for skipped tests TEST_SKIPPED=77 -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` -echo "using PCAP_IN = ${PCAP_IN}" +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 if [ $(nproc --all) -lt 3 ]; then echo "Not enough CPU cores. Skipping test." exit $TEST_SKIPPED fi -./odp_simple_pipeline${EXEEXT} -i pcap:in=${PCAP_IN},pcap:out=pcapout.pcap -e -t 2 +setup_interfaces + +./odp_simple_pipeline${EXEEXT} -i $IF0,$IF1 -e -t 2 STATUS=$? if [ "$STATUS" -ne 0 ]; then @@ -25,11 +32,8 @@ if [ "$STATUS" -ne 0 ]; then exit 1 fi -if [ `stat -c %s pcapout.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then - echo "File sizes disagree" - exit 1 -fi +validate_result -rm -f pcapout.pcap +cleanup_interfaces exit 0 diff --git a/example/switch/.gitignore b/example/switch/.gitignore index 1bd93e32d..63ef8af6e 100644 --- a/example/switch/.gitignore +++ b/example/switch/.gitignore @@ -1,3 +1,4 @@ odp_switch +pktio_env *.log *.trs diff --git a/example/switch/Makefile.am b/example/switch/Makefile.am index 6244fec74..b39ac29ee 100644 --- a/example/switch/Makefile.am +++ b/example/switch/Makefile.am @@ -24,6 +24,8 @@ all-local: fi \ done \ fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/switch/pktio_env \ + pktio_env clean-local: if [ "x$(srcdir)" != "x$(builddir)" ]; then \ for f in $(EXTRA_DIST); do \ diff --git a/example/switch/switch_run.sh b/example/switch/switch_run.sh index 5fa1ae1cd..3b6212239 100755 --- a/example/switch/switch_run.sh +++ b/example/switch/switch_run.sh @@ -6,33 +6,27 @@ # 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}" +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 -RX_PORTS="" -for i in `seq 1 $NUM_RX_PORT`; -do - RX_PORTS="${RX_PORTS},pcap:out=pcapout${i}.pcap" -done +setup_interfaces -./odp_switch${EXEEXT} -i pcap:in=${PCAP_IN}${RX_PORTS} -t 1 +./odp_switch${EXEEXT} -i $IF0,$IF1,$IF2,$IF3 -t 1 STATUS=$? if [ "$STATUS" -ne 0 ]; then echo "Error: status was: $STATUS, expected 0" RETVAL=1 fi -for i in `seq 1 $NUM_RX_PORT`; -do - if [ `stat -c %s pcapout${i}.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then - echo "Error: Output file $i size not matching" - RETVAL=1 - fi - rm -f pcapout${i}.pcap -done +validate_result + +cleanup_interfaces exit $RETVAL |