Skip to content

Commit

Permalink
test: cargo build validator in CI (#468)
Browse files Browse the repository at this point in the history
Many hugr-building tests are showing up as `s` == skipped after #455. We
need to `cargo build` the validator first.

Also "fix" (perhaps hack) `run_int_fn` to extract the first `module`
Hugr from the Package coming back from compilation.
  • Loading branch information
acl-cqc authored Sep 9, 2024
1 parent 7f9ad32 commit 71340d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
- name: Install Guppy with llvm-based execution
run: uv sync --extra execution

- name: Cargo build validator
run: cargo build -p validator --release

- name: Run tests
run: uv run pytest

Expand Down Expand Up @@ -106,6 +109,9 @@ jobs:
- name: Install Guppy with execution and pytket
run: uv sync --extra execution --extra pytket

- name: Cargo build validator
run: cargo build -p validator --release

- name: Run python tests with coverage instrumentation
run: uv run pytest --cov=./ --cov-report=xml

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ class LLVMException(Exception):

@pytest.fixture
def run_int_fn():
def f(hugr: Hugr, expected: int, fn_name: str = "main"):
def f(hugr: Package, expected: int, fn_name: str = "main"):
try:
import execute_llvm

if not hasattr(execute_llvm, "run_int_function"):
pytest.skip("Skipping llvm execution")

hugr_json: str = hugr.to_json()
hugr_json: str = hugr.modules[0].to_json()
res = execute_llvm.run_int_function(hugr_json, fn_name)
if res != expected:
raise LLVMException(
Expand Down

0 comments on commit 71340d2

Please sign in to comment.