blob: dd332c19136bf23cbbff415767b3964bc051f70c (
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
#!/bin/sh
#
# Copyright (c) 2018, Linaro Limited
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
# directory where test binaries have been built
TEST_DIR="${TEST_DIR:-$PWD}"
# directory where test sources are, including scripts
TEST_SRC_DIR=$(dirname $0)
PATH=$TEST_DIR:$TEST_DIR/../../example/generator:$PATH
# exit codes expected by automake for skipped tests
TEST_SKIPPED=77
VALIDATION_TESTDIR=platform/$ODP_PLATFORM/test/validation
PLATFORM_VALIDATION=${TEST_SRC_DIR}/../../$VALIDATION_TESTDIR
FLOOD_MODE=0
# Use installed pktio env or for make check take it from platform directory
if [ -f "./pktio_env" ]; then
. ./pktio_env
elif [ "$ODP_PLATFORM" = "" ]; then
echo "$0: error: ODP_PLATFORM must be defined"
# not skipped as this should never happen via "make check"
exit 1
elif [ -f ${PLATFORM_VALIDATION}/api/pktio/pktio_env ]; then
. ${PLATFORM_VALIDATION}/api/pktio/pktio_env
else
echo "BUG: unable to find pktio_env!"
echo "pktio_env has to be in current directory or "
echo "in platform/\$ODP_PLATFORM/test."
echo "ODP_PLATFORM=\"$ODP_PLATFORM\""
exit 1
fi
run_sched_pktio()
{
setup_pktio_env clean # install trap to call cleanup_pktio_env
if [ $? -ne 0 ]; then
echo "setup_pktio_env error $?"
exit $TEST_SKIPPED
fi
type odp_generator > /dev/null
if [ $? -ne 0 ]; then
echo "odp_generator not installed. Aborting."
cleanup_pktio_env
exit 1
fi
# 1 worker
export ODP_PLATFORM_PARAMS="-m 512 --file-prefix="sched" \
--proc-type auto --no-pci --vdev net_pcap1,iface=$IF1 \
--vdev net_pcap2,iface=$IF2"
odp_sched_pktio${EXEEXT} -i 0,1 -c 1 -s &
TEST_PID=$!
sleep 1
# Run generator with one worker
export ODP_PLATFORM_PARAMS="-m 256 --file-prefix="gen" \
--proc-type auto --no-pci \
--vdev net_pcap0,iface=$IF0"
(odp_generator${EXEEXT} --interval $FLOOD_MODE -I 0 \
--srcip 192.168.0.1 --dstip 192.168.0.2 \
-m u -w 1 2>&1 > /dev/null) \
2>&1 > /dev/null &
GEN_PID=$!
# Run test for 5 sec
sleep 5
kill -2 ${GEN_PID}
wait ${GEN_PID}
# Kill with SIGINT to output statistics
kill -2 ${TEST_PID}
wait ${TEST_PID}
ret=$?
if [ $ret -eq 3 ]; then
echo "PASS: received and transmitted over 5000 packets"
ret=0
else
echo "FAIL: less than thousand rx or tx packets $ret"
ret=1
fi
cleanup_pktio_env
exit $ret
}
case "$1" in
setup) setup_pktio_env ;;
cleanup) cleanup_pktio_env ;;
*) run_sched_pktio ;;
esac
|