mirror of https://github.com/tidwall/tile38.git
fix #6 test build error
This commit is contained in:
parent
dced9f08f5
commit
f97dc30c65
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ clean:
|
||||||
rm -f tile38-server
|
rm -f tile38-server
|
||||||
rm -f tile38-cli
|
rm -f tile38-cli
|
||||||
test:
|
test:
|
||||||
@./test.sh
|
@./build.sh test
|
||||||
install: all
|
install: all
|
||||||
cp tile38-server /usr/local/bin
|
cp tile38-server /usr/local/bin
|
||||||
cp tile38-cli /usr/local/bin
|
cp tile38-cli /usr/local/bin
|
||||||
|
|
12
build.sh
12
build.sh
|
@ -21,6 +21,7 @@ WD="$TMP/src/github.com/tidwall/tile38"
|
||||||
GOPATH="$TMP"
|
GOPATH="$TMP"
|
||||||
|
|
||||||
for file in `find . -type f`; do
|
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
|
if [[ "$file" != "." && "$file" != ./.git* && "$file" != ./data* && "$file" != ./tile38-* ]]; then
|
||||||
mkdir -p "$WD/$(dirname "${file}")"
|
mkdir -p "$WD/$(dirname "${file}")"
|
||||||
cp -P "$file" "$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-server" cmd/tile38-server/*.go
|
||||||
go build -ldflags "$LDFLAGS" -o "$OD/tile38-cli" cmd/tile38-cli/*.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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue