[PATCH 3/3] t/lib-terminal: test test-terminal's sanity

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

 



The previous two commits show that getting test-terminal.perl right is
not trivial.  Let lib-terminal.sh run a simple test that ensures it
actually opens TTYs for std{in,out,err} and that it does not let stdin
pass through.

Signed-off-by: Thomas Rast <trast@xxxxxxxxxxxxxxx>
---
 t/lib-terminal.sh |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/t/lib-terminal.sh b/t/lib-terminal.sh
index 58d911d..9e4ff9c 100644
--- a/t/lib-terminal.sh
+++ b/t/lib-terminal.sh
@@ -33,3 +33,22 @@ test_expect_success PERL 'set up terminal for tests' '
 		}
 	fi
 '
+
+cat >expect1 <<EOF
+stdin: 1
+stdout: 1
+stderr: 1
+EOF
+: >expect2
+
+test_expect_success TTY 'test-terminal.perl is sane' '
+	test_terminal perl -e "
+		use POSIX qw(isatty);
+		print \"stdin: \", isatty(STDIN), \"\\n\";
+		print \"stdout: \", isatty(STDOUT), \"\\n\";
+		print \"stderr: \", isatty(STDERR), \"\\n\";
+	" >actual1 &&
+	test_cmp expect1 actual1 &&
+	echo foo | test_terminal cat - >actual2 &&
+	test_cmp expect2 actual2
+'
-- 
1.7.8.431.g2abf2

--
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]