|
| 1 | +// RUN: %empty-directory(%t/ModuleCache) |
| 2 | +// RUN: %empty-directory(%t/Build) |
| 3 | + |
| 4 | +// 1. Create a dummy module |
| 5 | +// RUN: echo 'public func publicFunction() {}' > %t/TestModule.swift |
| 6 | + |
| 7 | +// 2. Create both an interface and a compiled module for it |
| 8 | +// 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 |
| 9 | + |
| 10 | +// 3. Make the compiled module unreadable so it gets added as a dependency but is not used |
| 11 | +// RUN: mv %t/Build/TestModule.swiftmodule %t/Build/TestModule.swiftmodule.moved-aside |
| 12 | +// RUN: echo 'this is unreadable' > %t/Build/TestModule.swiftmodule |
| 13 | + |
| 14 | +// 4. Try to import the module, which will create a cached module that depends on both the .swiftmodule and .swiftinterface |
| 15 | +// RUN: %target-swift-frontend -typecheck %s -I %t/Build -module-cache-path %t/ModuleCache |
| 16 | + |
| 17 | +// 5. Remove the .swiftmodule, which will result in a missing dependency note |
| 18 | +// RUN: rm %t/Build/TestModule.swiftmodule |
| 19 | + |
| 20 | +// 6. Rebuild with remarks enabled, make sure the missing dependency note is emitted |
| 21 | +// RUN: %target-swift-frontend -typecheck -verify %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache |
| 22 | + |
| 23 | +// 7. Put the module back, make the interface unreadable, and make sure the compiler succeeds |
| 24 | +// RUN: mv %t/Build/TestModule.swiftmodule.moved-aside %t/Build/TestModule.swiftmodule |
| 25 | +// RUN: mv %t/Build/TestModule.swiftinterface %t/Build/TestModule.swiftinterface.moved-aside |
| 26 | +// RUN: echo 'this is unreadable' > %t/Build/TestModule.swiftinterface |
| 27 | +// RUN: %target-swift-frontend -typecheck %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache |
| 28 | + |
| 29 | +import TestModule // expected-remark {{rebuilding module 'TestModule' from interface}} |
| 30 | +// expected-note @-1 {{cached module is out of date}} |
| 31 | +// expected-note @-2 {{dependency is missing}} |
0 commit comments