github.com/osrg/gobgp@v2.0.0+incompatible/test/scenario_test/run_all_tests.sh (about)

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