CB-10918 Travis tests are failing sometimes for cordova-ios Updates killall Simulator pname for XCode7
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/7f74bca9 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/7f74bca9 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/7f74bca9 Branch: refs/heads/4.1.x Commit: 7f74bca9a6f1d89dc707f74bf3a825af72e6943a Parents: bc8a215 Author: daserge <[email protected]> Authored: Mon Mar 21 10:10:08 2016 +0300 Committer: daserge <[email protected]> Committed: Wed Mar 23 14:48:46 2016 +0300 ---------------------------------------------------------------------- tests/spec/cordovalib.spec.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/7f74bca9/tests/spec/cordovalib.spec.js ---------------------------------------------------------------------- diff --git a/tests/spec/cordovalib.spec.js b/tests/spec/cordovalib.spec.js index e60484a..7ff54c7 100644 --- a/tests/spec/cordovalib.spec.js +++ b/tests/spec/cordovalib.spec.js @@ -32,17 +32,28 @@ describe('cordova-lib', function() { var command; var artifacts_dir = tmp.dirSync().name; - // check iOS Simulator if running - command = 'pgrep "iOS Simulator"'; - return_code = shell.exec(command).code; - - // if iOS Simulator is running, kill it - if (return_code === 0) { // found - shell.echo('iOS Simulator is running, we\'re going to kill it.'); - return_code = shell.exec('killall "iOS Simulator"').code; - expect(return_code).toBe(0); + function killSimulator(processName) { + var result; + // check iOS Simulator if running + command = 'pgrep "' + processName + '"'; + return_code = shell.exec(command).code; + + // if iOS Simulator is running, kill it + if (return_code === 0) { // found + shell.echo('iOS Simulator is running("'+ processName +'"), we\'re going to kill it.'); + result = shell.exec('killall "' + processName + '"'); + if (result.code !== 0) { + if (!(result.output && + result.output.indexOf('No matching processes belonging to you were found') !== -1)) { + expect(result.code).toBe(0); + } + } + } } + killSimulator('iOS Simulator'); // XCode6 + killSimulator('Simulator'); // XCode7 + // run the tests command = util.format('xcodebuild test -workspace %s/cordova-ios.xcworkspace -scheme CordovaLibTests -destination "platform=iOS Simulator,name=iPhone 5" CONFIGURATION_BUILD_DIR="%s"', tests_dir, artifacts_dir); shell.echo(command); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
