Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
1d2d8464
Commit
1d2d8464
authored
Apr 11, 2018
by
Poul-Henning Kamp
Committed by
Dridi Boukelmoune
Jun 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Report cursor position in screen-dump, and add "-expect-cursor"
parent
d48317b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
5 deletions
+38
-5
a00000.vtc
bin/varnishtest/tests/a00000.vtc
+8
-4
vtc_process.c
bin/varnishtest/vtc_process.c
+30
-1
No files found.
bin/varnishtest/tests/a00000.vtc
View file @
1d2d8464
...
...
@@ -55,10 +55,14 @@ process p4 -write "\x1b[H\x1b[2J1\x1b[79C2\x08>\x1b[25;1H3\x1b[25;80H"
process p4 -write "4\x08>\x1b[A\x1b[Cv\x1b[22A^\x1b[79D^\x1b[;2H<\n\n\n\n"
process p4 -write "\n\n\n\n\n\n\n\n\x1b[B\x1b[11B\x08<\x1b[24;Hv\x1b[12;1H"
process p4 -write "111111112222222333333\x0d\x0a111111112"
process p4 -write "222222333333\x0d\x0a111111112222222333"
process p4 -write "333\x0d\x0a111111112222222333333\x0d\x0a\x1b[12"
process p4 -write "222222333333\x0d\x0a111111112222222333333 UTF8: "
process p4 -writehex {c2 a2 20 e2 82 ac 20 f0 9f 90 b0}
process p4 -write "\x0d\x0a111111112222222333333\x0d\x0a\x1b[12"
process p4 -write ";12H\x1b[K\x1b[13;12H\x1b[0K\x1b[14;12H\x1b[1K\x1b"
process p4 -write "[15;12H\x1b[2K\x1b[3;1Hline3 <\x0d\x0a"
process p4 -need-bytes 252 -expect-text 3 1 "line3 <"
process p4 -screen_dump -stop
process p4 -need-bytes 270 -expect-text 3 1 "line3 <"
process p4 -expect-cursor 4 1
process p4 -expect-cursor 4 0
process p4 -expect-cursor 0 1
process p4 -screen-dump -stop
bin/varnishtest/vtc_process.c
View file @
1d2d8464
...
...
@@ -205,9 +205,13 @@ static void
term_screen_dump
(
const
struct
process
*
pp
)
{
int
i
;
const
teken_pos_t
*
pos
;
for
(
i
=
0
;
i
<
pp
->
nlin
;
i
++
)
vtc_dump
(
pp
->
vl
,
3
,
"screen"
,
pp
->
vram
[
i
],
pp
->
ncol
);
pos
=
teken_get_cursor
(
pp
->
tek
);
vtc_log
(
pp
->
vl
,
3
,
"Cursor at line %d column %d"
,
pos
->
tp_row
+
1
,
pos
->
tp_col
+
1
);
}
static
void
...
...
@@ -312,6 +316,23 @@ term_expect_text(struct process *pp,
vtc_log
(
pp
->
vl
,
4
,
"found expected text at %d,%d: '%s'"
,
y
,
x
,
pat
);
}
static
void
term_expect_cursor
(
struct
process
*
pp
,
const
char
*
lin
,
const
char
*
col
)
{
int
x
,
y
;
const
teken_pos_t
*
pos
;
pos
=
teken_get_cursor
(
pp
->
tek
);
y
=
strtoul
(
lin
,
NULL
,
0
);
x
=
strtoul
(
col
,
NULL
,
0
);
if
(
y
!=
0
&&
(
y
-
1
)
!=
pos
->
tp_row
)
vtc_fatal
(
pp
->
vl
,
"Cursor on line %d (expected %d)"
,
pos
->
tp_row
+
1
,
y
);
if
(
x
!=
0
&&
(
x
-
1
)
!=
pos
->
tp_col
)
vtc_fatal
(
pp
->
vl
,
"Cursor in column %d (expected %d)"
,
pos
->
tp_col
+
1
,
y
);
}
/**********************************************************************
* Allocate and initialize a process
*/
...
...
@@ -968,7 +989,15 @@ cmd_process(CMD_ARGS)
av
+=
3
;
continue
;
}
if
(
!
strcmp
(
*
av
,
"-screen_dump"
))
{
if
(
!
strcmp
(
*
av
,
"-expect-cursor"
))
{
AN
(
av
[
1
]);
AN
(
av
[
2
]);
term_expect_cursor
(
p
,
av
[
1
],
av
[
2
]);
av
+=
2
;
continue
;
}
if
(
!
strcmp
(
*
av
,
"-screen_dump"
)
||
!
strcmp
(
*
av
,
"-screen-dump"
))
{
term_screen_dump
(
p
);
continue
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment