|
| 1 | +// swift-interface-format-version: 1.0 |
| 2 | +// swift-module-flags: -module-name SystemDependencies |
| 3 | + |
| 4 | +// RUN: %empty-directory(%t) |
| 5 | +// RUN: cp -r %S/Inputs/mock-sdk %t/mock-sdk |
| 6 | + |
| 7 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP -emit-dependencies-path %t/dummy.d |
| 8 | +// RUN: test -f %t/MCP/SystemDependencies*.swiftmodule |
| 9 | +// RUN: %FileCheck -check-prefix NEGATIVE %s < %t/dummy.d |
| 10 | +// RUN: %{python} %S/Inputs/make-old.py %t/MCP/SystemDependencies*.swiftmodule |
| 11 | + |
| 12 | +// Baseline: running the same command again doesn't rebuild the cached module. |
| 13 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP -emit-dependencies-path %t/dummy.d |
| 14 | +// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP/SystemDependencies*.swiftmodule |
| 15 | + |
| 16 | +// Now try changing the contents. |
| 17 | +// RUN: echo "// size change" >> %t/mock-sdk/usr/include/SomeCModule.h |
| 18 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP -emit-dependencies-path %t/dummy.d |
| 19 | +// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP/SystemDependencies*.swiftmodule |
| 20 | + |
| 21 | +// Okay, now let's try again with system dependency tracking on. |
| 22 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP-system -emit-dependencies-path %t/dummy.d -track-system-dependencies |
| 23 | +// RUN: test -f %t/MCP-system/SystemDependencies*.swiftmodule |
| 24 | +// RUN: %FileCheck -check-prefix CHECK %s < %t/dummy.d |
| 25 | +// RUN: %{python} %S/Inputs/make-old.py %t/MCP-system/SystemDependencies*.swiftmodule |
| 26 | + |
| 27 | +// Baseline: running the same command again doesn't rebuild the cached module. |
| 28 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP-system -emit-dependencies-path %t/dummy.d -track-system-dependencies |
| 29 | +// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP-system/SystemDependencies*.swiftmodule |
| 30 | + |
| 31 | +// Now try changing the contents. |
| 32 | +// RUN: echo "// size change" >> %t/mock-sdk/usr/include/SomeCModule.h |
| 33 | +// RUN: echo 'import SystemDependencies' | %target-swift-frontend -typecheck - -I %S -sdk %t/mock-sdk -module-cache-path %t/MCP-system -emit-dependencies-path %t/dummy.d -track-system-dependencies |
| 34 | +// RUN: %{python} %S/Inputs/check-is-new.py %t/MCP-system/SystemDependencies*.swiftmodule |
| 35 | + |
| 36 | +// Check that it picked a different cache key. |
| 37 | +// RUN: %empty-directory(%t/MCP-combined) |
| 38 | +// RUN: cp -n %t/MCP/SystemDependencies*.swiftmodule %t/MCP-combined |
| 39 | +// RUN: cp -n %t/MCP-system/SystemDependencies*.swiftmodule %t/MCP-combined |
| 40 | + |
| 41 | +// NEGATIVE-NOT: SomeCModule.h |
| 42 | +// CHECK: SomeCModule.h |
| 43 | + |
| 44 | +import SomeCModule |
0 commit comments