5from __future__
import annotations
8from pathlib
import Path
15_logger = logging.getLogger(__name__)
18HW_DIR = ROOT_DIR /
"hw"
19SW_DIR = ROOT_DIR /
"sw"
24 return Path(esiaccel.__file__).
resolve().parent.parent.parent
27def require_tool(tool: str) ->
None:
28 if shutil.which(tool)
is None:
29 pytest.skip(f
"Required tool not found in PATH: {tool}")
33 value = os.environ.get(var_name)
35 pytest.skip(f
"Required environment variable not set: {var_name}")
39def run_cmd(cmd, **kwargs) -> str:
40 """Run a command, capture stdout, and return it. Raises on failure."""
41 _logger.info(
"run_cmd: %s", cmd)
42 result = subprocess.run(cmd,
47 _logger.debug(
"stdout: %s", result.stdout)
48 _logger.debug(
"stderr: %s", result.stderr)
52def check_lines(stdout: str, expected: list[str]) ->
None:
53 """Assert that every expected substring appears in stdout in order."""
56 idx = remaining.find(line)
58 f
"Expected output not found: {line!r}"
59 remaining = remaining[idx + len(line):]
static mlir::Operation * resolve(Context &context, mlir::SymbolRefAttr sym)
str require_env(str var_name)