File: index_only_sdk_system_modules.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (67 lines) | stat: -rw-r--r-- 3,069 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// RUN: %empty-directory(%t)
// RUN: %empty-directory(%t/cache)
// RUN: %empty-directory(%t/idx)
// RUN: %empty-directory(%t/sdk)
// RUN: split-file %s %t

/// Create a Swift module to import.
// RUN: cp %t/module.modulemap %t/sdk/
// RUN: %target-swift-frontend -emit-module \
// RUN:   -enable-library-evolution -swift-version 5 \
// RUN:   -emit-module-path %t/sdk/LocalSystemModule.swiftmodule \
// RUN:   -emit-module-interface-path %t/sdk/LocalSystemModule.swiftinterface \
// RUN:   %t/LocalSystemModule.swift -I %t/sdk \
// RUN:   -enable-testing

/// Build a test client once with indexing, not setting an SDK.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN:   -I %t/sdk -module-cache-path %t/cache \
// RUN:   -index-system-modules \
// RUN:   -index-store-path %t/idx \
// RUN:   -index-ignore-stdlib \
// RUN:   -sdk %t/someothersdk -Rmodule-loading 2>&1 \
// RUN:   | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s
// CHECK-SWIFTMODULE: source: '{{.*}}LocalSystemModule.swiftmodule'

/// Build the test client again not setting an SDK, this one should still use
/// the adjacent module that is built for testing.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN:   -I %t/sdk -module-cache-path %t/cache \
// RUN:   -sdk %t/someothersdk -Rmodule-loading 2>&1 \
// RUN:   | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s

/// @testable import of a module in the SDK works once but not after it's cached.
// RUN: %empty-directory(%t/idx)
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN:   -I %t/sdk -module-cache-path %t/cache \
// RUN:   -index-system-modules \
// RUN:   -index-store-path %t/idx \
// RUN:   -index-ignore-stdlib \
// RUN:   -sdk %t/sdk -Rmodule-loading 2>&1 \
// RUN:   | %FileCheck -check-prefix=CHECK-SWIFTMODULE %s

/// Failing case when building against the cached swiftmodule.
// RUN: %target-swift-frontend -typecheck %t/TestClient.swift \
// RUN:   -I %t/sdk -module-cache-path %t/cache \
// RUN:   -sdk %t/sdk -Rmodule-loading \
// RUN:   -verify -verify-ignore-unknown -show-diagnostics-after-fatal 2>&1

//--- module.modulemap

module LocalSystemModule [system] { }

//--- LocalSystemModule.swift

@_exported import LocalSystemModule

//--- TestClient.swift

@testable import LocalSystemModule // expected-error {{module 'LocalSystemModule' was not compiled for testing}}
// expected-remark @-1 {{LocalSystemModule.swiftinterface}}
// expected-remark @-2 {{'LocalSystemModule' has a required transitive dependency on 'LocalSystemModule'}}
// expected-remark @-3 {{'LocalSystemModule' has a required transitive dependency on 'Swift'}}
// expected-remark @-4 {{'LocalSystemModule' has a required transitive dependency on 'SwiftOnoneSupport'}}
// expected-remark @-5 {{'LocalSystemModule' has a required transitive dependency on '_Concurrency'}}
// expected-remark @-6 {{'LocalSystemModule' has a required transitive dependency on '_StringProcessing'}}
// expected-remark @-7 {{'LocalSystemModule' has a required transitive dependency on '_SwiftConcurrencyShims'}}