@@ -4,7 +4,7 @@ In-development Python client for SAW.
4
4
5
5
This SAW client depends on the [ saw-remote-api] ( https://github.com/GaloisInc/saw-script/tree/master/saw-remote-api ) server.
6
6
7
- ## TL;DR Steps to running SAW Python scripts
7
+ # TL;DR Steps to running SAW Python scripts
8
8
9
9
1 . Clone the repo
10
10
```
@@ -47,16 +47,21 @@ $ poetry run python tests/saw/test_salsa20.py
47
47
subprocesses when run via ` unittest ` even though they pass and successfully
48
48
verify the goals. It's on our to-do list.)
49
49
50
- ## Installation
50
+ # Python Client Installation (via Poetry)
51
51
52
- # Python environment
52
+ First, clone the repository and submodules.
53
53
54
- ## Poetry
54
+ ```
55
+ $ git clone https://github.com/GaloisInc/saw-script.git
56
+ $ cd saw-script
57
+ $ git submodule update --init
58
+ ```
55
59
56
- First, [ install ` poetry ` ] ( https://python-poetry.org/docs/#installation ) and then
57
- run in the ` saw-remote-api/python ` directory:
60
+ Then, use [ ` poetry ` ] ( https://python-poetry.org/docs/#installation ) to install
61
+ the python client from the ` saw-remote-api/python ` directory:
58
62
59
63
```
64
+ $ cd saw-remote-api/python
60
65
$ poetry install
61
66
```
62
67
@@ -89,9 +94,11 @@ and reset it, ensuring states from previous scrips have been cleared. E.g.,
89
94
` saw.connect(reset_server=True) ` .
90
95
91
96
92
- ## Selecting a SAW Server
97
+ ## Acquiring a SAW Server
93
98
94
- ## Server executables
99
+ There are several ways a server executable can be obtained.
100
+
101
+ ### Server executables
95
102
96
103
An executable of the server is included in the SAW release/nightly tarballs.
97
104
@@ -138,17 +145,17 @@ container.)
138
145
### Building from Source
139
146
140
147
If this repository is checked out and the build directions are successfully run,
141
- ` cabal v2-which saw-remote-api ` will indicate where the server executable has
142
- been stored.
148
+ ` cabal v2-exec which saw-remote-api ` should indicate where the server executable has
149
+ been stored by ` cabal ` .
143
150
144
151
Alternatively ` cabal v2-install saw-remote-api ` should install the server
145
152
executable into the user's ` ~/.cabal/bin ` directory (or similar), which (if
146
- configured properly) should then appear as ` saw-remote-api ` in a user's ` PATH ` ,
153
+ configured properly) should then appear as ` saw-remote-api ` in a user's ` PATH ` .
147
154
148
155
149
156
# Running Python SAW verification scripts
150
157
151
- Once the server is setup and any path variables are setup as necessary , the
158
+ Once the server is setup and any path variables are setup as desired , the
152
159
Python (>= v3.8) client can be installed using
153
160
[ ` poetry ` ] ( https://python-poetry.org/docs/#installation ) as follows:
154
161
@@ -162,3 +169,33 @@ Then the tests or individual scripts can be run as follows:
162
169
$ poetry run python -m unittest discover tests/saw
163
170
$ poetry run python tests/saw/test_salsa20.py
164
171
```
172
+
173
+ If leveraging environment variables is undesirable, the scripts themselves can
174
+ specify a command to launch the server, e.g.:
175
+
176
+ ```
177
+ saw.connect(COMMAND)
178
+ ```
179
+
180
+ where ` COMMAND ` is a command to launch a new SAW server in socket mode.
181
+
182
+ Or a server URL can be specified directly in the script, e.g.:
183
+
184
+ ```
185
+ saw.connect(url=URL)
186
+ ```
187
+
188
+ where ` URL ` is a URL for a running SAW server in HTTP mode.
189
+
190
+ ## Running Verification Scripts from a clean state
191
+
192
+ To ensure any previous server state is cleared when running a SAW Python script
193
+ against a persistent server (e.g., one running in HTTP mode in a different process),
194
+ the ` reset_server ` keyword can be passed to ` saw.connect() ` . E.g.,
195
+
196
+ ```
197
+ saw.connect(url="http://localhost:8080/", reset_server=True)
198
+ ```
199
+
200
+ will connect to a SAW server running at ` http://localhost:8080/ ` and will
201
+ guarantee any previous state on the server is cleared.
0 commit comments