[master] ca4573d1a Experimental patch to send function-keys to vtc processes.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Oct 31 15:01:13 UTC 2022
commit ca4573d1a6cc6fc3286e7d31208174204226da41
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Oct 31 14:59:53 2022 +0000
Experimental patch to send function-keys to vtc processes.
(May not work due to termcap/terminfo differences)
diff --git a/bin/varnishtest/tests/u00008.vtc b/bin/varnishtest/tests/u00008.vtc
index 5e6e827ad..59eafd517 100644
--- a/bin/varnishtest/tests/u00008.vtc
+++ b/bin/varnishtest/tests/u00008.vtc
@@ -11,9 +11,9 @@ varnish v1 -vcl+backend {
}
} -start
-process p1 -dump {varnishstat -n ${v1_name}} -start
-process p2 -dump {varnishstat -n ${v1_name}} -start
-process p3 -dump {varnishstat -n ${v1_name}} -start
+process p1 {varnishstat -n ${v1_name}} -start
+process p2 {varnishstat -n ${v1_name}} -start
+process p3 {varnishstat -n ${v1_name}} -start
process p1 -expect-text 0 0 "VBE.vcl1.s1.happy"
process p1 -screen_dump
@@ -66,6 +66,24 @@ process p1 -winsz 25 132
process p1 -expect-text 4 124 "AVG_1000"
process p1 -expect-text 22 108 "UNSEEN DIAG"
+process p1 -key NPAGE
+process p1 -expect-text 0 0 "VBE.vcl1.s1.helddown"
+process p1 -screen_dump
+
+process p1 -key PPAGE
+process p1 -expect-text 0 0 "VBE.vcl1.s1.happy"
+process p1 -screen_dump
+
+process p1 -key END
+process p1 -expect-text 22 1 " "
+process p1 -expect-text 4 1 "^^^"
+process p1 -screen_dump
+
+process p1 -key HOME
+process p1 -expect-text 22 1 "vvv"
+process p1 -expect-text 4 1 " "
+process p1 -screen_dump
+
process p1 -screen_dump -write {q} -wait
process p2 -screen_dump -kill TERM -wait
process p3 -screen_dump -kill HUP -wait
diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c
index b24404c89..07e9ae4b1 100644
--- a/bin/varnishtest/vtc_process.c
+++ b/bin/varnishtest/vtc_process.c
@@ -964,6 +964,11 @@ process_close(struct process *p)
* expression from either output, consider using it if you only need
* to match one.
*
+ * \-key KEYSYM
+ * Send emulated key-press.
+ * KEYSYM can be one of (NPAGE, PPAGE, HOME, END)
+ *
+ *
* \-kill SIGNAL
* Send a signal to the process. The argument can be either
* the string "TERM", "INT", or "KILL" for SIGTERM, SIGINT or SIGKILL
@@ -1100,6 +1105,19 @@ cmd_process(CMD_ARGS)
p->log = 3;
continue;
}
+ if (!strcmp(*av, "-key")) {
+ if (!strcmp(av[1], "NPAGE"))
+ process_write(p, "\x1b\x5b\x36\x7e");
+ else if (!strcmp(av[1], "PPAGE"))
+ process_write(p, "\x1b\x5b\x35\x7e");
+ else if (!strcmp(av[1], "HOME"))
+ process_write(p, "\x1b\x4f\x48");
+ else if (!strcmp(av[1], "END"))
+ process_write(p, "\x1b\x4f\x46");
+ else
+ vtc_fatal(p->vl, "Unknown key %s", av[1]);
+ continue;
+ }
if (!strcmp(*av, "-kill")) {
process_kill(p, av[1]);
av++;
More information about the varnish-commit
mailing list