diff options
author | Miodrag Milanović <mmicko@gmail.com> | 2020-02-14 12:06:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-14 12:06:37 +0100 |
commit | c7af1b22bae67a651130947920b482183098167d (patch) | |
tree | 241ed1886c741a60ca0871287a14a87dee678b41 | |
parent | 0cf7598cd644286053ad36ebb44d5bf3d66d3c49 (diff) | |
parent | c2467fdd558f7a12e77ed3a14cf704a932819fdf (diff) | |
download | yosys-c7af1b22bae67a651130947920b482183098167d.tar.gz yosys-c7af1b22bae67a651130947920b482183098167d.tar.bz2 yosys-c7af1b22bae67a651130947920b482183098167d.zip |
Merge pull request #1701 from nakengelhardt/rpc-test
make rpc frontend unix socket test less fragile
-rw-r--r-- | tests/rpc/frontend.py | 7 | ||||
-rwxr-xr-x | tests/rpc/run-test.sh | 1 | ||||
-rw-r--r-- | tests/rpc/unix.ys | 6 |
3 files changed, 7 insertions, 7 deletions
diff --git a/tests/rpc/frontend.py b/tests/rpc/frontend.py index eff41738a..eace07bf9 100644 --- a/tests/rpc/frontend.py +++ b/tests/rpc/frontend.py @@ -31,7 +31,7 @@ end import json import argparse -import sys, socket, os +import sys, socket, os, subprocess try: import msvcrt, win32pipe, win32file except ImportError: @@ -85,6 +85,7 @@ def main(): sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock.bind(args.path) try: + ys_proc = subprocess.Popen(["../../yosys", "-ql", "unix.log", "-p", "connect_rpc -path {}; read_verilog design.v; hierarchy -top top; flatten; select -assert-count 1 t:$neg".format(args.path)]) sock.listen(1) conn, addr = sock.accept() file = conn.makefile("rw") @@ -93,7 +94,11 @@ def main(): if not input: break file.write(call(input) + "\n") file.flush() + ys_proc.wait(timeout=10) + if ys_proc.returncode: + raise subprocess.CalledProcessError(ys_proc.returncode, ys_proc.args) finally: + ys_proc.kill() sock.close() os.unlink(args.path) diff --git a/tests/rpc/run-test.sh b/tests/rpc/run-test.sh index 44ce7e674..eeb309347 100755 --- a/tests/rpc/run-test.sh +++ b/tests/rpc/run-test.sh @@ -4,3 +4,4 @@ for x in *.ys; do echo "Running $x.." ../../yosys -ql ${x%.ys}.log $x done +python3 frontend.py unix-socket frontend.sock diff --git a/tests/rpc/unix.ys b/tests/rpc/unix.ys deleted file mode 100644 index cc7ec14ab..000000000 --- a/tests/rpc/unix.ys +++ /dev/null @@ -1,6 +0,0 @@ -!python3 frontend.py unix-socket frontend.sock & sleep 0.1 -connect_rpc -path frontend.sock -read_verilog design.v -hierarchy -top top -flatten -select -assert-count 1 t:$neg |