#!/bin/sh
echo TEST: test/basicserver
kill_process()
{
	test -r testfiles/$1.pid \
	&& kill -0 `cat testfiles/$1.pid` \
	&& kill    `cat testfiles/$1.pid`
}
kill_daemons()
{
	kill_process bbackupd
	kill_process bbstored
	kill_process httpserver
	kill_process s3simulator
}

echo Killing any running daemons...
kill_daemons
echo Removing old test files...
chmod -R a+rwx testfiles
rm -rf testfiles

echo Copying new test files...
cp -p -R ../../../test/basicserver/testfiles .

GLIBCXX_FORCE_NEW=1 gdb ./test "$@"
kill_daemons
