~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/net/gro.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 readonly SERVER_MAC="aa:00:00:00:00:02"
  5 readonly CLIENT_MAC="aa:00:00:00:00:01"
  6 readonly TESTS=("data" "ack" "flags" "tcp" "ip" "large")
  7 readonly PROTOS=("ipv4" "ipv6")
  8 dev=""
  9 test="all"
 10 proto="ipv4"
 11 
 12 run_test() {
 13   local server_pid=0
 14   local exit_code=0
 15   local protocol=$1
 16   local test=$2
 17   local ARGS=( "--${protocol}" "--dmac" "${SERVER_MAC}" \
 18   "--smac" "${CLIENT_MAC}" "--test" "${test}" "--verbose" )
 19 
 20   setup_ns
 21   # Each test is run 3 times to deflake, because given the receive timing,
 22   # not all packets that should coalesce will be considered in the same flow
 23   # on every try.
 24   for tries in {1..3}; do
 25     # Actual test starts here
 26     ip netns exec $server_ns ./gro "${ARGS[@]}" "--rx" "--iface" "server" \
 27       1>>log.txt &
 28     server_pid=$!
 29     sleep 0.5  # to allow for socket init
 30     ip netns exec $client_ns ./gro "${ARGS[@]}" "--iface" "client" \
 31       1>>log.txt
 32     wait "${server_pid}"
 33     exit_code=$?
 34     if [[ ${test} == "large" && -n "${KSFT_MACHINE_SLOW}" && \
 35           ${exit_code} -ne 0 ]]; then
 36         echo "Ignoring errors due to slow environment" 1>&2
 37         exit_code=0
 38     fi
 39     if [[ "${exit_code}" -eq 0 ]]; then
 40         break;
 41     fi
 42   done
 43   cleanup_ns
 44   echo ${exit_code}
 45 }
 46 
 47 run_all_tests() {
 48   local failed_tests=()
 49   for proto in "${PROTOS[@]}"; do
 50     for test in "${TESTS[@]}"; do
 51       echo "running test ${proto} ${test}" >&2
 52       exit_code=$(run_test $proto $test)
 53       if [[ "${exit_code}" -ne 0 ]]; then
 54         failed_tests+=("${proto}_${test}")
 55       fi;
 56     done;
 57   done
 58   if [[ ${#failed_tests[@]} -ne 0 ]]; then
 59     echo "failed tests: ${failed_tests[*]}. \
 60     Please see log.txt for more logs"
 61     exit 1
 62   else
 63     echo "All Tests Succeeded!"
 64   fi;
 65 }
 66 
 67 usage() {
 68   echo "Usage: $0 \
 69   [-i <DEV>] \
 70   [-t data|ack|flags|tcp|ip|large] \
 71   [-p <ipv4|ipv6>]" 1>&2;
 72   exit 1;
 73 }
 74 
 75 while getopts "i:t:p:" opt; do
 76   case "${opt}" in
 77     i)
 78       dev="${OPTARG}"
 79       ;;
 80     t)
 81       test="${OPTARG}"
 82       ;;
 83     p)
 84       proto="${OPTARG}"
 85       ;;
 86     *)
 87       usage
 88       ;;
 89   esac
 90 done
 91 
 92 if [ -n "$dev" ]; then
 93         source setup_loopback.sh
 94 else
 95         source setup_veth.sh
 96 fi
 97 
 98 setup
 99 trap cleanup EXIT
100 if [[ "${test}" == "all" ]]; then
101   run_all_tests
102 else
103   run_test "${proto}" "${test}"
104 fi;

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php