3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-08-26 06:36:02 +00:00
sby/tests/links/symlink.py
Krystine Sherwin a215e3260a
tests/links/symlink: Check file count
And also that `src/dir/script.ys` exists
2025-08-02 10:07:06 +12:00

23 lines
670 B
Python

from pathlib import Path
import sys
def main():
workdir, task = sys.argv[1:]
src = Path(workdir) / "src"
count = 0
for srcfile in src.iterdir():
if srcfile.name == "heredoc":
assert(not srcfile.is_symlink())
with open(srcfile, "r") as f:
local_contents = f.readline()
assert(local_contents.strip() == 'log foo')
else:
assert(srcfile.is_symlink() == (task == "link"))
assert(srcfile.name != "script.ys")
count += 1
assert(count == 4)
script_ys = src / "dir" / "script.ys"
assert(script_ys.exists())
if __name__ == "__main__":
main()