Commit ad9aab0b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

Trust it to linux to break even tr(1).

Supress terminal responses by default and hope they look right.
parent 2f7cbaa6
......@@ -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
......@@ -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
......
......@@ -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]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment