aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/test/performance/dmafwd/pktio_env
blob: 91075973ed1604a90050641ad7f6b0d0614b04e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2023 Nokia

PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit`
PCAP_OUT=dmafwd_out.pcap
IF0=pcap:in=${PCAP_IN}:out=${PCAP_OUT}
DUMP=tcpdump

if [ "$0" = "$BASH_SOURCE" ]; then
	echo "ERROR: Platform specific env file has to be sourced."
fi

validate_result()
{
	local RET=0

	if command -v ${DUMP}; then
		local VALIN=valin
		local VALOUT=valout

		${DUMP} -r ${PCAP_IN} -t -x > ${VALIN}
		${DUMP} -r ${PCAP_OUT} -t -x > ${VALOUT}
		diff ${VALIN} ${VALOUT}
		RET=$?
		rm -f ${VALIN}
		rm -f ${VALOUT}
	else
		echo "WARNING: No ${DUMP} available, using \"stat\" for diff"
		local SZIN=$(stat -c %s ${PCAP_IN})
		local SZOUT=$(stat -c %s ${PCAP_OUT})

		if [ ${SZIN} -ne ${SZOUT} ]; then
			RET=1
		fi
	fi

	rm -f ${PCAP_OUT}

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

	return 0
}

setup_interfaces()
{
	return 0
}

cleanup_interfaces()
{
	return 0
}