Skip to content

Commit 0e0bc91

Browse files
authored
Merge pull request #497 from NativeScript/plamen5kov/enhance_build
enhance build
2 parents 5479d25 + d4f1375 commit 0e0bc91

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

test-app/tools/deploy-apk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var runOnDeviceOrEmulator = process.argv[3];
1212

1313
var proc = require('child_process');
1414

15-
var deployTimeout = 180000; // 3 minutes to deploy and launch.
15+
var deployTimeout = 3 * 60 * 1000; // 3 minutes to deploy and launch.
1616

1717
var cmd = 'adb '+ runOnDeviceOrEmulator +' install -r ' + apk;
1818

test-app/tools/try_to_find_test_result_file.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
var
22
searchForFile = require('child_process').exec,
33
execFindFile = require('child_process').exec,
4+
checkIfAppIsRunning = require('child_process').exec,
45
fs = require('fs'),
56
pullfile,
67

78
isTimeToExit = false,
89

910
processTimeout = 20 * 60 * 1000, // 20 minutes timeout (empirical constant :))
10-
searchInterval = 10000;
11+
searchInterval = 10 * 1000;
1112

1213
searchForFile("", getFile);
1314

@@ -24,11 +25,23 @@ function closeProcessAfter(timeout) {
2425
}
2526

2627
function tryToGetFile() {
28+
var checkApp = checkIfAppIsRunning("adb " + runOnDeviceOrEmulator + " shell \"ps | grep com.tns.android_runtime_testapp\"", checkIfProcessIsRunning);
2729
pullfile = execFindFile("adb " + runOnDeviceOrEmulator + " pull /sdcard/android_unit_test_results.xml", checkIfFileExists);
2830
pullfile.stdout.pipe(process.stdout, { end: false });
2931
pullfile.stderr.pipe(process.stderr, { end: false });
3032
}
3133

34+
function checkIfProcessIsRunning(err, stdout, stderr) {
35+
if(stdout) {
36+
console.log("com.tns.android_runtime_testapp process is running")
37+
}
38+
else {
39+
console.log('com.tns.android_runtime_testapp process died!');
40+
process.exit(1);
41+
}
42+
43+
}
44+
3245
function checkIfFileExists(err, stout, stderr) {
3346

3447
//if you find file in sdcard exit process
@@ -41,7 +54,7 @@ function checkIfFileExists(err, stout, stderr) {
4154
if (isTimeToExit) {
4255
console.log(err);
4356
console.log('Tests results file not found!');
44-
process.exit();
57+
process.exit(1);
4558
}
4659
}
4760
}

0 commit comments

Comments
 (0)