Skip to content

Commit 4b3ee94

Browse files
committed
Cleanup tests
1 parent 1d0c84c commit 4b3ee94

File tree

4 files changed

+27
-24
lines changed

4 files changed

+27
-24
lines changed

test/Frontend/module-alias-for-client.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
// RUN: %empty-directory(%t)
66
// RUN: %{python} %utils/split_file.py -o %t %s
77

8+
/// 1a. XLogging
89
/// Create XLogging.swiftmodule
910
// RUN: %target-swift-frontend -module-name XLogging %t/FileLogging.swift -emit-module -emit-module-path %t/XLogging.swiftmodule
1011
// RUN: test -f %t/XLogging.swiftmodule
1112

13+
/// 1b. AppleLogging
1214
/// Create AppleLogging.swiftmodule
1315
// RUN: %target-swift-frontend -module-name AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
1416
// RUN: test -f %t/AppleLogging.swiftmodule
1517

18+
/// 2. Lib
1619
/// Create module Lib that imports AppleLogging
1720
// RUN: %target-swift-frontend -module-name Lib %t/FileLib.swift -I %t -emit-module -emit-module-path %t/Lib.swiftmodule -Rmodule-loading 2> %t/result-Lib.output
1821

@@ -21,6 +24,7 @@
2124
// RUN: %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-Lib
2225
// CHECK-Lib: remark: loaded module at {{.*}}AppleLogging.swiftmodule
2326

27+
/// 3a. Client1
2428
/// Create module Client1 that imports Lib and XLogging, WITHOUT module aliasing for XLogging
2529
// RUN: %target-swift-frontend -module-name Client1 %t/FileClient.swift -I %t -emit-module -emit-module-path %t/Client1.swiftmodule -Rmodule-loading 2> %t/result-Client1.output
2630

@@ -30,6 +34,7 @@
3034
// CHECK-1: remark: loaded module at {{.*}}XLogging.swiftmodule
3135
// CHECK-1: remark: loaded module at {{.*}}Lib.swiftmodule
3236

37+
/// 3b. Client2
3338
/// Create a module Client2 that imports Lib and XLogging, WITH module aliasing for XLogging
3439
// RUN: %target-swift-frontend -module-name Client2 -module-alias XLogging=AppleLogging %t/FileClient.swift -I %t -emit-module -emit-module-path %t/Client2.swiftmodule -Rmodule-loading 2> %t/result-Client2.output
3540

@@ -47,7 +52,7 @@
4752
public struct Logger {
4853
public init() {}
4954
}
50-
public func setup() -> XLogging.Logger? {
55+
public func setup() -> Logger? {
5156
return Logger()
5257
}
5358

test/Frontend/module-alias-for-lib-and-client.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
// RUN: %empty-directory(%t)
66
// RUN: %{python} %utils/split_file.py -o %t %s
77

8+
/// 1. AppleLogging
89
/// Create AppleLogging.swiftmodule by aliasing XLogging via -module-alias XLogging=AppleLogging
910
// RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
1011

1112
/// Check AppleLogging.swiftmodule is created
1213
// RUN: test -f %t/AppleLogging.swiftmodule
1314
// RUN: not test -f %t/XLogging.swiftmodule
1415

16+
/// 2. Lib
1517
/// Create a module Lib that imports XLogging WITH -module-alias XLogging=AppleLogging
1618
// RUN: %target-swift-frontend -module-name Lib %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t -emit-module -emit-module-path %t/Lib.swiftmodule -Rmodule-loading 2> %t/result-Lib.output
1719

@@ -25,6 +27,7 @@
2527
// RUN: not %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-NOT-Lib
2628
// CHECK-NOT-Lib: remark: loaded module at {{.*}}XLogging.swiftmodule
2729

30+
/// 3a. Client1
2831
/// Create module Client1 that imports Lib and XLogging, WITH module aliasing for XLogging
2932
// RUN: %target-swift-frontend -module-name Client1 %t/FileClient.swift -module-alias XLogging=AppleLogging -I %t -emit-module -emit-module-path %t/Client1.swiftmodule -Rmodule-loading -Rmodule-loading 2> %t/result-Client1.output
3033

@@ -39,13 +42,15 @@
3942
// RUN: not %FileCheck %s -input-file %t/result-Client1.output -check-prefix CHECK-NOT-CLIENT1
4043
// CHECK-NOT-CLIENT1: remark: loaded module at {{.*}}XLogging.swiftmodule
4144

45+
/// 3b. Client2
4246
/// Try creating module Client2 that imports Lib and XLogging, WITHOUT module aliasing
4347
// RUN: not %target-swift-frontend -module-name Client2 %t/FileClient.swift -I %t -emit-module -emit-module-path %t/Client2.swiftmodule 2> %t/result-Client2.output
4448

4549
/// Check that it fails
4650
// RUN: %FileCheck %s -input-file %t/result-Client2.output -check-prefix CHECK-CLIENT2
4751
// CHECK-CLIENT2: {{.*}}error: no such module 'XLogging'
4852

53+
/// 3c. Client3
4954
/// Create module Client3 that imports Lib and AppleLogging, WITHOUT module aliasing
5055
// RUN: %target-swift-frontend -module-name Client3 %t/FileClientOther.swift -I %t -emit-module -emit-module-path %t/Client3.swiftmodule -Rmodule-loading 2> %t/result-Client3.output
5156

test/Frontend/module-alias-serialize-swiftinterface.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// RUN: %empty-directory(%t)
66
// RUN: %{python} %utils/split_file.py -o %t %s
77

8+
/// 1. AppleLogging
89
/// Create AppleLogging.swiftmodule by aliasing XLogging via -module-alias XLogging=AppleLogging
910
// RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule -enable-library-evolution
1011

@@ -16,11 +17,11 @@
1617
// RUN: llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-FOUND
1718
// BCANALYZER-FOUND: MODULE_NAME{{.*}}AppleLogging
1819

19-
// RUN: not llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-NOT-FOUND
20-
// BCANALYZER-NOT-FOUND: MODULE_NAME{{.*}}XLogging
20+
// RUN: llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | not grep XLogging
2121

22+
/// 2. Lib
2223
/// Create an interface for Lib that imports XLogging with -module-alias XLogging=AppleLogging
23-
// RUN: %target-swift-frontend -module-name Lib %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t -emit-module -emit-module-path %t/Lib.swiftmodule -swift-version 5 -enable-library-evolution -I %t -Rmodule-loading 2> %t/result-Lib.output
24+
// RUN: %target-swift-frontend -module-name Lib %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t -emit-module -emit-module-interface-path %t/Lib.swiftinterface -swift-version 5 -enable-library-evolution -I %t -Rmodule-loading 2> %t/result-Lib.output
2425

2526
/// Check Lib.swiftinterface is created
2627
// RUN: test -f %t/Lib.swiftinterface
@@ -30,16 +31,13 @@
3031
/// Check AppleLogging.swiftmodule is loaded
3132
// RUN: %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-LOAD
3233
// CHECK-LOAD: remark: loaded module at {{.*}}AppleLogging.swiftmodule
33-
34-
/// Check XLogging.swiftmodule is not loaded
35-
// RUN: not %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-NOT-LOAD
36-
// CHECK-NOT-LOAD: remark: loaded module at {{.*}}XLogging.swiftmodule
34+
// RUN: not %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-NOT-LOAD1
35+
// CHECK-NOT-LOAD1: remark: loaded module at {{.*}}XLogging.swiftmodule
3736

3837
/// Check imported modules contain AppleLogging, not XLogging
3938
// RUN: %FileCheck %s -input-file %t/Lib.swiftinterface -check-prefix CHECK-IMPORT
4039
// CHECK-IMPORT: -module-alias XLogging=AppleLogging
4140
// CHECK-IMPORT: import AppleLogging
42-
4341
// RUN: not %FileCheck %s -input-file %t/Lib.swiftinterface -check-prefix CHECK-NOT-IMPORT
4442
// CHECK-NOT-IMPORT: import XLogging
4543

test/Frontend/module-alias-serialize-swiftmodule.swift

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %empty-directory(%t)
77
// RUN: %{python} %utils/split_file.py -o %t %s
88

9+
/// 1. AppleLogging
910
/// Create AppleLogging.swiftmodule by aliasing XLogging via -module-alias XLogging=AppleLogging
1011
// RUN: %target-swift-frontend -module-name AppleLogging -module-alias XLogging=AppleLogging %t/FileLogging.swift -emit-module -emit-module-path %t/AppleLogging.swiftmodule
1112

@@ -17,34 +18,31 @@
1718
// RUN: llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-FOUND
1819
// BCANALYZER-FOUND: MODULE_NAME{{.*}}AppleLogging
1920

20-
// RUN: not llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-NOT-FOUND
21-
// BCANALYZER-NOT-FOUND: MODULE_NAME{{.*}}XLogging
21+
// RUN: llvm-bcanalyzer --dump %t/AppleLogging.swiftmodule | not grep XLogging
2222

23-
/// Create module Lib that imports XLogging with -module-alias XLogging=AppleLogging
23+
/// 2. Lib
24+
/// Create module Lib that imports XLogging WITH -module-alias XLogging=AppleLogging
2425
// RUN: %target-swift-frontend -module-name Lib %t/FileLib.swift -module-alias XLogging=AppleLogging -I %t -emit-module -emit-module-path %t/Lib.swiftmodule -Rmodule-loading 2> %t/result-Lib.output
2526

2627
/// Check Lib.swiftmodule is created
2728
// RUN: test -f %t/Lib.swiftmodule
2829
// RUN: test -f %t/AppleLogging.swiftmodule
2930
// RUN: not test -f %t/XLogging.swiftmodule
3031

31-
/// Check AppleLogging.swiftmodule is loaded
32+
/// Check AppleLogging.swiftmodule is loaded, and XLogging.swiftmodule is not loaded
3233
// RUN: %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-LOAD1
3334
// CHECK-LOAD1: remark: loaded module at {{.*}}AppleLogging.swiftmodule
34-
35-
/// Check XLogging.swiftmodule is not loaded
3635
// RUN: not %FileCheck %s -input-file %t/result-Lib.output -check-prefix CHECK-NOT-LOAD1
3736
// CHECK-NOT-LOAD1: remark: loaded module at {{.*}}XLogging.swiftmodule
3837

39-
/// Check Lib.swiftmodule contains AppleLogging and not XLogging as an imported module
38+
/// Check Lib.swiftmodule contains AppleLogging and NOT XLogging as an imported module
4039
/// in the binary
4140
// RUN: llvm-bcanalyzer --dump %t/Lib.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-IMPORT1
4241
// BCANALYZER-IMPORT1: IMPORTED_MODULE{{.*}}AppleLogging
42+
// RUN: llvm-bcanalyzer --dump %t/Lib.swiftmodule | not grep XLogging
4343

44-
// RUN: llvm-bcanalyzer --dump %t/Lib.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-NOT-IMPORT1
45-
// BCANALYZER-NOT-IMPORT1: IMPORTED_MODULE{{.*}}XLogging
46-
47-
/// Create a module Client that imports Lib, without module aliasing for XLogging
44+
/// 3. Client
45+
/// Create a module Client that imports Lib, WITHOUT module aliasing for XLogging
4846
// RUN: %target-swift-frontend -module-name Client %t/FileClient.swift -I %t -emit-module -emit-module-path %t/Client.swiftmodule -Rmodule-loading 2> %t/result-Client.output
4947

5048
/// Check Client.swiftmodule is created and Lib.swiftmodule and AppleLogging.swiftmodule are loaded
@@ -59,6 +57,7 @@
5957
/// Check Client.swiftmodule contains Lib as an imported module in the binary
6058
// RUN: llvm-bcanalyzer --dump %t/Client.swiftmodule | %FileCheck %s -check-prefix=BCANALYZER-IMPORT2
6159
// BCANALYZER-IMPORT2: IMPORTED_MODULE{{.*}}Lib
60+
// RUN: llvm-bcanalyzer --dump %t/Client.swiftmodule | not grep XLogging
6261

6362

6463
// BEGIN FileLogging.swift
@@ -77,11 +76,7 @@ public func start() {
7776
}
7877

7978
// BEGIN FileClient.swift
80-
import XLogging
8179
import Lib
8280
public func rubLib() {
8381
Lib.start()
8482
}
85-
public func runLog() {
86-
_ = XLogging.setup()
87-
}

0 commit comments

Comments
 (0)