mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #1701 from nakengelhardt/rpc-test
make rpc frontend unix socket test less fragile
This commit is contained in:
commit
c7af1b22ba
|
@ -31,7 +31,7 @@ end
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import argparse
|
import argparse
|
||||||
import sys, socket, os
|
import sys, socket, os, subprocess
|
||||||
try:
|
try:
|
||||||
import msvcrt, win32pipe, win32file
|
import msvcrt, win32pipe, win32file
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -85,6 +85,7 @@ def main():
|
||||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||||
sock.bind(args.path)
|
sock.bind(args.path)
|
||||||
try:
|
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)
|
sock.listen(1)
|
||||||
conn, addr = sock.accept()
|
conn, addr = sock.accept()
|
||||||
file = conn.makefile("rw")
|
file = conn.makefile("rw")
|
||||||
|
@ -93,7 +94,11 @@ def main():
|
||||||
if not input: break
|
if not input: break
|
||||||
file.write(call(input) + "\n")
|
file.write(call(input) + "\n")
|
||||||
file.flush()
|
file.flush()
|
||||||
|
ys_proc.wait(timeout=10)
|
||||||
|
if ys_proc.returncode:
|
||||||
|
raise subprocess.CalledProcessError(ys_proc.returncode, ys_proc.args)
|
||||||
finally:
|
finally:
|
||||||
|
ys_proc.kill()
|
||||||
sock.close()
|
sock.close()
|
||||||
os.unlink(args.path)
|
os.unlink(args.path)
|
||||||
|
|
||||||
|
|
|
@ -4,3 +4,4 @@ for x in *.ys; do
|
||||||
echo "Running $x.."
|
echo "Running $x.."
|
||||||
../../yosys -ql ${x%.ys}.log $x
|
../../yosys -ql ${x%.ys}.log $x
|
||||||
done
|
done
|
||||||
|
python3 frontend.py unix-socket frontend.sock
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in New Issue