diff --git a/tests/duplicates/cpu2 b/tests/duplicates/cpu2 new file mode 120000 index 0000000..840a958 --- /dev/null +++ b/tests/duplicates/cpu2 @@ -0,0 +1 @@ +cpu/ \ No newline at end of file diff --git a/tests/duplicates/test_duplicates.py b/tests/duplicates/test_duplicates.py index 459f29e..ee5a940 100644 --- a/tests/duplicates/test_duplicates.py +++ b/tests/duplicates/test_duplicates.py @@ -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()