Commit Diff


commit - aca784d0f69d9c2ee7923c96181b6c5cc2d76355
commit + d3901b506e85fd7b4dbdcbcd3f187a61346079a8
blob - 5b5d598956947ffeb1771fbde75a8c7183a12fe5
blob + 184a0cab35d28783c255c1494d78b1695189a105
--- regress/cmdline/clone.sh
+++ regress/cmdline/clone.sh
@@ -869,12 +869,24 @@ test_clone_basic_http() {
 
 	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=$?
@@ -893,8 +905,8 @@ test_clone_basic_http() {
 		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
@@ -2027,12 +2027,24 @@ test_fetch_basic_http() {
 
 	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
@@ -2062,8 +2074,8 @@ test_fetch_basic_http() {
 		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
@@ -154,7 +154,7 @@ sub handle_post {
 }
 
 STDOUT->autoflush(1);
-printf "ready\n";
+printf "$$: ready\n";
 
 while (1) {
 	my $client = $server->accept();