This repository has been archived by the owner on Nov 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathc
executable file
·60 lines (55 loc) · 1.41 KB
/
c
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
set -e
echo fmt
go fmt ./...
echo vet
go vet ./...
if ! which golint >/dev/null; then
PATH=$GOPATH/bin:$PATH
if ! which golint >/dev/null; then
echo 'No golint installed: to install, run'
echo 'go get github.com/golang/lint/golint'
exit $?
fi
fi
set +e
echo lint
golint ./godrv | grep -v 'LastInsertID'
golint ./oracle
set -e
. $(dirname $0)/env
echo build
go build ./...
#if [ $# -ge 1 ]; then exit $?; fi
#go build -tags trace ./...
echo test
TOPTS="${TOPTS} -test.v"
if [ -n "$TRACE" ]; then
TOPTS="$TOPTS -tags trace"
fi
rm -rf /tmp/go-build[0-9]*
go test $TOPTS -work -c -tags trace ./oracle || {
echo "CFLAGS=$CGO_CFLAGS LDFLAGS=$CGO_LDFLAGS"
exit $?
}
ln -sf /tmp/go-build[0-9]* /tmp/go-build-goracle
if [ -e /etc/init.d/oracle-xe ]; then
if systemctl is-active oracle-xe.service; then
echo 'oracle-xe is running'
else
sudo systemctl start oracle-xe.service
while true; do
if systemctl is-active oracle-xe.service; then
break
fi
echo "waiting for Oracle"
sleep 1
done
fi
fi
dsn=${DSN:-$(cat $(dirname $0)/.dsn)}
go test -i ./godrv/
go test ./godrv/ -dsn="${dsn}" "$@"
echo -----------------------------------------------------------------------
echo "./oracle.test -dsn=\$\(cat $(dirname $0)/.dsn\) ""$@"
RECONNECTS=${RECONNECTS:-3} ./oracle.test -dsn="$dsn" "$@"