commit - 705e365cc30a9ee94c203029b7020c7c55bc74b8
commit + 417c56da5e451e4c04b12d9a17cb2215e13b95aa
blob - 5b5d598956947ffeb1771fbde75a8c7183a12fe5
blob + 184a0cab35d28783c255c1494d78b1695189a105
--- regress/cmdline/clone.sh
+++ regress/cmdline/clone.sh
timeout 20 ./http-server -p $GOT_TEST_HTTP_PORT $testroot \
> $testroot/http-server.log &
- trap "kill %1" HUP INT QUIT PIPE TERM
- while ! grep -q 'ready' $testroot/http-server.log; do
- sleep 1 # server starts up
+ sleep 1 # server starts up
+ for i in 1 2 3 4; do
+ if grep -q ': ready' $testroot/http-server.log; then
+ break
+ fi
+ if [ $i -eq 4 ]; then
+ echo "http-server startup timeout" >&2
+ test_done "$testroot" "1"
+ # timeout(1) will kill the server eventually
+ return 1
+ fi
+ sleep 1 # server is still starting up
done
+ http_pid=`head -n 1 $testroot/http-server.log | cut -d ':' -f1`
+ trap "kill -9 $http_pid; wait $http_pid" HUP INT QUIT PIPE TERM
+
# Test our custom HTTP server with git clone. Should succeed.
git clone -q $testurl/repo $testroot/repo-clone-with-git
ret=$?
return 1
fi
- kill %1
- wait %1 # wait for http-server
+ kill $http_pid
+ wait $http_pid
got log -l0 -p -r $testroot/repo > $testroot/log-repo
ret=$?
blob - 8bdfcdaf1365dd164ba1f07cefa4d99235dbce45
blob + 9bda4d3b425e3cfc1eaf1893388d1c2ad82c2065
--- regress/cmdline/fetch.sh
+++ regress/cmdline/fetch.sh
timeout 20 ./http-server -p $GOT_TEST_HTTP_PORT $testroot \
> $testroot/http-server.log &
- trap "kill %1" HUP INT QUIT PIPE TERM
- while ! grep -q 'ready' $testroot/http-server.log; do
- sleep 1 # server starts up
+ sleep 1 # server starts up
+ for i in 1 2 3 4; do
+ if grep -q ': ready' $testroot/http-server.log; then
+ break
+ fi
+ if [ $i -eq 4 ]; then
+ echo "http-server startup timeout" >&2
+ test_done "$testroot" "1"
+ # timeout(1) will kill the server eventually
+ return 1
+ fi
+ sleep 1 # server is still starting up
done
+ http_pid=`head -n 1 $testroot/http-server.log | cut -d ':' -f1`
+ trap "kill -9 $http_pid; wait $http_pid" HUP INT QUIT PIPE TERM
+
got clone -q $testurl/repo $testroot/repo-clone
ret=$?
if [ $ret -ne 0 ]; then
return 1
fi
- kill %1
- wait %1 # wait for http-server
+ kill $http_pid
+ wait $http_pid
echo -n > $testroot/stdout.expected
blob - f9d3ac17c027bb490d3b70f0ad1a4ab11df5dad4
blob + 4df26ceeeac4eee7baae1c6190fc2ecdd40a5f30
--- regress/cmdline/http-server
+++ regress/cmdline/http-server
}
STDOUT->autoflush(1);
-printf "ready\n";
+printf "$$: ready\n";
while (1) {
my $client = $server->accept();