@@ -11,6 +11,18 @@ class TestSwiftXcodeSDK(lldbtest.TestBase):
11
11
mydir = lldbtest .TestBase .compute_mydir (__file__ )
12
12
NO_DEBUG_INFO_TESTCASE = True
13
13
14
+ def check_log (self , log , expected_path ):
15
+ logfile = open (log , "r" )
16
+ in_expr_log = 0
17
+ found = 0
18
+ for line in logfile :
19
+ if line .startswith (" SwiftASTContextForExpressions::LogConfiguration" ):
20
+ in_expr_log += 1
21
+ if in_expr_log and "SDK path" in line and expected_path in line :
22
+ found += 1
23
+ self .assertEqual (in_expr_log , 1 )
24
+ self .assertEqual (found , 1 )
25
+
14
26
@swiftTest
15
27
@skipUnlessDarwin
16
28
@skipIfDarwinEmbedded
@@ -23,16 +35,26 @@ def test_decode(self):
23
35
lldbutil .run_to_name_breakpoint (self , 'main' )
24
36
25
37
self .expect ("p 1" )
26
- logfile = open (log , "r" )
27
- in_expr_log = 0
28
- found = 0
29
- for line in logfile :
30
- if line .startswith (" SwiftASTContextForExpressions::LogConfiguration" ):
31
- in_expr_log += 1
32
- if in_expr_log and "SDK path" in line and ".sdk" in line :
33
- found += 1
34
- self .assertEqual (in_expr_log , 1 )
35
- self .assertEqual (found , 1 )
38
+ self .check_log (log , ".sdk" )
39
+
40
+ @swiftTest
41
+ @skipUnlessDarwin
42
+ @skipIfDarwinEmbedded
43
+ @apple_simulator_test ('iphone' )
44
+ # FIXME: This test depends on https://reviews.llvm.org/D81980.
45
+ @expectedFailureAll (bugnumber = "rdar://problem/64461839" )
46
+ def test_decode_sim (self ):
47
+ """Test that we can detect an Xcode SDK that is different from the host SDK
48
+ from the DW_AT_LLVM_sdk attribute."""
49
+ arch = self .getArchitecture ()
50
+ self .build (dictionary = {'TRIPLE' : arch + '-apple-ios-simulator' , 'ARCH' : arch })
51
+ log = self .getBuildArtifact ("types.log" )
52
+ self .expect ("log enable lldb types -f " + log )
53
+
54
+ lldbutil .run_to_name_breakpoint (self , 'main' )
55
+
56
+ self .expect ("p 1" )
57
+ self .check_log (log , "iPhoneSimulator" )
36
58
37
59
@swiftTest
38
60
@skipUnlessDarwin
@@ -52,13 +74,4 @@ def test_override(self):
52
74
lldbutil .run_to_name_breakpoint (self , 'main' )
53
75
54
76
self .expect ("p 1" )
55
- logfile = open (log , "r" )
56
- in_expr_log = 0
57
- found = 0
58
- for line in logfile :
59
- if line .startswith (" SwiftASTContextForExpressions::LogConfiguration" ):
60
- in_expr_log += 1
61
- if in_expr_log and "SDK path" in line and ios_sdk in line :
62
- found += 1
63
- self .assertEqual (in_expr_log , 1 )
64
- self .assertEqual (found , 1 )
77
+ self .check_log (log , ios_sdk )
0 commit comments