|
| 1 | +import lldb |
| 2 | +from lldbsuite.test.lldbtest import * |
| 3 | +from lldbsuite.test.decorators import * |
| 4 | +import lldbsuite.test.lldbutil as lldbutil |
| 5 | +import os |
| 6 | +import unittest2 |
| 7 | + |
| 8 | + |
| 9 | +class TestSwiftMacCatalyst(TestBase): |
| 10 | + |
| 11 | + mydir = TestBase.compute_mydir(__file__) |
| 12 | + |
| 13 | + # There's a bug that prevents the maccatalyst SDK overlays from being built. |
| 14 | + @expectedFailureAll(bugnumber='rdar://problem/62658576') |
| 15 | + @swiftTest |
| 16 | + @skipIf(macos_version=["<", "10.15"]) |
| 17 | + @skipUnlessDarwin |
| 18 | + @skipIfDarwinEmbedded |
| 19 | + def test_macCatalyst(self): |
| 20 | + """Test the x86_64-apple-ios-macabi target. |
| 21 | + Note that this test only works when build-script |
| 22 | + is being invoked with --maccatalyst! |
| 23 | + """ |
| 24 | + self.build() |
| 25 | + |
| 26 | + types_log = self.getBuildArtifact('types.log') |
| 27 | + self.runCmd('log enable lldb types -f "%s"' % types_log) |
| 28 | + |
| 29 | + lldbutil.run_to_source_breakpoint(self, "break here", |
| 30 | + lldb.SBFileSpec('main.swift')) |
| 31 | + self.expect("image list -t -b", |
| 32 | + patterns=["x86_64-apple-ios13.0.0-macabi a\.out", |
| 33 | + "x86_64.*-apple-ios.*-macabi Foundation", |
| 34 | + "x86_64.*-apple-.* libswiftCore", |
| 35 | + "x86_64.*-apple-macosx.* libcompiler_rt.dylib"]) |
| 36 | + self.expect("fr v s", "Hello macCatalyst") |
| 37 | + expr_log = self.getBuildArtifact("expr.log") |
| 38 | + self.expect('log enable lldb expr -f "%s"' % expr_log) |
| 39 | + self.expect("p s", "Hello macCatalyst") |
| 40 | + expr_logfile = open(expr_log, "r") |
| 41 | + import re |
| 42 | + availability_re = re.compile(r'@available\(macCatalyst 1.*, \*\)') |
| 43 | + found = False |
| 44 | + for line in expr_logfile: |
| 45 | + print(line) |
| 46 | + if availability_re.search(line): |
| 47 | + found = True |
| 48 | + break |
| 49 | + self.assertTrue(found) |
| 50 | + |
| 51 | + found_prebuilt = False |
| 52 | + found_sdk = False |
| 53 | + types_logfile = open(types_log, "r") |
| 54 | + for line in types_logfile: |
| 55 | + if 'Using prebuilt Swift module cache path: ' in line: |
| 56 | + self.assertTrue(line.endswith('/macosx/prebuilt-modules\n'), |
| 57 | + 'unexpected prebuilt cache path: ' + line) |
| 58 | + found = True |
| 59 | + if 'SDK path' in line: |
| 60 | + self.assertTrue('SDKs/MacOSX' in line, 'picked non-macOS SDK:' + line) |
| 61 | + found_sdk = True |
| 62 | + self.assertTrue(found_prebuilt, 'prebuilt cache path log entry not found') |
| 63 | + self.assertTrue(found_sdk, 'SDK path log entry not found') |
0 commit comments