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