github.com/osrg/gobgp/v3@v3.30.0/test/scenario_test/run_all_tests.sh (about) 1 #!/bin/bash 2 set +e 3 4 if [ ! -v GOBGP ]; then 5 GOBGP=`pwd` 6 fi 7 8 if [ ! -v GOBGP_IMAGE ]; then 9 GOBGP_IMAGE=gobgp 10 fi 11 12 if [ ! -v WS ]; then 13 WS=`pwd` 14 fi 15 16 export PYTHONPATH=`pwd`/test 17 TESTDIR=`pwd`/test/scenario_test 18 19 PIDS=() 20 21 # route server test 22 python3 $TESTDIR/route_server_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rs -s -x --with-xunit --xunit-file=${WS}/nosetest.xml & 23 PIDS=("${PIDS[@]}" $!) 24 25 # route server ipv4 ipv6 test 26 python3 $TESTDIR/route_server_ipv4_v6_test.py --gobgp-image $GOBGP_IMAGE --test-prefix v6 -s -x --with-xunit --xunit-file=${WS}/nosetest_ip.xml & 27 PIDS=("${PIDS[@]}" $!) 28 29 # bgp router test 30 python3 $TESTDIR/bgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix bgp -s -x --with-xunit --xunit-file=${WS}/nosetest_bgp.xml & 31 PIDS=("${PIDS[@]}" $!) 32 33 # ibgp router test 34 python3 $TESTDIR/ibgp_router_test.py --gobgp-image $GOBGP_IMAGE --test-prefix ibgp -s -x --with-xunit --xunit-file=${WS}/nosetest_ibgp.xml & 35 PIDS=("${PIDS[@]}" $!) 36 37 # evpn router test 38 python3 $TESTDIR/evpn_test.py --gobgp-image $GOBGP_IMAGE --test-prefix evpn -s -x --with-xunit --xunit-file=${WS}/nosetest_evpn.xml & 39 PIDS=("${PIDS[@]}" $!) 40 41 # flowspec test 42 python3 $TESTDIR/flow_spec_test.py --gobgp-image $GOBGP_IMAGE --test-prefix flow -s -x --with-xunit --xunit-file=${WS}/nosetest_flow.xml & 43 PIDS=("${PIDS[@]}" $!) 44 45 # route reflector test 46 python3 $TESTDIR/route_reflector_test.py --gobgp-image $GOBGP_IMAGE --test-prefix rr -s -x --with-xunit --xunit-file=${WS}/nosetest_rr.xml & 47 PIDS=("${PIDS[@]}" $!) 48 49 # zebra test 50 python3 $TESTDIR/bgp_zebra_test.py --gobgp-image $GOBGP_IMAGE --test-prefix zebra -s -x --with-xunit --xunit-file=${WS}/nosetest_zebra.xml & 51 PIDS=("${PIDS[@]}" $!) 52 53 # global policy test 54 python3 $TESTDIR/global_policy_test.py --gobgp-image $GOBGP_IMAGE --test-prefix gpol -s -x --with-xunit --xunit-file=${WS}/nosetest_global_policy.xml & 55 PIDS=("${PIDS[@]}" $!) 56 57 # route server as2 test 58 python3 $TESTDIR/route_server_as2_test.py --gobgp-image $GOBGP_IMAGE --test-prefix as2 -s -x --with-xunit --xunit-file=${WS}/nosetest_rs_as2.xml & 59 PIDS=("${PIDS[@]}" $!) 60 61 # graceful restart test 62 python3 $TESTDIR/graceful_restart_test.py --gobgp-image $GOBGP_IMAGE --test-prefix gr -s -x --with-xunit --xunit-file=${WS}/nosetest_rs_gr.xml & 63 PIDS=("${PIDS[@]}" $!) 64 65 # bgp unnumbered test 66 python3 $TESTDIR/bgp_unnumbered_test.py --gobgp-image $GOBGP_IMAGE --test-prefix un -s -x --with-xunit --xunit-file=${WS}/nosetest_rs_un.xml & 67 PIDS=("${PIDS[@]}" $!) 68 69 for (( i = 0; i < ${#PIDS[@]}; ++i )) 70 do 71 wait ${PIDS[$i]} 72 if [ $? != 0 ]; then 73 exit 1 74 fi 75 done 76 77 PIDS=() 78 79 # route server malformed message test 80 NUM=$(python3 $TESTDIR/route_server_malformed_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}') 81 PARALLEL_NUM=10 82 for (( i = 1; i < $(( $NUM + 1)); ++i )) 83 do 84 python3 $TESTDIR/route_server_malformed_test.py --gobgp-image $GOBGP_IMAGE --test-prefix mal$i --test-index $i -s -x --gobgp-log-level debug --with-xunit --xunit-file=${WS}/nosetest_malform${i}.xml & 85 PIDS=("${PIDS[@]}" $!) 86 sleep 3 87 done 88 89 for (( i = 0; i < ${#PIDS[@]}; ++i )) 90 do 91 wait ${PIDS[$i]} 92 if [ $? != 0 ]; then 93 exit 1 94 fi 95 done 96 97 # route server policy test 98 NUM=$(python3 $TESTDIR/route_server_policy_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}') 99 PARALLEL_NUM=25 100 for (( i = 0; i < $(( NUM / PARALLEL_NUM + 1)); ++i )) 101 do 102 PIDS=() 103 for (( j = $((PARALLEL_NUM * $i + 1)); j < $((PARALLEL_NUM * ($i+1) + 1)); ++j)) 104 do 105 python3 $TESTDIR/route_server_policy_test.py --gobgp-image $GOBGP_IMAGE --test-prefix p$j --test-index $j -s -x --gobgp-log-level debug --with-xunit --xunit-file=${WS}/nosetest_policy${j}.xml & 106 PIDS=("${PIDS[@]}" $!) 107 if [ $j -eq $NUM ]; then 108 break 109 fi 110 sleep 3 111 done 112 113 for (( j = 0; j < ${#PIDS[@]}; ++j )) 114 do 115 wait ${PIDS[$j]} 116 if [ $? != 0 ]; then 117 exit 1 118 fi 119 done 120 121 done 122 123 # route server policy grpc test 124 NUM=$(python3 $TESTDIR/route_server_policy_grpc_test.py --test-index -1 -s 2> /dev/null | awk '/invalid/{print $NF}') 125 PARALLEL_NUM=25 126 for (( i = 0; i < $(( NUM / PARALLEL_NUM + 1)); ++i )) 127 do 128 PIDS=() 129 for (( j = $((PARALLEL_NUM * $i + 1)); j < $((PARALLEL_NUM * ($i+1) + 1)); ++j)) 130 do 131 python3 $TESTDIR/route_server_policy_grpc_test.py --gobgp-image $GOBGP_IMAGE --test-prefix pg$j --test-index $j -s -x --gobgp-log-level debug --with-xunit --xunit-file=${WS}/nosetest_policy_grpc${j}.xml & 132 PIDS=("${PIDS[@]}" $!) 133 if [ $j -eq $NUM ]; then 134 break 135 fi 136 sleep 3 137 done 138 139 for (( j = 0; j < ${#PIDS[@]}; ++j )) 140 do 141 wait ${PIDS[$j]} 142 if [ $? != 0 ]; then 143 exit 1 144 fi 145 done 146 147 done 148 149 echo 'all tests passed successfully' 150 exit 0