Add check to ensure server running after test is executed.

This commit is contained in:
skl131313 2017-05-13 20:28:34 -04:00
parent 18c57df44a
commit 4498c212dd
1 changed files with 35 additions and 17 deletions

View File

@ -8,6 +8,17 @@ IMPORTS=$(pwd)/imports
fail_count=0 fail_count=0
pass_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 # Make sure that the server is shut down
echo "Shutting down currently-running server..." echo "Shutting down currently-running server..."
../bin/dcd-client --shutdown 2>/dev/null > /dev/null ../bin/dcd-client --shutdown 2>/dev/null > /dev/null
@ -19,12 +30,7 @@ for socket in unix tcp; do
# Start up the server # Start up the server
echo "Starting server..." echo "Starting server..."
if [[ $socket == "unix" ]]; then startServer
../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;
# Run tests # Run tests
for testCase in tc*; do for testCase in tc*; do
@ -44,6 +50,17 @@ for socket in unix tcp; do
fi fi
cd - > /dev/null; 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 done
# Shut down # Shut down
@ -53,7 +70,6 @@ for socket in unix tcp; do
else else
../bin/dcd-client --shutdown --tcp 2>/dev/null > /dev/null ../bin/dcd-client --shutdown --tcp 2>/dev/null > /dev/null
fi fi
done
# Report # Report
if [[ $fail_count -eq 0 ]]; then if [[ $fail_count -eq 0 ]]; then
@ -66,3 +82,5 @@ else
cat stdout.txt cat stdout.txt
exit 1 exit 1
fi fi
done