fix #6 test build error

This commit is contained in:
Josh Baker 2016-03-07 06:44:38 -07:00
parent dced9f08f5
commit f97dc30c65
3 changed files with 12 additions and 20 deletions

View File

@ -4,7 +4,7 @@ clean:
rm -f tile38-server
rm -f tile38-cli
test:
@./test.sh
@./build.sh test
install: all
cp tile38-server /usr/local/bin
cp tile38-cli /usr/local/bin

View File

@ -21,6 +21,7 @@ WD="$TMP/src/github.com/tidwall/tile38"
GOPATH="$TMP"
for file in `find . -type f`; do
# TODO: use .gitignore to ignore, or possibly just use git to determine the file list.
if [[ "$file" != "." && "$file" != ./.git* && "$file" != ./data* && "$file" != ./tile38-* ]]; then
mkdir -p "$WD/$(dirname "${file}")"
cp -P "$file" "$WD/$(dirname "${file}")"
@ -32,5 +33,14 @@ cd $WD
go build -ldflags "$LDFLAGS" -o "$OD/tile38-server" cmd/tile38-server/*.go
go build -ldflags "$LDFLAGS" -o "$OD/tile38-cli" cmd/tile38-cli/*.go
# test if requested
if [ "$1" == "test" ]; then
$OD/tile38-server -p 9876 -d "$TMP" -q &
PID=$!
function testend {
kill $PID &
}
trap testend EXIT
go test $(go list ./... | grep -v /vendor/)
fi

18
test.sh
View File

@ -1,18 +0,0 @@
#!/bin/bash
set -e
cd $(dirname "${BASH_SOURCE[0]}")
WD=$(pwd)
./build.sh
TMP="$(mktemp -d -t data-test.XXXX)"
./tile38-server -p 9876 -d "$TMP" -q &
PID=$!
function end {
rm -rf "$TMP"
kill $PID &
}
trap end EXIT
go test $(go list ./... | grep -v /vendor/)