-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathtest
More file actions
executable file
·29 lines (24 loc) · 881 Bytes
/
test
File metadata and controls
executable file
·29 lines (24 loc) · 881 Bytes
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
#!/usr/bin/env bash
# Copyright 2018 Yunify Inc. All rights reserved.
# Use of this source code is governed by a Apache license
# that can be found in the LICENSE file.
source ./env
IGNORE_PKGS="(vendor)"
TEST_PKGS=`find . -name \*_test.go | while read a; do dirname $a; done | sort | uniq | egrep -v "$IGNORE_PKGS" | sed "s|\./||g"`
INTEGRATION_PKGS="(integration|contrib)"
COVER=${COVER:-"-cover"}
TESTABLE=`echo "$TEST_PKGS" | egrep -v "$INTEGRATION_PKGS"`
if [ -z "$PKG" ]; then
TEST=$TESTABLE
else
# strip out leading dotslashes and trailing slashes from PKG=./foo/
TEST=${PKG/#./}
TEST=${TEST/#\//}
TEST=${TEST/%\//}
fi
# split TEST into an array and prepend REPO_PATH to each local package
split=(${TEST// / })
TEST=${split[@]/#/${REPO_PATH}/}
echo "Running tests... ${TEST}"
#--race -cpu 1,2,4
go test --race --cpu 1,2,4 -timeout 5m ${COVER} -run=Test $@ ${TEST}