github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/test/run_tests.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  cd "$(dirname "$BASH_SOURCE")/.."
     4  
     5  set -f -u -e
     6  
     7  options=$(getopt c $*)
     8  if [ $? -ne 0 ]; then
     9      echo "Incorrect options provided"
    10      exit 1
    11  fi
    12  
    13  for i
    14  do
    15      case "$1" in
    16      -c)
    17          FLAGS=-c
    18          ;;
    19      esac
    20      shift
    21  done
    22  
    23  (cd citogo && go install)
    24  
    25  # Log the Go version.
    26  echo "Running tests on commit $(git rev-parse --short HEAD) with $(go version)."
    27  
    28  DIRS=$(go list ./... | sed -e 's/^github.com\/keybase\/client\/go\///')
    29  
    30  export KEYBASE_LOG_SETUPTEST_FUNCS=1
    31  
    32  # Add libraries used in testing
    33  go get "github.com/stretchr/testify/require"
    34  go get "github.com/stretchr/testify/assert"
    35  
    36  failures=()
    37  
    38  branch=$(git rev-parse --abbrev-ref HEAD)
    39  build_id=$(perl -e '{ print time }')
    40  
    41  for i in $DIRS; do
    42    echo -n "$i......."
    43    if ! (cd $i && citogo --flakes 4 --fails 5 --branch $branch --build-id $build_id --prefix $i --timeout 150s) ; then
    44      failures+=("$i")
    45    fi
    46  done
    47  
    48  echo
    49  if [ "${#failures[@]}" -ne 0 ] ; then
    50    echo FAILURES:
    51    for failure in "${failures[@]}" ; do
    52      echo "  $failure"
    53    done
    54    exit 1
    55  else
    56    echo SUCCESS
    57    exit 0
    58  fi