github.com/koko1123/flow-go-1@v0.29.6/tools/test_monitor/run-tests.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  # This script runs the tests in the category specified by the TEST_CATEGORY environment variable.
     4  # Echo / logging statements send output to standard error to separate that output from test result output
     5  # (which sends output to standard output) which needs to be parsed.
     6  
     7  set -e
     8  shopt -s extglob
     9  
    10  echo "test category (run-tests):" $TEST_CATEGORY>&2
    11  
    12  # run tests and process results
    13  
    14  if [[ $TEST_CATEGORY =~ integration-(bft|ghost|mvp|network|epochs|access|collection|consensus|execution|verification)$ ]]
    15  then
    16    echo "killing and removing orphaned containers from previous run">&2
    17      # kill and remove orphaned containers from previous run
    18      containers=$(docker ps -a -q)
    19  
    20      if [ ! -z "$containers" ]
    21      then
    22          docker rm -f $containers > /dev/null
    23      fi
    24  
    25    echo "preparing $TEST_CATEGORY tests">&2
    26    make crypto_setup_gopath
    27    make docker-build-flow docker-build-flow-corrupt
    28    echo "running $TEST_CATEGORY tests">&2
    29    make -C integration -s ${BASH_REMATCH[1]}-tests > test-output
    30  else
    31      case $TEST_CATEGORY in
    32          unit)
    33            echo "preparing unit tests">&2
    34            make install-tools
    35            make verify-mocks
    36            echo "running unit tests">&2
    37            make -s unittest-main > test-output
    38          ;;
    39          unit-crypto)
    40            echo "preparing crypto unit tests">&2
    41            make -C crypto setup
    42            echo "running crypto unit tests">&2
    43            make -C crypto -s unittest > test-output
    44          ;;
    45          unit-insecure)
    46            echo "preparing insecure unit tests">&2
    47            make install-tools
    48            echo "running insecure unit tests">&2
    49            make -C insecure -s test > test-output
    50          ;;
    51          unit-integration)
    52            echo "preparing integration unit tests">&2
    53            make install-tools
    54            echo "running integration unit tests">&2
    55            make -C integration -s test > test-output
    56          ;;
    57          *)
    58            echo "unrecognized test category (run-tests):" $TEST_CATEGORY>&2
    59            exit 1
    60          ;;
    61      esac
    62  fi
    63