1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
LUTE: Lua Unit Test Environment
This is a small helper utility to automate some simple tests
that one might need to do.
Think of it as a hybrid of a screen and expect who
also took some habits from HTML inline code.
It is quite probably useless for building anything serious,
but practice shows it is quite efficient at allowing
convenient temporary quick tests, and for something
that was written over a course of a couple of evenings it
is quite a nice little helper tool.
It allows do launch and drive multiple shell sessions,
and by virtue of having been written in Lua, it of course
also allows to add the business logic using the Lua code.
If you launch the lute without parameters, it gives you
the interactive shell to execute the commands in.
If you launch it with an argument, it will attempt to
read and execute the commands from the file.
Commands:
shell FOO
spawn a shell in a new PTY under the label FOO.
run FOO bar
Send "bar" keystrokes followed by "ENTER" to the session FOO
Special case: "break" word on its own gets translated into ^C being sent.
cd FOO
"change domain" into session FOO. All subsequent inputs will go,
line-buffered, into the session FOO. To jump back up, use ^D (Control-D),
or within the file, use ^D^D^D (caret D caret D caret D on its own line)
expect FOO blablabla
Pause further interpretation of the batch mode until you see "blablabla"
in the output of session FOO, or until timeout happens.
sleep N
Sleep an integer N seconds, if you are in batch mode.
echo blabla
Echo the remainder of the line to standard output.
For Lua code, there is a pre-existing pseudo-session called "lua",
which accepts "run lua" command which does what you would expect
(evaluate the rest of the string in Lua context - being the same
as lute itself). Also you can do "cd lua" and get into a
multiline-enabled interpreter shell.
This way for the VPP case you can automate some of the things in your routine
that you would have to have done manually, and test drive API as well
as use the realistic native OS components to create the environment around it.
|