mirror of
https://github.com/YosysHQ/sby.git
synced 2025-07-17 20:16:42 +00:00
tests: Move required tool checks from rule generation to execution
This avoids regenerating the test makefile rules when the set of installed tools changes and is a bit simpler overall.
This commit is contained in:
parent
80eacf34ca
commit
34d6adf098
4 changed files with 39 additions and 30 deletions
|
@ -17,11 +17,40 @@ REQUIRED_TOOLS = {
|
|||
}
|
||||
|
||||
|
||||
def found_tools():
|
||||
with open("make/rules/found_tools") as found_tools_file:
|
||||
return [tool.strip() for tool in found_tools_file.readlines()]
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args and args[0] == "run":
|
||||
target, command, *required_tools = args[1:]
|
||||
|
||||
with open("make/rules/found_tools") as found_tools_file:
|
||||
found_tools = set(tool.strip() for tool in found_tools_file.readlines())
|
||||
|
||||
missing_tools = sorted(
|
||||
f"`{tool}`" for tool in required_tools if tool not in found_tools
|
||||
)
|
||||
if missing_tools:
|
||||
noskip = "NOSKIP" in os.environ.get("MAKEFLAGS", "")
|
||||
print()
|
||||
print(f"SKIPPING {target}: {', '.join(missing_tools)} not found")
|
||||
if noskip:
|
||||
print("NOSKIP was set, treating this as an error")
|
||||
print()
|
||||
exit(noskip)
|
||||
|
||||
print(command, flush=True)
|
||||
exit(subprocess.call(command, shell=True))
|
||||
|
||||
found_tools = []
|
||||
check_tools = set()
|
||||
for tools in REQUIRED_TOOLS.values():
|
||||
|
@ -59,6 +88,3 @@ if __name__ == "__main__":
|
|||
|
||||
with open("make/rules/found_tools", "w") as found_tools_file:
|
||||
found_tools_file.write(found_tools)
|
||||
else:
|
||||
with open("make/rules/found_tools") as found_tools_file:
|
||||
found_tools = [tool.strip() for tool in found_tools_file.readlines()]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue