Skip to content

Commit d2983bf

Browse files
committed
[Test] Use a clean module cache for more tests
Use a clean module cache in tests printing path to the swiftmodule/swiftinterface used as it may change depending on previous tests.
1 parent 3398812 commit d2983bf

6 files changed

+21
-14
lines changed

test/Driver/loaded_module_trace.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -emit-module -module-name Module %S/Inputs/loaded_module_trace_empty.swift -o %t/Module.swiftmodule
3-
// RUN: %target-build-swift -emit-module -module-name Module2 %S/Inputs/loaded_module_trace_imports_module.swift -o %t/Module2.swiftmodule -I %t
4-
// RUN: %target-build-swift %s -emit-loaded-module-trace -o %t/loaded_module_trace -I %t
2+
// RUN: %empty-directory(%t/cache)
3+
// RUN: %target-build-swift -emit-module -module-name Module %S/Inputs/loaded_module_trace_empty.swift -o %t/Module.swiftmodule -module-cache-path %t/cache
4+
// RUN: %target-build-swift -emit-module -module-name Module2 %S/Inputs/loaded_module_trace_imports_module.swift -o %t/Module2.swiftmodule -I %t -module-cache-path %t/cache
5+
// RUN: %target-build-swift %s -emit-loaded-module-trace -o %t/loaded_module_trace -I %t -module-cache-path %t/cache
56
// RUN: %FileCheck -check-prefix=CHECK %s < %t/loaded_module_trace.trace.json
67
// RUN: %FileCheck -check-prefix=CHECK-CONFIRM-ONELINE %s < %t/loaded_module_trace.trace.json
78

test/Driver/loaded_module_trace_env.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// RUN: rm -f %t
2-
// RUN: env SWIFT_LOADED_MODULE_TRACE_FILE=%t %target-build-swift -module-name loaded_module_trace_env -c %s -o- > /dev/null
3-
// RUN: %FileCheck %s < %t
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/cache)
3+
// RUN: env SWIFT_LOADED_MODULE_TRACE_FILE=%t/trace %target-build-swift -module-name loaded_module_trace_env -c %s -o- -module-cache-path %t/cache > /dev/null
4+
// RUN: %FileCheck %s < %t/trace
45

56
// CHECK: {
67
// CHECK: "version":2

test/Driver/loaded_module_trace_foundation.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %target-build-swift -o %t -module-name loaded_module_trace_foundation %s -emit-loaded-module-trace -emit-loaded-module-trace-path - 2>&1 | %FileCheck %s
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/cache)
3+
// RUN: %target-build-swift -o %t/trace -module-name loaded_module_trace_foundation %s -emit-loaded-module-trace -emit-loaded-module-trace-path - -module-cache-path %t/cache 2>&1 | %FileCheck %s
24

35
// REQUIRES: objc_interop
46

test/Driver/loaded_module_trace_header.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// RUN: rm -f %t
2-
// RUN: env SWIFT_LOADED_MODULE_TRACE_FILE=%t %target-build-swift -module-name loaded_module_trace_header -c %s -o- -import-objc-header %S/Inputs/loaded_module_trace_header.h > /dev/null
3-
// RUN: %FileCheck %s < %t
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/cache)
3+
// RUN: env SWIFT_LOADED_MODULE_TRACE_FILE=%t/trace %target-build-swift -module-name loaded_module_trace_header -c %s -o- -import-objc-header %S/Inputs/loaded_module_trace_header.h -module-cache-path %t/cache > /dev/null
4+
// RUN: %FileCheck %s < %t/trace
45

56
// REQUIRES: objc_interop
67

test/Driver/loaded_module_trace_multifile.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %empty-directory(%t)
2-
// RUN: %target-build-swift -emit-module -module-name Module %S/Inputs/loaded_module_trace_empty.swift -o %t/Module.swiftmodule
3-
// RUN: %target-build-swift -emit-module -module-name Module2 %S/Inputs/loaded_module_trace_empty.swift -o %t/Module2.swiftmodule
4-
// RUN: %target-build-swift %s %S/Inputs/loaded_module_trace_imports_module.swift -emit-loaded-module-trace-path %t/multifile.trace.json -emit-library -o %t/loaded_module_trace_multifile -I %t
2+
// RUN: %empty-directory(%t/cache)
3+
// RUN: %target-build-swift -emit-module -module-name Module %S/Inputs/loaded_module_trace_empty.swift -o %t/Module.swiftmodule -module-cache-path %t/cache
4+
// RUN: %target-build-swift -emit-module -module-name Module2 %S/Inputs/loaded_module_trace_empty.swift -o %t/Module2.swiftmodule -module-cache-path %t/cache
5+
// RUN: %target-build-swift %s %S/Inputs/loaded_module_trace_imports_module.swift -emit-loaded-module-trace-path %t/multifile.trace.json -emit-library -o %t/loaded_module_trace_multifile -I %t -module-cache-path %t/cache
56
// RUN: %FileCheck %s < %t/multifile.trace.json
67

78
// This file only imports Module2, but the other file imports Module: hopefully they both appear!

test/ModuleInterface/loading-remarks.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/// Test the -Rmodule-loading flag.
22
// RUN: %empty-directory(%t)
3+
// RUN: %empty-directory(%t/cache)
34

45
/// Create a simple module and interface.
56
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
67
// RUN: %target-swift-emit-module-interface(%t/TestModule.swiftinterface) %t/TestModule.swift
78

89
/// Use -Rmodule-loading in a client and look for the diagnostics output.
9-
// RUN: %target-swift-frontend -typecheck %s -I %t -Rmodule-loading 2>&1 | %FileCheck %s
10+
// RUN: %target-swift-frontend -typecheck %s -I %t -Rmodule-loading -module-cache-path %t/cache 2>&1 | %FileCheck %s
1011

1112
import TestModule
1213
// CHECK: remark: loaded module at {{.*}}SwiftShims-{{.*}}.pcm

0 commit comments

Comments
 (0)