diff options
author | Kiran Kumar K <kirankumark@marvell.com> | 2020-11-30 13:47:19 +0530 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2020-12-03 11:21:54 +0200 |
commit | 1cf1fd4f30004c9a957a7f35ae980e45be049e10 (patch) | |
tree | 6ccba6f914197aaed28738607b0325d68a6fc30c /example | |
parent | f00f240ccb7f3aa4c499c162b3b6d64055bbd86e (diff) |
example: cls: add application test script
Add test for the classifier example application. The test configures one
PMR to match source IP addresses. The test traffic is read from a
capture file using pcap pktio. The number of received packets is verified
from both the target queue and default queue. Classifier example test
is now run during 'make check'.
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
Diffstat (limited to 'example')
-rw-r--r-- | example/classifier/Makefile.am | 29 | ||||
-rwxr-xr-x | example/classifier/odp_classifier_run.sh | 34 | ||||
-rw-r--r-- | example/classifier/udp64.pcap | bin | 0 -> 18544 bytes |
3 files changed, 63 insertions, 0 deletions
diff --git a/example/classifier/Makefile.am b/example/classifier/Makefile.am index a0003e9a4..4be6648b6 100644 --- a/example/classifier/Makefile.am +++ b/example/classifier/Makefile.am @@ -3,3 +3,32 @@ include $(top_srcdir)/example/Makefile.inc bin_PROGRAMS = odp_classifier odp_classifier_SOURCES = odp_classifier.c + +if test_example +if ODP_PKTIO_PCAP +TESTS = odp_classifier_run.sh +endif +endif +EXTRA_DIST = odp_classifier_run.sh udp64.pcap + +# If building out-of-tree, make check will not copy the scripts and data to the +# $(builddir) assuming that all commands are run locally. However this prevents +# running tests on a remote target using LOG_COMPILER. +# So copy all script and data files explicitly here. +all-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + if [ -e $(srcdir)/$$f ]; then \ + mkdir -p $(builddir)/$$(dirname $$f); \ + cp -f $(srcdir)/$$f $(builddir)/$$f; \ + fi \ + done \ + fi + ln -f -s $(top_srcdir)/platform/$(with_platform)/test/example/classifier/pktio_env \ + pktio_env +clean-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + rm -f $(builddir)/$$f; \ + done \ + fi diff --git a/example/classifier/odp_classifier_run.sh b/example/classifier/odp_classifier_run.sh new file mode 100755 index 000000000..2b5fe7ebb --- /dev/null +++ b/example/classifier/odp_classifier_run.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# Copyright (c) 2020, Marvell +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +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 + +./odp_classifier${EXEEXT} -t $TIME_OUT_VAL -i $IF0 -m 0 -p \ + "ODP_PMR_SIP_ADDR:10.10.10.0:0xFFFFFF00:queue1" -P -C "queue1:${CPASS_COUNT_ARG1}" \ + -C "DefaultCos:${CPASS_COUNT_ARG2}" + +STATUS=$? + +if [ ${STATUS} -ne 0 ]; then + echo "Error: status ${STATUS}" + exit 1 +fi + +validate_result + +cleanup_interfaces + +exit 0 diff --git a/example/classifier/udp64.pcap b/example/classifier/udp64.pcap Binary files differnew file mode 100644 index 000000000..fb05ef0f7 --- /dev/null +++ b/example/classifier/udp64.pcap |