[PATCH] test: accept death by SIGPIPE as a valid failure mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a local host, the object/history transport code often talks over
pipe with the other side.  The other side may notice some (expected)
failure, send the error message either to our process or to the
standard error and hung up.  In such codepaths, if timing were not
unfortunate, our side would receive the report of (expected) failure
from the other side over the pipe and die().  Otherwise, our side
may still be trying to talk to it and would die with a SIGPIPE.

This was observed as an intermittent breakage in t5516 by a few
people.

In the real-life scenario, either mode of death exits with a
non-zero status, and the user would learn that the command failed.
The test_must_fail helper should also know that dying with SIGPIPE
is one of the valid failure modes when we are expecting the tested
operation to notice problem and fail.

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---

 * This time with a real commit log message.  As the goal is to
   treat death-by-sigpipe just like a call to die(), this version
   silently lets the test pass instead of giving a message to the
   standard error stream.

 t/test-lib-functions.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 8f8858a..4f40ffe 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -556,6 +556,9 @@ test_must_fail () {
 	if test $exit_code = 0; then
 		echo >&2 "test_must_fail: command succeeded: $*"
 		return 1
+	elif test $exit_code -eq 141; then
+		# died with sigpipe
+		return 0
 	elif test $exit_code -gt 129 && test $exit_code -le 192; then
 		echo >&2 "test_must_fail: died by signal: $*"
 		return 1
-- 
2.6.2-456-gc12a6fe

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]