Commit Diff


commit - f6f8289012aca18a8636d0d313bd4b3fc813e508c6d6110d5d6d972bcda27b34
commit + 9778d2876fc9a317915e6414586744e726ef5622e196389ede565f81383a036e
blob - 8d130358a071c18b21379c798bc43657d3ec5ced19d196a7dfb4b9c216b62ebf
blob + 74d24f12e750bb8ea0cf0e6f52b95c3e2485d10776482bc5bae849ee1fc53a2a
--- 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 - 444370a2a0851cb8d83fb854d8d869064c16bf8bec8455e087f01140d24d812e
blob + 0018862da4eae0ac26fae39ee326c8f08450f26e2fde0e7747332a096935a4be
--- 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 - bfc0d7981e3f8cafc18fb3c90f86e071388bbe1c64974188fa7af65cbb429a0a
blob + fc4c81e0147e0fff0f65e1fa843f50419ca0711bf5c77d21b00a6594bf033ce6
--- 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();