Skip to content

Commit abe4797

Browse files
committed
Port testcase to precise compiler invocations
1 parent d2b6817 commit abe4797

File tree

1 file changed

+15
-47
lines changed

1 file changed

+15
-47
lines changed

lldb/test/API/lang/swift/clangimporter/rewrite_clang_paths/TestSwiftRewriteClangPaths.py

Lines changed: 15 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@
2121
class TestSwiftRewriteClangPaths(TestBase):
2222
# Don't run ClangImporter tests if Clangimporter is disabled.
2323
@skipIf(setting=('symbols.use-swift-clangimporter', 'false'))
24-
@skipIf(setting=('symbols.swift-precise-compiler-invocation', 'true'))
24+
@skipIf(setting=('symbols.swift-precise-compiler-invocation', 'false'))
2525
@skipUnlessDarwin
2626
@swiftTest
2727
@skipIf(debug_info=no_match(["dsym"]))
28-
@expectedFailureAll(setting=('plugin.typesystem.clang.experimental-redecl-completion', 'true'))
2928
def testWithRemap(self):
3029
self.dotest(True)
3130

3231
# Don't run ClangImporter tests if Clangimporter is disabled.
3332
@skipIf(setting=('symbols.use-swift-clangimporter', 'false'))
34-
@skipIf(setting=('symbols.swift-precise-compiler-invocation', 'true'))
33+
@skipIf(setting=('symbols.swift-precise-compiler-invocation', 'false'))
3534
@skipUnlessDarwin
3635
@swiftTest
3736
@skipIf(debug_info=no_match(["dsym"]))
@@ -88,47 +87,16 @@ def dotest(self, remap):
8887
self.expect("expression foo", error=True)
8988

9089
# Scan through the types log.
91-
errs = 0
92-
found_iquote = 0
93-
found_f = 0
94-
found_i1 = 0
95-
found_i2 = 0
96-
found_rel = 0
97-
found_abs = 0
98-
found_ovl = 0
99-
in_scratch_context = False
100-
import io
101-
logfile = io.open(log, "r", encoding='utf-8')
102-
for line in logfile:
103-
self.assertFalse("remapped -iquote" in line)
104-
if "error: " in line and "Foo" in line:
105-
errs += 1
106-
continue
107-
if line.startswith(" SwiftASTContextForExpressions"):
108-
in_scratch_context = True
109-
if " remapped " in line:
110-
if line[:-1].endswith('/user'):
111-
found_abs += 1;
112-
continue
113-
if not in_scratch_context:
114-
continue
115-
if 'user/iquote-path' in line: found_iquote += 1; continue
116-
if 'user/I-single' in line: found_i1 += 1; continue
117-
if 'user/I-double' in line: found_i2 += 1; continue
118-
if './iquote-path' in line: found_rel += 1; continue
119-
if './I-' in line: found_rel += 1; continue
120-
if '/user/Frameworks' in line: found_f += 1; continue
121-
if 'user/Foo/overlay.yaml' in line: found_ovl += 1; continue
122-
123-
if remap:
124-
self.assertEqual(errs, 0, "expected no module import error")
125-
# Counting occurences in the scratch context.
126-
self.assertEqual(found_iquote, 3)
127-
self.assertEqual(found_i1, 3)
128-
self.assertEqual(found_i2, 3)
129-
self.assertEqual(found_f, 3)
130-
self.assertEqual(found_rel, 0)
131-
self.assertEqual(found_abs, 1)
132-
self.assertEqual(found_ovl, 3)
133-
else:
134-
self.assertGreater(errs, 0, "expected module import error")
90+
suffix = "REMAP" if remap else "NORMAL"
91+
self.filecheck('platform shell cat "%s"' % log, __file__,
92+
'--check-prefix=CHECK_' + suffix)
93+
# CHECK_REMAP-NOT: remapped -iquote
94+
# CHECK_REMAP-NOT: error:{{.*}}Foo
95+
# CHECK_NORMAL: error:{{.*}}Foo
96+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/Foo{{.*}} -> {{.*}}/user/Foo
97+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/iquote-path{{.*}} -> {{.*}}/user/iquote-path
98+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/I-double{{.*}} -> {{.*}}/user/I-double
99+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/I-single{{.*}} -> {{.*}}/user/I-single
100+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/Frameworks{{.*}} -> {{.*}}/user/Frameworks
101+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/nonexisting-rootdir{{.*}} -> {{.*}}/user
102+
# CHECK_REMAP-DAG: SwiftASTContextForExpressions(module: "Foo"{{.*}}/buildbot/Foo/overlay.yaml{{.*}} -> {{.*}}/user/Foo/overlay.yaml

0 commit comments

Comments
 (0)