Skip to content

Commit

Permalink
test: dmafwd: add CI integration
Browse files Browse the repository at this point in the history
Add test script for running `odp_dmafwd` with a few different scenarios
during `make check`.

Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
  • Loading branch information
TuomasTaipale committed Aug 28, 2023
1 parent 6aa73d4 commit 576dd30
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/performance/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ TESTSCRIPTS = odp_cpu_bench_run.sh \
odp_timer_perf_run.sh

if ODP_PKTIO_PCAP
TESTSCRIPTS += odp_pktio_ordered_run.sh
TESTSCRIPTS += odp_dmafwd_run.sh \
odp_pktio_ordered_run.sh
endif

TEST_EXTENSIONS = .sh
Expand Down Expand Up @@ -96,7 +97,8 @@ $(top_builddir)/example/generator/odp_generator$(EXEEXT):

dist_check_SCRIPTS = $(TESTSCRIPTS)

dist_check_DATA = udp64.pcap
dist_check_DATA = dmafwd.pcap \
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
Expand Down
Binary file added test/performance/dmafwd.pcap
Binary file not shown.
67 changes: 67 additions & 0 deletions test/performance/odp_dmafwd_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Nokia

TEST_SRC_DIR=$(dirname $0)
TEST_DIR="${TEST_DIR:-$(dirname $0)}"
PCAP_FILE=dmafwd.pcap
PCAP_IN=`find . ${TEST_SRC_DIR} $(dirname $0) -name ${PCAP_FILE} -print -quit`
PCAP_OUT=dmafwd_out.pcap
BIN_NAME=odp_dmafwd
BATCH=10
TIME=3
TESTS_RUN=0
VALIN=valin
VALOUT=valout

if [ ! -f ${PCAP_IN} ]; then
echo "FAILURE: ${PCAP_FILE} not found, exiting"
exit 1
fi

check_result()
{
if [ $1 -eq 0 ]; then
TESTS_RUN=`expr $TESTS_RUN + 1`
elif [ $1 -eq 1 ]; then
echo "Test FAILED, exiting"
exit 1
else
echo "Test SKIPPED"
return 0
fi

tcpdump -r ${PCAP_IN} -t -x > ${VALIN}
tcpdump -r ${PCAP_OUT} -t -x > ${VALOUT}
diff ${VALIN} ${VALOUT}
local RET=$?
rm -f ${PCAP_OUT}
rm -f ${VALIN}
rm -f ${VALOUT}

if [ $RET -ne 0 ]; then
echo "FAILURE: input and output captures do not match, exiting"
exit 1
fi
}

echo "${BIN_NAME}: SW copy"
echo "==================="

${TEST_DIR}/${BIN_NAME}${EXEEXT} -i pcap:in=${PCAP_IN}:out=${PCAP_OUT} -b ${BATCH} -T ${TIME} -t 0

check_result $?

echo "${BIN_NAME}: DMA copy"
echo "===================="

${TEST_DIR}/${BIN_NAME}${EXEEXT} -i pcap:in=${PCAP_IN}:out=${PCAP_OUT} -b ${BATCH} -T ${TIME} -t 1

check_result $?

if [ $TESTS_RUN -eq 0 ]; then
exit 77
fi

exit 0

0 comments on commit 576dd30

Please sign in to comment.