From: Konstantin Ananyev <konstantin.ananyev@intel.com>
To: dev@dpdk.org
Cc: Konstantin Ananyev <konstantin.ananyev@intel.com>
Subject: [dpdk-dev] [PATCH] app/acl: add script for automate testing
Date: Tue, 18 May 2021 12:26:19 +0100 [thread overview]
Message-ID: <20210518112619.4237-1-konstantin.ananyev@intel.com> (raw)
The purpose of this script is to help automate ACL library functional
testing using test-acl app.
Sample input files are also provided.
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
---
app/test-acl/input/acl1v4_5_rule | 5 ++
app/test-acl/input/acl1v4_5_trace | 5 ++
app/test-acl/input/acl1v6_1_rule | 1 +
app/test-acl/input/acl1v6_1_trace | 2 +
app/test-acl/test-acl.sh | 92 +++++++++++++++++++++++++++++++
5 files changed, 105 insertions(+)
create mode 100644 app/test-acl/input/acl1v4_5_rule
create mode 100644 app/test-acl/input/acl1v4_5_trace
create mode 100644 app/test-acl/input/acl1v6_1_rule
create mode 100644 app/test-acl/input/acl1v6_1_trace
create mode 100644 app/test-acl/test-acl.sh
diff --git a/app/test-acl/input/acl1v4_5_rule b/app/test-acl/input/acl1v4_5_rule
new file mode 100644
index 0000000000..45301f3a3d
--- /dev/null
+++ b/app/test-acl/input/acl1v4_5_rule
@@ -0,0 +1,5 @@
+@16.32.1.1/32 2.1.0.0/16 0 : 65535 0 : 65535 0/0
+@16.32.1.0/24 2.1.1.0/24 0 : 65535 0 : 65535 0/0
+@2.1.0.0/16 16.32.1.1/32 0 : 65535 0 : 65535 0/0
+@2.1.0.0/16 16.32.1.0/24 1000 : 2000 0 : 65535 0/0
+@2.1.1.0/24 16.32.1.0/24 0 : 65535 0 : 65535 0/0
diff --git a/app/test-acl/input/acl1v4_5_trace b/app/test-acl/input/acl1v4_5_trace
new file mode 100644
index 0000000000..bfbcd31f88
--- /dev/null
+++ b/app/test-acl/input/acl1v4_5_trace
@@ -0,0 +1,5 @@
+0x10200101 0x02010304 100 100 6 0
+0x10200103 0x02010104 100 100 6 1
+0x02010304 0x10200101 100 100 6 2
+0x02010104 0x10200103 100 100 6 4
+0x02010104 0x10200101 100 100 6 2
diff --git a/app/test-acl/input/acl1v6_1_rule b/app/test-acl/input/acl1v6_1_rule
new file mode 100644
index 0000000000..2ea9856b27
--- /dev/null
+++ b/app/test-acl/input/acl1v6_1_rule
@@ -0,0 +1 @@
+@9baa:cead:8000:0000:e300:00ff:fe04:c5a8/33 d1b5:2feb:0000:0000:6600:00ff:fed9:aeaa/33 0 : 65535 1526 : 1526 0x00/0x00
diff --git a/app/test-acl/input/acl1v6_1_trace b/app/test-acl/input/acl1v6_1_trace
new file mode 100644
index 0000000000..6e86741edf
--- /dev/null
+++ b/app/test-acl/input/acl1v6_1_trace
@@ -0,0 +1,2 @@
+9baa:cead:8000:0000:0000:0000:0000:0000 d1b5:2feb:0000:0000:0000:0000:0000:0000 37826 1526 6 0
+2eba:cc41:0000:0000:0000:0000:0000:0000 16ef:6cdb:0000:0000:0000:0000:0000:0000 25946 1525 0 4294967295
diff --git a/app/test-acl/test-acl.sh b/app/test-acl/test-acl.sh
new file mode 100644
index 0000000000..348962c540
--- /dev/null
+++ b/app/test-acl/test-acl.sh
@@ -0,0 +1,92 @@
+#! /bin/bash
+# SPDX-License-Identifier: BSD-3-Clause
+
+# Usage:
+# /bin/bash <test-acl-binary> <dir-with-acl-rules-traces> <acl-alg> <burst-size>
+# Expected file-naming conventions:
+# - for rules: 'acl[0-9]v[4,6]_[0-9,a-z]+_rule'
+# - for traces: 'acl[0-9]v[4,6]_[0-9,a-z]+_trace'
+# Each rule file expects to have exactly one trace file.
+# test-acl app follows classbench file format.
+# Each line defines exactly one rule/trace.
+# rules record format:
+# '@'<src_ip_addr>'/'<masklen><space> \
+# <dst_ipv4_addr>'/'<masklen><space> \
+# <src_port_low><space>":"<src_port_high><space> \
+# <dst_port_low><space>":"<dst_port_high><space> \
+# <proto>'/'<mask>
+# trace record format:
+# <src_ip_addr><space><dst_ip_addr><space> \
+# <src_port><space<dst_port><space><proto>...<rule_id>
+#
+# As an example:
+# /bin/bash app/test-acl/test-acl.sh build/app/dpdk-test-acl \
+# app/test-acl/input scalar 32
+#
+# Refer to test-acl app for more information about rules/trace files format,
+# available test-acl command-line options, etc.
+
+TACL_PATH=$1
+TACL_DIR=$2
+TACL_ALG=$3
+TACL_STEP=$4
+
+if [[ ! -x ${TACL_PATH} ]]; then
+ echo "invalid TACL_PATH=${TACL_PATH}"
+ exit 127
+fi
+
+if [[ ! -d ${TACL_DIR} ]]; then
+ echo "invalid TACL_DIR=${TACL_DIR}"
+ exit 127
+fi
+
+V4F=`find ${TACL_DIR} -type f | egrep -e 'acl[0-9]v4_[0-9,a-z]+_rule$'`
+V6F=`find ${TACL_DIR} -type f | egrep -e 'acl[0-9]v6_[0-9,a-z]+_rule$'`
+
+run_test()
+{
+ i=$1
+ n=`basename ${i}`
+
+ TRACEF=`echo ${i} | sed -e 's/_rule$/_trace/'`
+ if [[ ! -f ${TRACEF} ]]; then
+ echo "${TRACEF} not found"
+ echo "test ${n} FAILED"
+ exit 127
+ fi
+
+ OUTF=`mktemp ${n}_XXXXXX`
+ echo "start test ${n} with alg ${TACL_ALG}, burst-size ${TACL_STEP}"
+ ${TACL_PATH} -l 0 -n 4 --log-level="acl,debug" \
+ --force-max-simd-bitwidth=0 --no-pci -- \
+ ${XPRM} --tracenum=200000 --rulesf=${i} --tracef=${TRACEF} \
+ --tracestep=${TACL_STEP} --alg=${TACL_ALG} \
+ > ${OUTF}
+ grep 'result:' ${OUTF} | awk '{print $(NF);}' > ${OUTF}.out
+ sed -e '/^#/d' -e 's/[[:space:]]*$//g' ${TRACEF} | \
+ awk '{print $(NF);}' > ${OUTF}.chk
+ diff -u ${OUTF}.chk ${OUTF}.out
+ st=$?
+ if [[ $st -ne 0 ]]; then
+ echo "test ${n} FAILED"
+ echo "output files:"
+ ls ${OUTF}*
+ cat ${OUTF}*
+ exit 127
+ fi
+ rm -f ${OUTF}*
+ echo "test ${n} OK"
+}
+
+for i in ${V4F}; do
+ run_test $i
+done
+
+for i in ${V6F}; do
+ XPRM='--ipv6'
+ run_test $i
+ unset XPRM
+done
+
+echo "All tests have ended successfully"
--
2.26.3
next reply other threads:[~2021-05-18 11:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-18 11:26 Konstantin Ananyev [this message]
2021-07-24 13:21 ` Thomas Monjalon
2021-07-26 11:51 ` [dpdk-dev] [PATCH v2 0/2] app/acl: help to " Konstantin Ananyev
2021-07-26 11:51 ` [dpdk-dev] [PATCH v2 1/2] app/acl: allow comment and empty lines Konstantin Ananyev
2021-07-26 11:51 ` [dpdk-dev] [PATCH v2 2/2] app/acl: add script for automate testing Konstantin Ananyev
2021-07-30 16:31 ` [dpdk-dev] [PATCH v2 0/2] app/acl: help to " Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210518112619.4237-1-konstantin.ananyev@intel.com \
--to=konstantin.ananyev@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).