Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 2 files changed
  • 0 comments
  • 2 contributors
Sep 07, 2012
dlifshitz-maca TIMOB-9840: BlackBerry: Integrate Anvil unit test framework and get t…
…ests to run

[Issues Fixed]
TIMOB-9840: BlackBerry: Integrate Anvil unit test framework and get tests to run

[Description]
The latest merge changed from using / to separate paths to using the node.js' path.join function. This caused the paths on Windows to use \, but the cp command fails with that.
For now, we'll just change the separators, but this should be removed when a proper fix is implemented.

[Changes]
common.js
- use function fixPathSeparator
- change to not put two cp args into the path.join call so it won't add an extra path separator

driverUtils.js
- added function fixPathSeparator

[Tests]
Test 1: Run Anvil
1) Set the variables in config.js
2) Run Anvil
3) Verify all the tests run and there are no errors
b5cfafe
Sep 10, 2012
dlifshitz-maca TIMOB-10814: Blackberry: Fix Anvil issue caused by sync
only change paths on windows
73d5d02
dlifshitz-maca Merge pull request #152 from dlifshitz-maca/TIMOB-9840_02
TIMOB-9840: BlackBerry: Integrate Anvil unit test framework and get tests to run
94667b2
8  anvil/driver/common.js
@@ -330,7 +330,7 @@ module.exports = new function() {
330 330
 		driverUtils.log("updating harness for config: " + config.configName);
331 331
 
332 332
 		var updateSuitesCallback = function() {
333  
-			driverUtils.runCommand("cp -r " + path.join(configs[configSetIndex].setDir, "Resources") + " " + path.join(harnessPlatformDir, "harness"), driverUtils.logStdout, function(error) {
  333
+			driverUtils.runCommand("cp -r " + driverUtils.fixPathSeparator(path.join(configs[configSetIndex].setDir, "Resources") + " " + path.join(harnessPlatformDir, "harness")), driverUtils.logStdout, function(error) {
334 334
 				if (error !== null) {
335 335
 					driverUtils.log("unable to update the harness suites: " + error);
336 336
 					if (errorCallback) {
@@ -402,7 +402,7 @@ module.exports = new function() {
402 402
 				fs.writeFileSync(tiappXmlPath, newTiappXmlContents);
403 403
 			}
404 404
 
405  
-			driverUtils.runCommand("cp -r " + path.join(configDir, "tiapp.xml") + " " + path.join(harnessPlatformDir, "harness"), driverUtils.logStdout, function(error) {
  405
+			driverUtils.runCommand("cp -r " + driverUtils.fixPathSeparator(path.join(configDir, "tiapp.xml") + " " + path.join(harnessPlatformDir, "harness")), driverUtils.logStdout, function(error) {
406 406
 				if (error !== null) {
407 407
 					driverUtils.log("unable to update the harness tiapp.xml: " + error);
408 408
 					if (errorCallback) {
@@ -420,7 +420,7 @@ module.exports = new function() {
420 420
 
421 421
 		var updateAppjsCallback = function() {
422 422
 			if (path.existsSync(path.join(configDir, "app.js"))) {
423  
-				driverUtils.runCommand("cp -r " + path.join(configDir, "app.js ", harnessPlatformDir, "harness", "Resources"), driverUtils.logStdout, function(error) {
  423
+				driverUtils.runCommand("cp -r " + driverUtils.fixPathSeparator(path.join(configDir, "app.js") + " " + path.join(harnessPlatformDir, "harness", "Resources")), driverUtils.logStdout, function(error) {
424 424
 					if (error !== null) {
425 425
 						driverUtils.log("unable to update app.js for harness: " + error);
426 426
 						if (errorCallback) {
@@ -441,7 +441,7 @@ module.exports = new function() {
441 441
 		};
442 442
 
443 443
 		// update the harness based on the harness template packaged with the driver
444  
-		driverUtils.runCommand("cp -r " + path.join(driverGlobal.harnessTemplateDir, "* ", harnessPlatformDir, "harness", "Resources"), driverUtils.logStdout, function(error) {
  444
+		driverUtils.runCommand("cp -r " + driverUtils.fixPathSeparator(path.join(driverGlobal.harnessTemplateDir, "*") + " " + path.join(harnessPlatformDir, "harness", "Resources")), driverUtils.logStdout, function(error) {
445 445
 			if (error !== null) {
446 446
 				driverUtils.log("unable to update harness with template: " + error);
447 447
 				if (errorCallback) {
10  anvil/driver/driverUtils.js
@@ -13,6 +13,7 @@
13 13
 var fs = require("fs"),
14 14
 child_process = require("child_process"),
15 15
 path = require("path");
  16
+var os = require("os");
16 17
 
17 18
 module.exports = new function() {
18 19
 	var self = this,
@@ -124,6 +125,15 @@ module.exports = new function() {
124 125
 		return targetString.replace(/\s+$/,"");
125 126
 	};
126 127
 
  128
+	// TODO: this shouldn't be necessary once we replace the cp command with something cross-platform
  129
+	this.fixPathSeparator = function(pathString) {
  130
+		if (os.platform().toLowerCase().match(/^win/)) {
  131
+			return pathString.split("\\").join("/");
  132
+		} else {
  133
+			return pathString;
  134
+		}
  135
+	};
  136
+
127 137
 	/*
128 138
 	 * sets active log file based on driver command line arguments and deletes any old logs
129 139
 	 * above the specified max number of logs if needed

No commit comments for this range

Something went wrong with that request. Please try again.