-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
127 lines (88 loc) · 4.35 KB
/
README
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
expect-Lite
Automation for the rest of us
Installation and Quick Start Guide
------------------------------------------------------------------------
Quick Install
-------------
Un-tar the expect-lite tar ball, and run the included install.sh Test by
typing at the prompt:
expect-lite
If you see the help, then it is ready to go, installation is complete!
Quick Start
-----------
Expect-lite has many features which make it useful, and the documenation
<http://expect-lite.sourceforge.net/> highlights those. But to start
using expect-lite quickly, you require two items:
1. a script
2. a host
Here is a quick script which you can paste into a file to test
expect-lite, call it test.elt :
; ==== Ping localhost and report result ====
@5
>ping -c 2 localhost
+$packet_rx=(\d+) received
>
>echo "Packets received are:$packet_rx"
The second item you require is a host to run your script against.
Expect-lite is designed to log into a remote host and run your script,
as if a person was typing the commands. However that may require setting
up ssh keys and so forth, and this is the Quick Start section. Type the
following to run the above script on your localhost:
expect-lite r=none c=test.elt
There should be output that looks similar to the following:
cvmiller@maile:~/Freescale$
cvmiller@maile:~/Freescale$ ping -c 2 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.053 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.056 ms
--- localhost ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.053/0.054/0.056/0.007 ms
cvmiller@maile:~/Freescale$
Assigned Var:packet_rx=2
cvmiller@maile:~/Freescale$ echo "Packets received:2"
Packets received:2
##Overall Result: PASS
Congratulations you have just run your first expect-lite script!
Quick Doc
---------
To learn more about expect-lite please look at the documentation. expect-lite
interprets the script based on the first character of the line. Here's a
short list of what is available to get you started:
> send to remote host, implies "wait for prompt"
< _MUST_ be received, or script will report failure
# are comment lines, and have no effect
; are printable (in stdout) comments, and have no other effect
@ change the expect timeout value
? If statement, use format ?cond?action::else_action
There are many more commands supported in expect-lite, it really is worth
reading the documentation.
BSD-Style License
-----------------
Copyright (c) 2008-2017, Craig Miller
Copyright (c) 2007, Freescale Semiconductor, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the Freescale Semiconductor nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------
15 January 2015
Celebrating 10 Years
http://expect-lite.sourceforge.net/
this document for version 4.1.1 or later