-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added test target to Verification Suite main script
Reviewers: jerzy.kleszcz Reviewed By: jerzy.kleszcz Subscribers: jerzy.kleszcz Differential Revision: https://phabricator.polidea.com/D2708
- Loading branch information
1 parent
07e313a
commit e28ece4
Showing
4 changed files
with
63 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Foundation | ||
import ShellOut | ||
|
||
func executableFromProjectBuild(xcodeproj: String, scheme: String, outputPath: String) -> String { | ||
|
||
let buildSettingsDict: [String:String] = | ||
xcodebuild(project: xcodeproj, scheme: scheme, outputBuildPath: outputPath) | ||
.components(separatedBy: "\n") | ||
.map { $0.trimmingCharacters(in: .whitespaces) } | ||
.reduce(into: [:]) { dict, settingLine in | ||
let pair = settingLine.components(separatedBy: " = ") | ||
guard pair.count == 2 else { | ||
return | ||
} | ||
dict[pair[0]] = pair[1] | ||
} | ||
|
||
guard let productsPathComponent = buildSettingsDict["BUILT_PRODUCTS_DIR"], | ||
let executablePathComponent = buildSettingsDict["EXECUTABLE_PATH"] else { | ||
print("Failed to extract executable path from built project") | ||
exit(0) | ||
} | ||
let executablePath = productsPathComponent + "/" + executablePathComponent | ||
|
||
return executablePath | ||
} | ||
|
||
func xcodebuild(project: String, scheme: String, outputBuildPath: String) -> String { | ||
// build project | ||
var arguments = [ | ||
"-project", project, | ||
"-derivedDataPath", outputBuildPath, | ||
"-scheme", scheme, | ||
"-configuration", "Release", | ||
] | ||
try! shellOut(to: "xcodebuild", arguments: arguments) | ||
|
||
// return build settings for the same build parameters | ||
arguments.append("-showBuildSettings") | ||
return try! shellOut(to: "xcodebuild", arguments: arguments) | ||
} | ||
|
||
func removeDirectory(_ path: String) { | ||
try! shellOut(to: "rm", arguments: ["-rf", path]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import XCTest | ||
@testable import VerificationSuite | ||
|
||
class VerificationSuiteTests: XCTestCase { | ||
|
||
func testAlwaysSucceeds() { | ||
XCTAssertEqual(true, true, "The truth is out there") | ||
} | ||
|
||
} | ||
|