teach script/integration how to clean up

This commit is contained in:
Rick Olson 2015-05-18 17:57:43 -06:00
parent 2310602cc6
commit b4a7bf887e
2 changed files with 18 additions and 15 deletions

@ -2,32 +2,35 @@
. "test/testenv.sh"
SHUTDOWN_LFS=no
SHOW_LOGS=yes
atexit() {
if [ -s "$REMOTEDIR/gitserver.log" ]; then
if [ "$SHOW_LOGS" == "yes" ]; then
if [ -s "$REMOTEDIR/gitserver.log" ]; then
echo ""
echo "gitserver.log:"
cat "$REMOTEDIR/gitserver.log"
fi
echo ""
echo "gitserver.log:"
cat "$REMOTEDIR/gitserver.log"
echo "env:"
env
fi
echo ""
echo "env:"
env
SHUTDOWN_LFS=yes
GITSERVER=$(cat "$LFS_URL_FILE")
shutdown
rm -rf $TRASHDIR
}
trap "atexit" EXIT
if [ -s "$LFS_URL_FILE" ]; then
SHOW_LOGS=no
echo "$LFS_URL_FILE still exists!"
exit 1
fi
setup
echo "run some tests, yo"
test/test-happy-path.sh
SHUTDOWN_LFS=yes

@ -99,7 +99,6 @@ setup() {
go build -o "$BINPATH/$(basename $go .go)" "$go"
done
echo "PATH=$BINPATH:\$PATH"
echo "LFSTEST_URL=$LFS_URL_FILE LFSTEST_DIR=$REMOTEDIR lfstest-gitserver"
LFSTEST_URL="$LFS_URL_FILE" LFSTEST_DIR="$REMOTEDIR" lfstest-gitserver > "$REMOTEDIR/gitserver.log" 2>&1 &
wait_for_file "$LFS_URL_FILE"
@ -112,6 +111,7 @@ shutdown() {
exit 0
fi
curl "$GITSERVER/shutdown"
rm -rf "$LFS_URL_FILE"
if [ -s "$LFS_URL_FILE" ]; then
curl "$(cat "$LFS_URL_FILE")/shutdown"
fi
}