Files
swift-mirror/test/ParseableInterface/ModuleCache/SystemDependencies.swiftinterface
Jordan Rose b3c5a68acf [Serialization] Reduce file size by splitting dep dirnames from basenames
Dependency tracking for cached compiled modules (compiled from
swiftinterfaces) can lead to a high percentage of the module being
SDK-relative paths when -track-system-dependencies is on. Cut down on
this by storing directory names in a separate record that gets
referenced from each file dependency. (Since a lot of per-file
dependencies are header files in a common directory, this is a win.)

We can do something more clever in the future, but this is a
reasonable start for, say, the overlays.

rdar://problem/50449802
2019-05-04 10:47:46 -07:00

55 lines
3.1 KiB
Plaintext

// swift-interface-format-version: 1.0
// swift-module-flags: -module-name SystemDependencies
// RUN: %empty-directory(%t)
// RUN: cp -r %S/Inputs/mock-sdk %t/mock-sdk
// 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
// RUN: test -f %t/MCP/SystemDependencies*.swiftmodule
// RUN: %FileCheck -check-prefix NEGATIVE %s < %t/dummy.d
// RUN: %{python} %S/Inputs/make-old.py %t/MCP/SystemDependencies*.swiftmodule
// Baseline: running the same command again doesn't rebuild the cached module.
// 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
// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP/SystemDependencies*.swiftmodule
// Now try changing the contents.
// RUN: echo "// size change" >> %t/mock-sdk/usr/include/SomeCModule.h
// 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
// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP/SystemDependencies*.swiftmodule
// Okay, now let's try again with system dependency tracking on.
// 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
// RUN: test -f %t/MCP-system/SystemDependencies*.swiftmodule
// RUN: %FileCheck -check-prefix CHECK %s < %t/dummy.d
// RUN: llvm-bcanalyzer -dump %t/MCP-system/SystemDependencies*.swiftmodule | %FileCheck -check-prefix CHECK-DUMP %s
// RUN: %{python} %S/Inputs/make-old.py %t/MCP-system/SystemDependencies*.swiftmodule
// Baseline: running the same command again doesn't rebuild the cached module.
// 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
// RUN: %{python} %S/Inputs/check-is-old.py %t/MCP-system/SystemDependencies*.swiftmodule
// Now try changing the contents.
// RUN: echo "// size change" >> %t/mock-sdk/usr/include/SomeCModule.h
// 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
// RUN: %{python} %S/Inputs/check-is-new.py %t/MCP-system/SystemDependencies*.swiftmodule
// Check that it picked a different cache key.
// RUN: %empty-directory(%t/MCP-combined)
// RUN: cp %t/MCP/SystemDependencies*.swiftmodule %t/MCP-combined
// RUN: cp %t/MCP-system/SystemDependencies*.swiftmodule %t/MCP-combined
// RUN: ls -1 %t/MCP-combined | %FileCheck %s -check-prefix=MODULECACHE
// NEGATIVE-NOT: SomeCModule.h
// CHECK: SomeCModule.h
// CHECK-DUMP-NOT: usr/include
// CHECK-DUMP: DEPENDENCY_DIRECTORY{{.+}}'usr/include'
// CHECK-DUMP-NEXT: FILE_DEPENDENCY{{.+}}'module.modulemap'
// CHECK-DUMP-NEXT: FILE_DEPENDENCY{{.+}}'SomeCModule.h'
// CHECK-DUMP-NOT: usr/include
// MODULECACHE-COUNT-2: SystemDependencies-{{[^ ]+}}.swiftmodule
import SomeCModule