Skip to content

Commit

Permalink
Better checking of available solvers
Browse files Browse the repository at this point in the history
Check for required auxiliary tools and always regenerate the make rules
when the set of available tools changes.
  • Loading branch information
jix committed May 30, 2022
1 parent 939e000 commit dc22d97
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
24 changes: 24 additions & 0 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@ test:

.PHONY: test clean refresh help

TOOL_LIST := \
btorsim \
yices \
aigbmc \
avy \
bitwuzla \
boolector \
btormc \
cvc4 \
mathsat \
pono \
suprove \
yices-smt2 \
yices \
yosys-abc \
z3

help:
@cat make/help.txt

Expand All @@ -15,5 +32,12 @@ make/rules/test/%.mk:
python3 make/test_rules.py $<

ifneq (help,$(MAKECMDGOALS))

FIND_TOOLS := $(shell \
TOOLS=$$(which $(TOOL_LIST) 2>/dev/null || true); \
echo $$TOOLS | cmp -s make/rules/found_tools || echo $$TOOLS > make/rules/found_tools \
)

include make/rules/collect.mk

endif
2 changes: 1 addition & 1 deletion tests/make/collect_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def collect(path):
print(f"{out_file}: {checked_dir}", file=output)

for test in tests:
print(f"make/rules/test/{test}.mk: {test}", file=output)
print(f"make/rules/test/{test}.mk: {test} make/rules/found_tools", file=output)
for ext in [".sh", ".py"]:
script_file = test.parent / (test.stem + ext)
if script_file.exists():
Expand Down
17 changes: 11 additions & 6 deletions tests/make/test_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def parse_engine(engine):
return engine, default_solvers.get(engine)


# When adding new tools, also update TOOL_LIST in Makefile to make sure we regenerate
# the rules when the user installs or removes any of the tools
REQUIRED_TOOLS = {
("smtbmc", "yices"): ["yices-smt2"],
("smtbmc", "z3"): ["z3"],
Expand All @@ -34,11 +36,12 @@ def parse_engine(engine):
("smtbmc", "boolector"): ["boolector"],
("smtbmc", "bitwuzla"): ["bitwuzla"],
("smtbmc", "abc"): ["yosys-abc"],
("aiger", "suprove"): ["suprove"],
("aiger", "avy"): ["avy"],
("aiger", "aigbmc"): ["aigbmc"],
("btor", "btormc"): ["btormc"],
("btor", "pono"): ["pono"],
("aiger", "suprove"): ["suprove", "yices"],
("aiger", "avy"): ["avy", "yices"],
("aiger", "aigbmc"): ["aigbmc", "yices"],
("btor", "btormc"): ["btormc", "btorsim"],
("btor", "pono"): ["pono", "btorsim"],
("abc"): ["yices"],
}

rules_file = Path("make/rules/test") / sby_dir / (sby_file.name + ".mk")
Expand All @@ -63,7 +66,9 @@ def parse_engine(engine):
for engine in info["engines"]:
engine, solver = parse_engine(engine)
engines.add(engine)
required_tools.update(REQUIRED_TOOLS.get((engine, solver), ()))
required_tools.update(
REQUIRED_TOOLS.get((engine, solver), REQUIRED_TOOLS.get(engine, ()))
)
if solver:
solvers.add(solver)
engine_solvers.add((engine, solver))
Expand Down

0 comments on commit dc22d97

Please sign in to comment.