forked from youzan/ZanRedisDB
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·35 lines (31 loc) · 908 Bytes
/
test.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
#!/bin/bash
set -e
echo "" > coverage.txt
echo $TEST_RACE
if [ "$TEST_PD" = "true" ]; then
TESTDIRS=`go list ./... | grep -v vendor`
else
TESTDIRS=`go list ./... | grep -v pdserver | grep -v vendor`
fi
echo $TESTDIRS
if [ "$TEST_RACE" = "false" ]; then
GOMAXPROCS=1 go test -timeout 900s $TESTDIRS
else
GOMAXPROCS=4 go test -i -timeout 900s -race $TESTDIRS
for d in $TESTDIRS; do
GOMAXPROCS=4 go test -timeout 900s -race -coverprofile=profile.out -covermode=atomic $d
if [ -f profile.out ]; then
cat profile.out >> coverage.txt
rm profile.out
fi
done
fi
# no tests, but a build is something
for dir in $(find apps tools -maxdepth 1 -type d) ; do
if grep -q '^package main$' $dir/*.go 2>/dev/null; then
echo "building $dir"
go build -o $dir/$(basename $dir) ./$dir
else
echo "(skipped $dir)"
fi
done