Permalink
Browse files

the test cmd line tool is now written in js (works with node)

  • Loading branch information...
1 parent 1cea9c3 commit 4ac8235e97be3bda90b94bb3bc82e13ee71a0fe6 @erikvold erikvold committed Jul 23, 2011
Showing with 45 additions and 25 deletions.
  1. +45 −0 test.js
  2. +0 −25 test.sh
View
45 test.js
@@ -0,0 +1,45 @@
+#!/usr/bin/env node
+
+var exec = require('child_process').exec;
+
+var debug = ("debug" == process.argv[2]);
+
+exec("./build.sh test", function() {
+ console.log("Running mozmill tests...");
+ if (debug) {
+ exec("mozmill -t tests/mozmill-tests -a scriptish-test.xpi --show-all", doAsycTests.bind(null, 0));
+ } else {
+ exec("mozmill -t tests/mozmill-tests -a scriptish-test.xpi", doAsycTests.bind(null, 0));
+ }
+});
+
+function dumpResults(e, out) {
+ if (out) console.log(out);
+}
+
+function doAsycTests(step, e, out) {
+ dumpResults(e, out);
+ step = step || 0;
+ switch (step) {
+ case 4:
+ console.log("Running mozmill-restart tests...");
+ if (debug) {
+ exec("mozmill-restart -t tests/mozmill-tests/tests/restartTests -a scriptish-test.xpi --show-all", dumpResults);
+ } else {
+ exec("mozmill-restart -t tests/mozmill-tests/tests/restartTests -a scriptish-test.xpi", dumpResults);
+ }
+ return;
+ case 0:
+ console.log("Starting restart tests in 10 secs... (Press ctrl+z to cancel)");
+ return setTimeout(doAsycTests.bind(null, ++step), 7000);
+ case 1:
+ console.log("Starting restart tests in 3 secs...");
+ return setTimeout(doAsycTests.bind(null, ++step), 1000);
+ case 2:
+ console.log("Starting restart tests in 2 secs...");
+ return setTimeout(doAsycTests.bind(null, ++step), 1000);
+ case 3:
+ console.log("Starting restart tests in 1 secs...");
+ return setTimeout(doAsycTests.bind(null, ++step), 1000);
+ }
+}
View
25 test.sh
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-./build.sh test
-echo "Running mozmill tests..."
-if [ "debug" == "$1" ]; then
- mozmill -t tests/mozmill-tests -a scriptish-test.xpi --show-all
-else
- mozmill -t tests/mozmill-tests -a scriptish-test.xpi
-fi
-
-echo "Starting restart tests in 10 secs... (Press ctrl+z to cancel)"
-sleep 7
-echo "Starting restart tests in 3 secs..."
-sleep 1
-echo "Starting restart tests in 2 secs..."
-sleep 1
-echo "Starting restart tests in 1 secs..."
-sleep 1
-echo "Running mozmill-restart tests..."
-
-if [ "debug" == "$1" ]; then
- mozmill-restart -t tests/mozmill-tests/tests/restartTests -a scriptish-test.xpi --show-all
-else
- mozmill-restart -t tests/mozmill-tests/tests/restartTests -a scriptish-test.xpi
-fi

0 comments on commit 4ac8235

Please sign in to comment.