Skip to content

Commit

Permalink
functional tests: run from make tests but not smtlib/rkt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aiju committed Sep 4, 2024
1 parent 7de8be1 commit 5a476a8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ endif
+cd tests/xprop && bash run-test.sh $(SEEDOPT)
+cd tests/fmt && bash run-test.sh
+cd tests/cxxrtl && bash run-test.sh
+cd tests/functional && bash run-test.sh
@echo ""
@echo " Passed \"make test\"."
@echo ""
Expand Down
6 changes: 5 additions & 1 deletion tests/functional/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

random_seed = random.getrandbits(32)

def pytest_configure(config):
config.addinivalue_line("markers", "smt: test uses smtlib/z3")
config.addinivalue_line("markers", "rkt: test uses racket/rosette")

def pytest_addoption(parser):
parser.addoption("--per-cell", type=int, default=None, help="run only N tests per cell")
parser.addoption("--steps", type=int, default=1000, help="run each test for N steps")
Expand All @@ -27,4 +31,4 @@ def pytest_generate_tests(metafunc):
seed1 = metafunc.config.getoption("seed")
rnd = lambda seed2: random.Random('{}-{}'.format(seed1, seed2))
names, cases = generate_test_cases(per_cell, rnd)
metafunc.parametrize("cell,parameters", cases, ids=names)
metafunc.parametrize("cell,parameters", cases, ids=names)
2 changes: 1 addition & 1 deletion tests/functional/run-test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
pytest -v "$@"
pytest -v -m "not smt and not rkt" "$@"
2 changes: 2 additions & 0 deletions tests/functional/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_cxx(cell, parameters, tmp_path, num_steps, rnd):
run([str(vcdharness_exe_file.resolve()), str(vcd_functional_file), str(num_steps), str(seed)])
yosys_sim(rtlil_file, vcd_functional_file, vcd_yosys_sim_file, getattr(cell, 'sim_preprocessing', ''))

@pytest.mark.smt
def test_smt(cell, parameters, tmp_path, num_steps, rnd):
import smt_vcd

Expand All @@ -72,6 +73,7 @@ def test_smt(cell, parameters, tmp_path, num_steps, rnd):
smt_vcd.simulate_smt(smt_file, vcd_functional_file, num_steps, rnd(cell.name + "-smt"))
yosys_sim(rtlil_file, vcd_functional_file, vcd_yosys_sim_file, getattr(cell, 'sim_preprocessing', ''))

@pytest.mark.rkt
def test_rkt(cell, parameters, tmp_path, num_steps, rnd):
import rkt_vcd

Expand Down

0 comments on commit 5a476a8

Please sign in to comment.