[Tests] Stabilize output order maps against incidental changes

The output file map is created in DenseMap order, which is an unordered
and "unstable" collection type.
This commit is contained in:
David Zarzycki
2019-03-18 07:22:23 -04:00
parent 5ca9ddc7f1
commit d2c5597707
3 changed files with 13 additions and 11 deletions

View File

@@ -123,6 +123,7 @@ void OutputFileMap::write(llvm::raw_ostream &os,
}
os << "\n";
// DenseMap is unordered. If you write a test, please sort the output.
for (auto &typeAndOutputPath : *outputMap) {
file_types::ID type = typeAndOutputPath.getFirst();
StringRef output = typeAndOutputPath.getSecond();

View File

@@ -56,7 +56,8 @@ if '-supplementary-output-file-map' in sys.argv:
supplementaryOutputMapFile = \
sys.argv[sys.argv.index('-supplementary-output-file-map') + 1]
with open(supplementaryOutputMapFile, 'r') as f:
lines = f.readlines()
# The output is in DenseMap order, which is unstable, therefore sort.
lines = sorted(f.readlines())
for line in lines:
print("Supplementary", line.rstrip())

View File

@@ -6,17 +6,17 @@
// CHECK-NOT: Handled
// CHECK: Handled a.swift
// CHECK-NEXT: Supplementary "./a.swift":
// CHECK-NEXT: Supplementary swiftmodule: "./a.swiftmodule"
// CHECK-NEXT: Supplementary swiftdoc: "./a.swiftdoc"
// CHECK-NEXT: Supplementary swiftmodule: "./a.swiftmodule"
// CHECK-NEXT: Supplementary "./a.swift":
// CHECK-NEXT: Handled b.swift
// CHECK-NEXT: Supplementary "./b.swift":
// CHECK-NEXT: Supplementary swiftmodule: "./b.swiftmodule"
// CHECK-NEXT: Supplementary swiftdoc: "./b.swiftdoc"
// CHECK-NEXT: Supplementary swiftmodule: "./b.swiftmodule"
// CHECK-NEXT: Supplementary "./b.swift":
// CHECK-NEXT: Handled c.swift
// CHECK-NEXT: Supplementary "./c.swift":
// CHECK-NEXT: Supplementary swiftmodule: "./c.swiftmodule"
// CHECK-NEXT: Supplementary swiftdoc: "./c.swiftdoc"
// CHECK-NEXT: Supplementary swiftmodule: "./c.swiftmodule"
// CHECK-NEXT: Supplementary "./c.swift":
// CHECK-NEXT: Handled modules
// CHECK-NOT: Handled
@@ -26,8 +26,8 @@
// CHECK-WMO-NOT: Handled
// CHECK-WMO: Handled all
// CHECK-WMO: Supplementary "{{.*}}/a.swift":
// CHECK-WMO: Supplementary object: "main.o"
// CHECK-WMO: Supplementary "{{.*}}/a.swift":
// CHECK-WMO-NOT: output
// CHECK-WMO-NOT: Handled
@@ -43,12 +43,12 @@
// CHECK-WMO-THREADED-NOT: Handled
// CHECK-WMO-THREADED: Handled all
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/a.swift":
// CHECK-WMO-THREADED-NEXT: Supplementary {{object|llvm-bc}}: "{{.*}}/a.{{o|bc}}"
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/b.swift":
// CHECK-WMO-THREADED-NEXT: Supplementary {{object|llvm-bc}}: "{{.*}}/b.{{o|bc}}"
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/c.swift":
// CHECK-WMO-THREADED-NEXT: Supplementary {{object|llvm-bc}}: "{{.*}}/c.{{o|bc}}"
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/a.swift":
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/b.swift":
// CHECK-WMO-THREADED-NEXT: Supplementary "{{.*}}/c.swift":
// CHECK-WMO-THREADED-NEXT: ...with output!
// CHECK-WMO-THREADED-NOT: Handled