mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-09 09:21:58 +00:00
- Rewrite all Python features to use the pybind11 library instead of boost::python. Unlike boost::python, pybind11 is a header-only library that is just included by Pyosys code, saving a lot of compile time on wheels. - Factor out as much "translation" code from the generator into proper C++ files - Fix running the embedded interpreter not supporting "from pyosys import libyosys as ys" like wheels - Move Python-related elements to `pyosys` directory at the root of the repo - Slight shift in bridging semantics: - Containers are declared as "opaque types" and are passed by reference to Python - many methods have been implemented to make them feel right at home without the overhead/ambiguity of copying to Python and then copying back after mutation - Monitor/Pass use "trampoline" pattern to support virual methods overridable in Python: virtual methods no longer require `py_` prefix - Create really short test set for pyosys that just exercises basic functionality
39 lines
815 B
Python
39 lines
815 B
Python
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
|
|
__file_dir__ = Path(__file__).absolute().parent
|
|
|
|
if len(sys.argv) != 2:
|
|
print(f"Usage: {sys.argv[0]} {sys.argv[1]}")
|
|
exit(64)
|
|
|
|
binary = []
|
|
if sys.argv[1] in ["yosys"]:
|
|
binary = [__file_dir__.parents[1] / "yosys", "-Qy"]
|
|
else:
|
|
binary = [sys.argv[1]]
|
|
|
|
tests = __file_dir__.glob("test_*.py")
|
|
errors = False
|
|
log_dir = __file_dir__ / "logs"
|
|
try:
|
|
shutil.rmtree(log_dir)
|
|
except FileNotFoundError:
|
|
pass
|
|
for test in tests:
|
|
print(f"* {test.name} ", end="")
|
|
log_dir.mkdir(parents=True, exist_ok=True)
|
|
log = log_dir / (test.stem + ".log")
|
|
result = subprocess.run([
|
|
*binary,
|
|
test
|
|
], stdout=open(log, "w"), stderr=subprocess.STDOUT)
|
|
if result.returncode == 0:
|
|
print("OK!")
|
|
else:
|
|
print(f"FAILED: {log}")
|
|
errors = True
|
|
if errors:
|
|
exit(1)
|