File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ def associator(node: Node) -> Visit:
117
117
association [node ].add (platform .name )
118
118
active = node .evaluate_for_platform (
119
119
platform = platform ,
120
- filename = filename ,
120
+ filename = self . _get_realpath ( filename ) ,
121
121
state = self ,
122
122
)
123
123
Original file line number Diff line number Diff line change 2
2
# SPDX-License-Identifier: BSD-3-Clause
3
3
4
4
import logging
5
+ import os
6
+ import tempfile
5
7
import unittest
6
8
from pathlib import Path
7
9
@@ -43,6 +45,30 @@ def test_include(self):
43
45
"Mismatch in setmap" ,
44
46
)
45
47
48
+ def test_include_from_symlink (self ):
49
+ """Check included file correctly identifies its parent"""
50
+ tmp = tempfile .TemporaryDirectory ()
51
+ p = Path (tmp .name )
52
+ with open (p / "test.cpp" , mode = "w" ) as f :
53
+ f .write ('#include "test.h"' )
54
+ open (p / "test.h" , mode = "w" ).close ()
55
+ os .symlink (p / "test.cpp" , p / "symlink.cpp" )
56
+
57
+ codebase = CodeBase (p )
58
+ configuration = {
59
+ "test" : [
60
+ {
61
+ "file" : str (p / "symlink.cpp" ),
62
+ "defines" : [],
63
+ "include_paths" : [],
64
+ "include_files" : [],
65
+ },
66
+ ],
67
+ }
68
+ _ = finder .find (self .rootdir , codebase , configuration )
69
+
70
+ tmp .cleanup ()
71
+
46
72
47
73
if __name__ == "__main__" :
48
74
unittest .main ()
You can’t perform that action at this time.
0 commit comments