Skip to content

Commit a58b560

Browse files
czechboy0mxcl
authored andcommitted
[swift-test] Now using Package.test's real names
1 parent 0d03048 commit a58b560

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

Sources/Build/misc.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ extension CModule {
3636

3737
extension Product {
3838
var Info: (_: Void, plist: String) {
39-
let bundleExecutable = "Package"
39+
precondition(isTest)
40+
41+
let bundleExecutable = name
4042
let bundleID = "org.swift.pm.\(name)"
4143
let bundleName = name
4244

Sources/Transmute/Package+products.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ extension Package {
2828

2929
if !testModules.isEmpty {
3030
let modules: [SwiftModule] = testModules.map{$0} // or linux compiler crash (2016-02-03)
31-
//TODO name should be package name
3231
//TODO and then we should prefix all modules with their package probably
33-
let product = Product(name: "Package", type: .Test, modules: modules)
32+
let product = Product(name: self.name, type: .Test, modules: modules)
3433
products.append(product)
3534
}
3635

Sources/swift-test/main.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,14 @@ do {
2121
usage()
2222
case .Run(let xctestArg):
2323
let dir = try directories()
24+
25+
//FIXME find a reliable name to detect the name of the root test Package
26+
let testPackageName = dir.root.basename
2427
let yamlPath = Path.join(dir.build, "debug.yaml")
2528
guard yamlPath.exists else { throw Error.DebugYAMLNotFound }
2629

2730
try build(YAMLPath: yamlPath, target: "test")
28-
let success = try test(dir.build, "debug", xctestArg: xctestArg)
31+
let success = try test(dir.build, "debug", testPackageName: testPackageName, xctestArg: xctestArg)
2932
exit(success ? 0 : 1)
3033
}
3134
} catch {

Sources/swift-test/test.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
import PackageType
1212
import Utility
1313

14-
func test(path: String..., xctestArg: String? = nil) throws -> Bool {
14+
func test(path: String..., testPackageName: String, xctestArg: String? = nil) throws -> Bool {
1515
let path = Path.join(path)
1616
var args: [String] = []
1717
let testsPath: String
1818

1919
#if os(OSX)
20-
testsPath = Path.join(path, "Package.xctest")
20+
testsPath = Path.join(path, "\(testPackageName).xctest")
2121
args = ["xcrun", "xctest"]
2222
if let xctestArg = xctestArg {
2323
args += ["-XCTest", xctestArg]
2424
}
2525
args += [testsPath]
2626
#else
27-
testsPath = Path.join(path, "test-Package")
27+
testsPath = Path.join(path, "test-\(testPackageName)")
2828
args += [testsPath]
2929
if let xctestArg = xctestArg {
3030
args += [xctestArg]

0 commit comments

Comments
 (0)