github.com/prebid/prebid-server/v2@v2.18.0/validate.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 RACE=0 6 AUTOFMT=true 7 COVERAGE=false 8 VET=true 9 10 while true; do 11 case "$1" in 12 --nofmt ) AUTOFMT=false; shift ;; 13 --race ) RACE=$2; shift; shift; ;; 14 --cov ) COVERAGE=true; shift ;; 15 --novet ) VET=false; shift ;; 16 * ) break ;; 17 esac 18 done 19 20 ./scripts/format.sh -f $AUTOFMT 21 22 # Run the actual tests. Make sure there's enough coverage too, if the flags call for it. 23 if $COVERAGE; then 24 ./scripts/check_coverage.sh 25 else 26 go test -timeout 120s $(go list ./... | grep -v /vendor/) 27 fi 28 29 # Then run the race condition tests. These only run on tests named TestRace.* for two reasons. 30 # 31 # 1. To speed things up (for large -count values) 32 # 2. Because some tests open up files on the filesystem, and some operating systems limit the number of open files for a single process. 33 if [ "$RACE" -ne "0" ]; then 34 go test -race $(go list ./... | grep -v /vendor/) -run ^TestRace.*$ -count $RACE 35 fi 36 37 if $VET; then 38 echo "Running go vet check" 39 go vet ./... 40 fi