Skip to content

Commit 8fbe42b

Browse files
committed
[NFC] remove test use of cmp to compare swiftmodules
In the test infrastructure, I was using the binary comparison tool `cmp` to check if the serialization of a module can be deserialized and reserialized to the exact same swiftmodule file. It turns out that bitwise equality on the emitted files is not guaranteed between those two methods of creating a swiftmodule file is not always guaranteed. Thus, this commit removes the uses of cmp to check for this fragile guarantee.
1 parent 79d45c0 commit 8fbe42b

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -disable-availability-checking -emit-module-path %t/a.swiftmodule -module-name a %s
3+
// RUN: llvm-bcanalyzer -dump %t/a.swiftmodule | %FileCheck --implicit-check-not UnknownCode %s
34
// RUN: %target-swift-ide-test -print-module -module-to-print a -source-filename x -I %t | %FileCheck -check-prefix MODULE-CHECK %s
4-
// RUN: %target-swift-frontend -disable-availability-checking -emit-module-path %t/b.swiftmodule -module-name a %t/a.swiftmodule
5-
// RUN: cmp -s %t/a.swiftmodule %t/b.swiftmodule
65

76
// REQUIRES: concurrency
87

@@ -14,7 +13,6 @@
1413

1514
// MODULE-CHECK: actor A {
1615
// MODULE-CHECK-NEXT: init() async
17-
1816
actor A {
1917
init() async {}
2018
}
@@ -25,20 +23,18 @@ class C {
2523
init() async {}
2624
}
2725

26+
// MODULE-CHECK: enum E {
27+
// MODULE-CHECK-NEXT: case nothing
28+
// MODULE-CHECK-NEXT: init() async
29+
enum E {
30+
case nothing
31+
init() async {
32+
self = .nothing
33+
}
34+
}
35+
2836
// MODULE-CHECK: struct S {
2937
// MODULE-CHECK-NEXT: init() async
3038
struct S {
3139
init() async {}
3240
}
33-
34-
// ignore-----MODULE-CHECK: enum E {
35-
// ignore-----MODULE-CHECK-NEXT: case nothing
36-
// ignore-----MODULE-CHECK-NEXT: init() async
37-
38-
// FIXME: until rdar://76678907 is fixed, this won't work.
39-
// enum E {
40-
// case nothing
41-
// init() async {
42-
// self = .nothing
43-
// }
44-
// }

test/Serialization/attr-actorindependent.swift renamed to test/Serialization/attr-nonisolated.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -disable-availability-checking -emit-module-path %t/a.swiftmodule -module-name a %s
3-
// RUN: llvm-bcanalyzer -dump %t/a.swiftmodule | %FileCheck -check-prefix BC-CHECK %s
4-
// RUN: %target-swift-ide-test -print-module -module-to-print a -source-filename x -I %t | %FileCheck -check-prefix MODULE-CHECK %s
5-
// RUN: %target-swift-frontend -disable-availability-checking -emit-module-path %t/b.swiftmodule -module-name a %t/a.swiftmodule
6-
// RUN: cmp -s %t/a.swiftmodule %t/b.swiftmodule
3+
// RUN: llvm-bcanalyzer -dump %t/a.swiftmodule | %FileCheck --check-prefix BC-CHECK --implicit-check-not UnknownCode %s
4+
// RUN: %target-swift-ide-test -print-module -module-to-print a -source-filename x -I %t | %FileCheck --check-prefix MODULE-CHECK %s
75

86
// REQUIRES: concurrency
97

@@ -21,7 +19,6 @@
2119

2220
// and look for nonisolated
2321

24-
// BC-CHECK-NOT: UnknownCode
2522
// BC-CHECK: <Nonisolated_DECL_ATTR abbrevid={{[0-9]+}} op0=0/>
2623

2724

test/Serialization/effectful_properties.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -emit-module-path %t/a.swiftmodule -module-name a %s -disable-availability-checking
3+
// RUN: llvm-bcanalyzer -dump %t/a.swiftmodule | %FileCheck --implicit-check-not UnknownCode %s
34
// RUN: %target-swift-ide-test -print-module -module-to-print a -source-filename x -I %t | %FileCheck -check-prefix MODULE-CHECK %s
4-
// RUN: %target-swift-frontend -emit-module-path %t/b.swiftmodule -module-name a %t/a.swiftmodule -disable-availability-checking
5-
// RUN: cmp -s %t/a.swiftmodule %t/b.swiftmodule
65

76
///////////
87
// This test checks for correct serialization & deserialization of

0 commit comments

Comments
 (0)