|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | import hal |
3 | 3 | import time |
4 | | -import subprocess |
| 4 | +import os |
5 | 5 | from raster import * |
6 | 6 |
|
7 | 7 | theta = 0.005 |
@@ -193,19 +193,10 @@ def main(): |
193 | 193 |
|
194 | 194 | prog = RasterProgrammer("programmer") |
195 | 195 |
|
196 | | - #instantiate the raster component |
197 | | - #use interactive mode to be have the hal running |
198 | | - #while needed and exit with writing "exit" at the end |
199 | | - halrun = subprocess.Popen(["halrun", "-Is", "raster.hal"], stdin=subprocess.PIPE) |
200 | | - #Test the last connection added in raster.hal |
201 | | - #to determine if hal is up and running |
202 | | - deadline = time.time() + 5 |
203 | | - while time.time() < deadline: |
204 | | - if hal.pin_has_writer("test.fraction"): |
205 | | - break |
206 | | - time.sleep(0.01) |
207 | | - else: |
208 | | - raise RuntimeError("raster.hal did not come up within 5s") |
| 196 | + #instantiate the raster component, |
| 197 | + #add it to a thread and link all signals from |
| 198 | + #the test component here |
| 199 | + assert os.system('halcmd -f raster.hal') == 0, "raster.hal script failed" |
209 | 200 |
|
210 | 201 | testInvalidOffset(prog, pin) |
211 | 202 | testInvalidBPP(prog, pin) |
@@ -261,21 +252,6 @@ def main(): |
261 | 252 | finally: |
262 | 253 | c.exit() |
263 | 254 | prog.exit() |
264 | | - try: |
265 | | - try: |
266 | | - halrun.communicate(input=b"exit\n", timeout=5) |
267 | | - except subprocess.TimeoutExpired: |
268 | | - halrun.kill() |
269 | | - halrun.communicate() |
270 | | - exit_status = halrun.returncode |
271 | | - if exit_status == 0: |
272 | | - return 0 |
273 | | - else: |
274 | | - print("Halrun failed, exit status " + str(exit_status)) |
275 | | - return 1 |
276 | | - except Exception as e: |
277 | | - print("error: Test failed: {}".format(traceback.format_exc())) |
278 | | - return 1 |
279 | 255 | return 0 |
280 | 256 |
|
281 | 257 | if __name__ == "__main__": |
|
0 commit comments