mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[test] Update ParseableInterface to ModuleInterface
Also remove uses of -emit-parseable-module-interface from tests
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
// RUN: %empty-directory(%t/PrebuiltCache)
|
||||
|
||||
// 1. Create a dummy module
|
||||
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
||||
|
||||
// 2. Create an interface for it
|
||||
// RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5
|
||||
|
||||
// 3. Create an empty .swiftmodule, which will force recompiling from the interface
|
||||
// RUN: touch %t/Build/TestModule.swiftmodule
|
||||
|
||||
// 4. Try to import the malformed compiled module
|
||||
// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache
|
||||
|
||||
import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}}
|
||||
// expected-note @-1 {{is out of date}}
|
||||
// expected-note @-2 {{malformed}}
|
||||
@@ -0,0 +1,31 @@
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
|
||||
// 1. Create a dummy module
|
||||
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
||||
|
||||
// 2. Create both an interface and a compiled module for it
|
||||
// RUN: %target-swift-frontend -emit-module -o %t/Build/TestModule.swiftmodule %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5 -module-name TestModule
|
||||
|
||||
// 3. Make the compiled module unreadable so it gets added as a dependency but is not used
|
||||
// RUN: mv %t/Build/TestModule.swiftmodule %t/Build/TestModule.swiftmodule.moved-aside
|
||||
// RUN: echo 'this is unreadable' > %t/Build/TestModule.swiftmodule
|
||||
|
||||
// 4. Try to import the module, which will create a cached module that depends on both the .swiftmodule and .swiftinterface
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -module-cache-path %t/ModuleCache
|
||||
|
||||
// 5. Remove the .swiftmodule, which will result in a missing dependency note
|
||||
// RUN: rm %t/Build/TestModule.swiftmodule
|
||||
|
||||
// 6. Rebuild with remarks enabled, make sure the missing dependency note is emitted
|
||||
// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache
|
||||
|
||||
// 7. Put the module back, make the interface unreadable, and make sure the compiler succeeds
|
||||
// RUN: mv %t/Build/TestModule.swiftmodule.moved-aside %t/Build/TestModule.swiftmodule
|
||||
// RUN: mv %t/Build/TestModule.swiftinterface %t/Build/TestModule.swiftinterface.moved-aside
|
||||
// RUN: echo 'this is unreadable' > %t/Build/TestModule.swiftinterface
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache
|
||||
|
||||
import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}}
|
||||
// expected-note @-1 {{cached module is out of date}}
|
||||
// expected-note @-2 {{dependency is missing}}
|
||||
@@ -0,0 +1,24 @@
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
|
||||
// 1. Create a dummy module
|
||||
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
||||
|
||||
// 2. Create an interface for it
|
||||
// RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5
|
||||
|
||||
// 3. Try to import the interface, which will pass and create a cached module
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -module-cache-path %t/ModuleCache
|
||||
|
||||
// 3a. Make sure the test works on a fast machine
|
||||
// RUN: sleep 1
|
||||
|
||||
// 4. Touch the interface so the cached module is no longer up-to-date
|
||||
// RUN: %{python} %S/../Inputs/make-old.py %t/Build/TestModule.swiftinterface
|
||||
|
||||
// 5. Try to import the now out-of-date cached module
|
||||
// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache
|
||||
|
||||
import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}}
|
||||
// expected-note @-1 {{cached module is out of date}}
|
||||
// expected-note @-2 {{dependency is out of date}}
|
||||
@@ -0,0 +1,24 @@
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
|
||||
// 1. Create a dummy module
|
||||
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
||||
|
||||
// 2. Create an interface for it
|
||||
// RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5
|
||||
|
||||
// 3. Build the .swiftinterface to a .swiftmodule, which will have a dependency on the interface
|
||||
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Build/TestModule.swiftmodule %t/Build/TestModule.swiftinterface
|
||||
|
||||
// 3a. Make sure the test works on a fast machine
|
||||
// RUN: sleep 1
|
||||
|
||||
// 4. Touch the interface so the module is no longer up-to-date
|
||||
// RUN: %{python} %S/../Inputs/make-old.py %t/Build/TestModule.swiftinterface
|
||||
|
||||
// 5. Try to import the out-of-date compiled module
|
||||
// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache
|
||||
|
||||
import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}}
|
||||
// expected-note @-1 {{compiled module is out of date}}
|
||||
// expected-note @-2 {{dependency is out of date}}
|
||||
@@ -0,0 +1,32 @@
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
// RUN: %empty-directory(%t/PrebuiltCache)
|
||||
|
||||
// 1. Create a dummy module
|
||||
// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift
|
||||
|
||||
// 2. Create an interface for it
|
||||
// RUN: %target-swift-frontend -typecheck %t/TestModule.swift -emit-module-interface-path %t/Build/TestModule.swiftinterface -swift-version 5
|
||||
|
||||
// 3. Build the .swiftinterface to a .swiftmodule in the prebuilt cache, which will have a dependency on the interface
|
||||
// RUN: %target-swift-frontend -compile-module-from-interface %t/Build/TestModule.swiftinterface -o %t/PrebuiltCache/TestModule.swiftmodule
|
||||
|
||||
// 5. Try to import the prebuilt module (this should pass)
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -sdk %t -prebuilt-module-cache-path %t/PrebuiltCache -module-cache-path %t/ModuleCache
|
||||
|
||||
// 6. Make sure we installed a forwarding module in the cache
|
||||
// RUN: %{python} %S/../Inputs/check-is-forwarding-module.py %t/ModuleCache/TestModule-*.swiftmodule
|
||||
|
||||
// 7. Modify the interface so the forwarding module and prebuilt modules are no longer up-to-date
|
||||
// RUN: echo ' ' >> %t/Build/TestModule.swiftinterface
|
||||
|
||||
// 8. Try to import the now out-of-date forwarding module, which will fail.
|
||||
// It will also fail to load the prebuilt module after the forwarding module
|
||||
// is rejected, meaning we'll get a second set of notes about the prebuilt module.
|
||||
// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -sdk %t -prebuilt-module-cache-path %t/PrebuiltCache -module-cache-path %t/ModuleCache
|
||||
|
||||
import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}}
|
||||
// expected-note @-1 {{forwarding module is out of date}}
|
||||
// expected-note @-2 {{dependency is out of date}}
|
||||
// expected-note @-3 {{prebuilt module is out of date}}
|
||||
// expected-note @-4 {{dependency is out of date}}
|
||||
@@ -0,0 +1,24 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %empty-directory(%t/Build)
|
||||
// RUN: %empty-directory(%t/ModuleCache)
|
||||
|
||||
// 1. Create a module called InnerModule, and put its interface into the build dir.
|
||||
// RUN: echo 'public func inInnerModule() {}' | %target-swift-frontend - -typecheck -emit-module-interface-path %t/Build/InnerModule.swiftinterface -enable-library-evolution -swift-version 5 -module-name InnerModule
|
||||
|
||||
// 2. Build the .swiftinterface to a .swiftmodule, which will have a dependency on the interface
|
||||
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Build/InnerModule.swiftmodule %t/Build/InnerModule.swiftinterface
|
||||
|
||||
// 3. Touch the interface so the module becomes out of date.
|
||||
// RUN: %{python} %S/../Inputs/make-old.py %t/Build/InnerModule.swiftinterface
|
||||
|
||||
// 4. Create a module called OuterModule that imports InnerModule, and put its interface into the build dir.
|
||||
// RUN: echo 'import InnerModule' | %target-swift-frontend - -emit-module -o %t/Build/OuterModule.swiftmodule -module-name OuterModule -I %t/Build
|
||||
|
||||
// 5. Build this file, and expect that InnerModule is out of date
|
||||
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache 2>&1 | %FileCheck %s
|
||||
|
||||
import OuterModule
|
||||
|
||||
// CHECK: rebuilding module 'InnerModule' from interface '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftinterface'
|
||||
// CHECK: compiled module is out of date: '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftmodule'
|
||||
// CHECK: dependency is out of date: '{{.*}}{{[/\\]}}Build{{[/\\]}}InnerModule.swiftinterface'
|
||||
Reference in New Issue
Block a user