Skip to content

Commit

Permalink
Add regression test for symlink handling
Browse files Browse the repository at this point in the history
Signed-off-by: John Pennycook <[email protected]>
  • Loading branch information
Pennycook committed Oct 11, 2024
1 parent 1cb6aae commit ca5dc31
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/duplicates/cpu2
34 changes: 34 additions & 0 deletions tests/duplicates/test_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,40 @@ def test_duplicates(self):
setmap = mapper.walk(state)
self.assertDictEqual(setmap, expected_setmap, "Mismatch in setmap")

def test_symlinks(self):
"""Check that symlinks do not count towards divergence."""

cpufile = str(self.rootdir / "cpu/foo.cpp")
cpu2file = str(self.rootdir / "cpu2/foo.cpp")

codebase = CodeBase(self.rootdir, exclude_patterns=["gpu/"])

configuration = {
"cpu": [
{
"file": cpufile,
"defines": [],
"include_paths": [],
"include_files": [],
},
],
"cpu2": [
{
"file": cpu2file,
"defines": [],
"include_paths": [],
"include_files": [],
},
],
}

expected_setmap = {frozenset(["cpu", "cpu2"]): 1}

state = finder.find(self.rootdir, codebase, configuration)
mapper = PlatformMapper(codebase)
setmap = mapper.walk(state)
self.assertDictEqual(setmap, expected_setmap, "Mismatch in setmap")


if __name__ == "__main__":
unittest.main()

0 comments on commit ca5dc31

Please sign in to comment.