Merge pull request #377 from skl131313/travis-dub

Refactor travis config to include dub build and ldc.
Update dub config for new dsymbol version.
Add check to ensure server running after test is executed.
This commit is contained in:
skl131313 2017-05-15 12:03:10 -04:00 committed by GitHub
commit 0ebef7bb3b
4 changed files with 72 additions and 22 deletions

21
.travis.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
set -e
if [[ $BUILD == dub ]]; then
mkdir bin
dub build --build=release --config=client
dub build --build=release --config=server
mv dcd-client ./bin
mv dcd-server ./bin
elif [[ $DC == ldc2 ]]; then
git submodule update --init --recursive
make ldc -j2
else
git submodule update --init --recursive
make debug -j2
fi
cd tests && ./run_tests.sh

View File

@ -1,6 +1,17 @@
sudo: false
language: d
script:
- git submodule update --init --recursive
- make debug -j2
- cd tests && ./run_tests.sh
d:
- dmd-beta
- dmd
- ldc
os:
- linux
# TODO, some bug in OSX for the server that causes it to fail
# - osx
env:
- BUILD=
- BUILD=dub
script: ./.travis.sh

View File

@ -7,7 +7,7 @@
],
"license": "GPL-3.0",
"dependencies": {
"dsymbol": "~>0.2.0",
"dsymbol": "~>0.2.1-alpha.2",
"libdparse": "~>0.7.1-beta.1",
"msgpack-d": "~>1.0.0-beta.3"
},

View File

@ -8,6 +8,17 @@ IMPORTS=$(pwd)/imports
fail_count=0
pass_count=0
function startServer()
{
if [[ $socket == "unix" ]]; then
../bin/dcd-server --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt &
else
../bin/dcd-server --tcp --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt &
fi
server_pid=$!
sleep 1s;
}
# Make sure that the server is shut down
echo "Shutting down currently-running server..."
../bin/dcd-client --shutdown 2>/dev/null > /dev/null
@ -19,12 +30,7 @@ for socket in unix tcp; do
# Start up the server
echo "Starting server..."
if [[ $socket == "unix" ]]; then
../bin/dcd-server --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt &
else
../bin/dcd-server --tcp --ignoreConfig -I $IMPORTS 2>stderr.txt > stdout.txt &
fi
sleep 1s;
startServer
# Run tests
for testCase in tc*; do
@ -44,6 +50,17 @@ for socket in unix tcp; do
fi
cd - > /dev/null;
if ! kill -0 $server_pid > /dev/null 2>&1; then
echo "Server no longer running."
echo -e "${RED}STDERR:${NORMAL}"
cat stderr.txt
echo -e "${RED}STDOUT:${NORMAL}"
cat stdout.txt
echo "Restarting server..."
startServer
fi
done
# Shut down
@ -53,16 +70,17 @@ for socket in unix tcp; do
else
../bin/dcd-client --shutdown --tcp 2>/dev/null > /dev/null
fi
# Report
if [[ $fail_count -eq 0 ]]; then
echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
else
echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
echo -e "${RED}STDERR:${NORMAL}"
cat stderr.txt
echo -e "${RED}STDOUT:${NORMAL}"
cat stdout.txt
exit 1
fi
done
# Report
if [[ $fail_count -eq 0 ]]; then
echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
else
echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
echo -e "${RED}STDERR:${NORMAL}"
cat stderr.txt
echo -e "${RED}STDOUT:${NORMAL}"
cat stdout.txt
exit 1
fi