from pathlib import Path
import platform
import shlex
+import shutil
import subprocess
import sys
import sysconfig
return subprocess.check_output(args, **kwargs)
+def gvpr(program: Path) -> str:
+ """run a GVPR program on empty input"""
+
+ assert shutil.which("gvpr") is not None, \
+ "attempt to run GVPR without it available"
+
+ return subprocess.check_output(["gvpr", "-f", program],
+ stdin=subprocess.DEVNULL,
+ universal_newlines=True)
+
def run_c(src: Path, args: List[str] = None, input: str = "",
cflags: List[str] = None, link: List[str] = None
) -> Tuple[str, str]:
import pytest
sys.path.append(os.path.dirname(__file__))
-from gvtest import dot, ROOT, run_c #pylint: disable=C0413
+from gvtest import dot, gvpr, ROOT, run_c #pylint: disable=C0413
def is_mingw() -> bool:
"""
clustg = Path(__file__).resolve().parent.parent / "cmd/gvpr/lib/clustg"
# GVPR should not fail when given this path
- subprocess.check_call(["gvpr", "-f", clustg], stdin=subprocess.DEVNULL)
+ gvpr(clustg)
def test_1783():
"""
assert script.exists(), "missing test case"
# run this with NUL input, checking output is valid UTF-8
- _ = subprocess.check_output(["gvpr", "-f", script],
- stdin=subprocess.DEVNULL,
- universal_newlines=True)
+ gvpr(script)
def test_2185_2():
"""