2 # SPDX-License-Identifier: BSD-3-Clause
5 # /bin/bash <test-acl-binary> <dir-with-acl-rules-traces> <acl-alg> <burst-size>
6 # Expected file-naming conventions:
7 # - for rules: 'acl[0-9]v[4,6]_[0-9,a-z]+_rule'
8 # - for traces: 'acl[0-9]v[4,6]_[0-9,a-z]+_trace'
9 # Each rule file expects to have exactly one trace file.
10 # test-acl app follows classbench file format.
11 # Each line defines exactly one rule/trace.
12 # rules record format:
13 # '@'<src_ip_addr>'/'<masklen><space> \
14 # <dst_ipv4_addr>'/'<masklen><space> \
15 # <src_port_low><space>":"<src_port_high><space> \
16 # <dst_port_low><space>":"<dst_port_high><space> \
18 # trace record format:
19 # <src_ip_addr><space><dst_ip_addr><space> \
20 # <src_port><space<dst_port><space><proto>...<rule_id>
23 # /bin/bash app/test-acl/test-acl.sh build/app/dpdk-test-acl \
24 # app/test-acl/input scalar 32
26 # Refer to test-acl app for more information about rules/trace files format,
27 # available test-acl command-line options, etc.
34 if [[ ! -x ${TACL_PATH} ]]; then
35 echo "invalid TACL_PATH=${TACL_PATH}"
39 if [[ ! -d ${TACL_DIR} ]]; then
40 echo "invalid TACL_DIR=${TACL_DIR}"
44 V4F=`find ${TACL_DIR} -type f | egrep -e 'acl[0-9]v4_[0-9,a-z]+_rule$'`
45 V6F=`find ${TACL_DIR} -type f | egrep -e 'acl[0-9]v6_[0-9,a-z]+_rule$'`
52 TRACEF=`echo ${i} | sed -e 's/_rule$/_trace/'`
53 if [[ ! -f ${TRACEF} ]]; then
54 echo "${TRACEF} not found"
55 echo "test ${n} FAILED"
59 OUTF=`mktemp ${n}_XXXXXX`
60 echo "start test ${n} with alg ${TACL_ALG}, burst-size ${TACL_STEP}"
61 ${TACL_PATH} -l 0 -n 4 --log-level="acl,debug" \
62 --force-max-simd-bitwidth=0 --no-pci -- \
63 ${XPRM} --tracenum=200000 --rulesf=${i} --tracef=${TRACEF} \
64 --tracestep=${TACL_STEP} --alg=${TACL_ALG} \
66 grep 'result:' ${OUTF} | awk '{print $(NF);}' > ${OUTF}.out
67 sed -e '/^[[:space:]]*#/d' \
68 -e '/^[[:space:]]*$/d' \
69 -e 's/[[:space:]]*$//g' ${TRACEF} | \
70 awk '{print $(NF);}' > ${OUTF}.chk
71 diff -u ${OUTF}.chk ${OUTF}.out
73 if [[ $st -ne 0 ]]; then
74 echo "test ${n} FAILED"
96 echo "All tests have ended successfully"