Bug 926264: Use a setTimeout before exiting tests and add some additional logs. r=Mossop

This commit is contained in:
Erik Vold 2014-02-07 13:19:23 -08:00
parent 42ffef8e70
commit 2bc52fdc5d
3 changed files with 19 additions and 6 deletions

View File

@ -12,6 +12,7 @@ const { Cc, Ci, CC } = require('chrome');
const options = require('@loader/options');
const file = require('./io/file');
const runtime = require("./system/runtime");
var cfxArgs = require("@test/options");
const appStartup = Cc['@mozilla.org/toolkit/app-startup;1'].
getService(Ci.nsIAppStartup);
@ -69,12 +70,13 @@ exports.exit = function exit(code) {
stream.write(status, status.length);
stream.flush();
stream.close();
if (cfxArgs.parseable) {
console.log('wrote to resultFile');
}
}
if (code == 0) {
forcedExit = true;
}
appStartup.quit(code ? E_ATTEMPT : E_FORCE);
forcedExit = true;
appStartup.quit(E_FORCE);
};
// Adapter for nodejs's stdout & stderr:

View File

@ -7,6 +7,7 @@ module.metadata = {
"stability": "experimental"
};
var { setTimeout } = require("../timers");
var { exit, stdout } = require("../system");
var cfxArgs = require("@test/options");
@ -19,9 +20,16 @@ function runTests(findAndRunTests) {
stdout.write(tests.passed + " of " + total + " tests passed.\n");
if (tests.failed == 0) {
if (tests.passed === 0)
if (tests.passed === 0) {
stdout.write("No tests were run\n");
exit(0);
}
setTimeout(function() {
if (cfxArgs.parseable) {
console.log('calling exit(0)');
}
exit(0);
}, 0);
} else {
if (cfxArgs.verbose || cfxArgs.parseable)
printFailedTests(tests, stdout.write);

View File

@ -731,6 +731,7 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
if os.path.exists(resultfile):
result = open(resultfile).read()
if result:
sys.stderr.write("resultfile contained " + "'" + result + "'\n")
if result in ['OK', 'FAIL']:
done = True
else:
@ -749,7 +750,9 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
else:
runner.wait(10)
finally:
sys.stderr.write("Done.\n")
outf.close()
sys.stderr.write("Clean the profile.\n")
if profile:
profile.cleanup()