Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Sep 2017 06:24:21 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r323348 - head/usr.bin/tail/tests
Message-ID:  <201709090624.v896OLjN059876@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Sat Sep  9 06:24:21 2017
New Revision: 323348
URL: https://svnweb.freebsd.org/changeset/base/323348

Log:
  Unbreak :broken_pipe
  
  - Capture exit code in pipeline and test in output.
  - Drop awk use in favor of `sleep 2`. This helps guarantee the EPIPE
    behavior without the potential race.

Modified:
  head/usr.bin/tail/tests/tail_test.sh

Modified: head/usr.bin/tail/tests/tail_test.sh
==============================================================================
--- head/usr.bin/tail/tests/tail_test.sh	Sat Sep  9 06:04:05 2017	(r323347)
+++ head/usr.bin/tail/tests/tail_test.sh	Sat Sep  9 06:24:21 2017	(r323348)
@@ -222,10 +222,10 @@ broken_pipe_head()
 }
 broken_pipe_body()
 {
-	atf_expect_fail "Can't seem to get testcase to work in test environment.  Reproduces easily in interactive shell."
-
 	atf_check -o save:ints seq -f '%128g' 1 1000
-	atf_check -s exit:1 -o ignore -e "inline:tail: stdout" tail -n 856 ints | awk '{ exit }'
+	atf_check -s ignore \
+	    -e "inline:tail: stdout\nexit code: 1\n" \
+	    -x '(tail -n 856 ints; echo exit code: $? >&2) | sleep 2'
 }
 
 
@@ -243,5 +243,5 @@ atf_init_test_cases()
 	atf_add_test_case longfile_rc135782
 	atf_add_test_case longfile_rc145782_longlines
 	atf_add_test_case longfile_rn2500
-	#atf_add_test_case broken_pipe
+	atf_add_test_case broken_pipe
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709090624.v896OLjN059876>