mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Autolinking was added to the frontend in22912bc3b. It was disabled on Linux in198402dcf, and further constrained to be disabled on "linux-gnu" in83b4384fa. Since then, more flavors of Linux have become supported by Swift: "linux-gnueabihf" in4bf81e09d, and "freebsd" inf41b791d4. Autolinking most likely does not work on any of these platforms, so mark it as unsupported for now. Other tests that only mark "linux-gnu" as unsupported do so for similar reasons. Ensure unsupported tests for "linux-gnu" are also unsupported on similar platforms.
46 lines
1.5 KiB
Swift
46 lines
1.5 KiB
Swift
// RUN: rm -rf %t && mkdir %t
|
|
// RUN: sed -n -e '/MODULE_A_START$/,/MODULE_A_END$/ p' %s > %t/a.swift
|
|
// RUN: sed -n -e '/MODULE_B_START$/,/MODULE_B_END$/ p' %s > %t/b.swift
|
|
// RUN: sed -n -e '/REPL_START$/,/REPL_END$/ p' %s > %t/repl.swift
|
|
// RUN: %target-swiftc_driver -emit-library %t/a.swift -I %t -L %t -emit-module-path %t/ModuleA.swiftmodule -autolink-force-load -module-link-name ModuleA -module-name ModuleA -o %t/libModuleA.dylib
|
|
// RUN: %target-swiftc_driver -emit-library %t/b.swift -I %t -L %t -emit-module-path %t/ModuleB.swiftmodule -autolink-force-load -module-link-name ModuleB -module-name ModuleB -o %t/libModuleB.dylib
|
|
// RUN: %swift -repl -I %t -L %t < %t/repl.swift 2>&1 | FileCheck %s
|
|
|
|
// REQUIRES: swift_repl
|
|
// UNSUPPORTED: OS=linux-gnu
|
|
// UNSUPPORTED: OS=linux-gnueabihf
|
|
// UNSUPPORTED: OS=freebsd
|
|
|
|
// This test checks that autolinking works in the REPL.
|
|
|
|
// MODULE_A_START
|
|
public func funcFromModuleA() -> String {
|
|
return "<result from ModuleA>"
|
|
}
|
|
// MODULE_A_END
|
|
|
|
// MODULE_B_START
|
|
import ModuleA
|
|
|
|
public func funcFromModuleB() -> String {
|
|
return funcFromModuleA() + "<result from ModuleB>"
|
|
}
|
|
// MODULE_B_END
|
|
|
|
// REPL_START
|
|
import ModuleB
|
|
funcFromModuleB()
|
|
funcFromModuleA()
|
|
|
|
import ModuleA
|
|
funcFromModuleA()
|
|
// REPL_END
|
|
|
|
// Don't insist on particular order, it is non-deterministic (since the output
|
|
// is stdout and stderr, mixed together).
|
|
//
|
|
// CHECK-DAG: "<result from ModuleA><result from ModuleB>"
|
|
// CHECK-DAG: error: use of unresolved identifier 'funcFromModuleA'
|
|
// CHECK-DAG: "<result from ModuleA>"
|
|
|