[master] 9537895 Trust it to linux to break even tr(1).

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 17 17:04:11 UTC 2018


commit 9537895517cdd6c8e6145ab5920d9bcb8cf7bc02
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 17 16:46:10 2018 +0000

    Trust it to linux to break even tr(1).
    
    Supress terminal responses by default and hope they look right.

diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index 842a5c0..9316a5c 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -121,25 +121,16 @@ process p4 -write "\x1b[8G\x1b[2X>"
 process p4 -expect-text 10 8 ">"
 process p4 -screen-dump
 
-# Safely test responses
-process p5 -hexdump "stty raw -echo; echo '*' ; tr '\x02\x1b' '\x1b@'" -start
-process p5 -expect-text 0 0 "*" 
-process p5 -write "\x02[3;1HA\x02[5n"
-process p5 -expect-text 3 0 "n"
-process p5 -write "\x02[4;1HB\x02[6n"
-process p5 -expect-text 4 0 "R"
-process p5 -write "\x02[5;1HC\x02[15n"
-process p5 -expect-text 5 0 "n"
-process p5 -write "\x02[6;1HD\x02[25n"
-process p5 -expect-text 6 0 "n"
-process p5 -write "\x02[7;1HE\x02[26n"
-process p5 -expect-text 7 0 "n"
-process p5 -write "\x02[8;1HF\x02[?26n"
-process p5 -expect-text 8 0 "n"
-process p5 -write "\x02[9;1HG\x02Pfutfutfut\x01"
-process p5 -write "\x02[10;1HH\x02]futfutfut\x01"
-process p5 -write "\x02[11;1HI\x02[>c"
-process p5 -expect-text 11 0 "c"
-process p5 -write "\x02[24;1HW"
-process p5 -expect-text 0 0 "W"
-process p5 -screen-dump
+# Test responses
+process p4 -write "\x1b[3;1HA\x1b[5n"
+process p4 -write "\x1b[4;1HB\x1b[6n"
+process p4 -write "\x1b[5;1HC\x1b[15n"
+process p4 -write "\x1b[6;1HD\x1b[25n"
+process p4 -write "\x1b[7;1HE\x1b[26n"
+process p4 -write "\x1b[8;1HF\x1b[?26n"
+process p4 -write "\x1b[9;1HG\x1bPfutfutfut\x01"
+process p4 -write "\x1b[10;1HH\x1b]futfutfut\x01"
+process p4 -write "\x1b[11;1HI\x1b[>c"
+process p4 -write "\x1b[24;1HW"
+process p4 -expect-text 24 1 "W"
+process p4 -screen-dump
diff --git a/bin/varnishtest/tests/a00001.vtc b/bin/varnishtest/tests/a00001.vtc
index dfca677..b6628d8 100644
--- a/bin/varnishtest/tests/a00001.vtc
+++ b/bin/varnishtest/tests/a00001.vtc
@@ -2,7 +2,7 @@ varnishtest "Test Teken terminal emulator"
 
 feature cmd "vttest --version 2>&1 | grep -q Usage"
 
-process p4 {vttest} -start
+process p4 {vttest} -ansi-response -start
 
 process p4 -expect-text 21 11 "Enter choice number (0 - 12):"
 process p4 -screen_dump
diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index c182ed3..7ab093b 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -88,6 +88,7 @@ struct process {
 
 	int			nlin;
 	int			ncol;
+	int			ansi_response;
 	char			**vram;
 	teken_t			tek[1];
 };
@@ -174,10 +175,12 @@ term_respond(void *priv, const void *p, size_t l)
 	CAST_OBJ_NOTNULL(pp, priv, PROCESS_MAGIC);
 
 	vtc_dump(pp->vl, 4, "term_response", p, l);
-	r = write(pp->fd_term, p, l);
-	if (r != l)
-		vtc_fatal(pp->vl, "Could not write to process: %s",
-		    strerror(errno));
+	if (pp->ansi_response) {
+		r = write(pp->fd_term, p, l);
+		if (r != l)
+			vtc_fatal(pp->vl, "Could not write to process: %s",
+			    strerror(errno));
+	}
 }
 
 static void
@@ -1010,6 +1013,10 @@ cmd_process(CMD_ARGS)
 			process_wait(p);
 			continue;
 		}
+		if (!strcmp(*av, "-ansi-response")) {
+			p->ansi_response = 1;
+			continue;
+		}
 		if (!strcmp(*av, "-expect-text")) {
 			AN(av[1]);
 			AN(av[2]);


More information about the varnish-commit mailing list