Skip to content

Commit 9d7d668

Browse files
committed
[ModuleInterface] Compensate for silly source of order variation in .d files.
1 parent 8959923 commit 9d7d668

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

test/ParseableInterface/ModuleCache/module-cache-init.swift

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,36 @@
3838
// RUN: test -f %t/modulecache/OtherModule-*.swiftmodule
3939
// RUN: test -f %t/TestModule.d
4040
// RUN: llvm-bcanalyzer -dump %t/modulecache/OtherModule-*.swiftmodule | %FileCheck %s -check-prefix=CHECK-OTHERMODULE
41-
// RUN: %FileCheck %s -check-prefix=CHECK-DEPENDS <%t/TestModule.d
4241
// CHECK-OTHERMODULE: {{MODULE_NAME.*blob data = 'OtherModule'}}
4342
// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*Swift.swiftmodule'}}
4443
// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*SwiftOnoneSupport.swiftmodule'}}
4544
// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*LeafModule.swiftinterface'}}
4645
// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*LeafModule-.*.swiftmodule'}}
4746
// CHECK-OTHERMODULE: {{FILE_DEPENDENCY.*OtherModule.swiftinterface'}}
4847
// CHECK-OTHERMODULE: FUNC_DECL
48+
//
49+
// Quirk: because the cached .swiftmodules have a hash name component that
50+
// integrates target, and we sort the contents of lines in a .d file by the
51+
// dependency's reverse-name (for reasons), the order in which the cached
52+
// .swiftmodules are listed in the .d file will vary _by target_.
53+
//
54+
// So we cannot write a single set of CHECK-SAME lines here that will work
55+
// for all targets: some will have LeafModule first, some OtherModule
56+
// first. So instead, we write two sets of patterns, and run FileCheck
57+
// twice. Yes this is silly.
58+
//
59+
// RUN: %FileCheck %s -check-prefix=CHECK-DEPENDS <%t/TestModule.d
60+
// RUN: %FileCheck %s -check-prefix=CHECK-DEPENDSAGAIN <%t/TestModule.d
61+
//
4962
// CHECK-DEPENDS: TestModule.swiftmodule :
5063
// CHECK-DEPENDS-SAME: LeafModule.swiftinterface
5164
// CHECK-DEPENDS-SAME: OtherModule.swiftinterface
52-
// CHECK-DEPENDS-SAME: {{LeafModule-[^ ]+.swiftmodule}}
5365
// CHECK-DEPENDS-SAME: {{OtherModule-[^ ]+.swiftmodule}}
5466
// CHECK-DEPENDS-SAME: Swift.swiftmodule
5567
// CHECK-DEPENDS-SAME: SwiftOnoneSupport.swiftmodule
68+
//
69+
// CHECK-DEPENDSAGAIN: TestModule.swiftmodule :
70+
// CHECK-DEPENDSAGAIN-SAME: {{LeafModule-[^ ]+.swiftmodule}}
5671

5772
import OtherModule
5873

0 commit comments

Comments
 (0)