Skip to content

Commit

Permalink
start adding debug output to test harness
Browse files Browse the repository at this point in the history
  • Loading branch information
Whiteknight committed Apr 22, 2011
1 parent d8321a6 commit 2de0727
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
11 changes: 7 additions & 4 deletions src/harness/Harness.winxed
Expand Up @@ -22,24 +22,27 @@ namespace Rosella
// other named options.
function run(var test_run, var view,
int run_inline [named,optional], int has_ri [opt_flag],
int line_length [named,optional], int has_ll [opt_flag])
int line_length [named,optional], int has_ll [opt_flag],
int debug [named,optional], int has_dbg [opt_flag])
{
using Rosella.build;

if (!has_ri)
run_inline = 0;
if (!has_ll)
line_length = 0;
return self.run_internal(test_run, view, run_inline);
if (!has_dbg)
debug = 0;
return self.run_internal(test_run, view, run_inline, debug);
}

// Interal routine to run the harness
function run_internal(var test_run, var view, int run_inline)
function run_internal(var test_run, var view, int run_inline, int debug)
{

for (var test in test_run.tests()) {
view.start_test(test);
test.run(run_inline);
test.run(view, debug, run_inline);
test_run.update_test_stats(test);
view.end_test(test);
}
Expand Down
13 changes: 6 additions & 7 deletions src/harness/TestFile.winxed
Expand Up @@ -69,7 +69,7 @@ namespace Rosella { namespace Harness
return string(self.status);
}

function compile_and_execute()
function compile_and_execute(var view, int debug)
{
using Rosella.IO.swap_handles;

Expand All @@ -83,6 +83,7 @@ namespace Rosella { namespace Harness
sub();
} catch(e) {
self.mark_test_abort(e);
view.debug(debug, e["message"]);
}
string output = stdout.readall();
swap_handles(save_handles);
Expand Down Expand Up @@ -113,7 +114,7 @@ namespace Rosella { namespace Harness
self.status = "EMPTY";
}

function spawn_and_execute()
function spawn_and_execute(var view, int debug)
{
var pipe = new "FileHandle";
pipe.encoding('utf8');
Expand All @@ -133,14 +134,12 @@ namespace Rosella { namespace Harness
must_subclass("Rosella::Harness::TestFile");
}

function run(int run_inline [optional], int has_ri [opt_flag])
function run(var view, int debug, int run_inline)
{
if (!has_ri)
run_inline = 0;
if (run_inline)
self.compile_and_execute();
self.compile_and_execute(view, debug);
else
self.spawn_and_execute();
self.spawn_and_execute(view, debug);

if (self.status == null || self.status != "ABORTED") {
if (self.has_tap_output()) {
Expand Down
5 changes: 5 additions & 0 deletions src/harness/View.winxed
Expand Up @@ -155,6 +155,11 @@ namespace Rosella { namespace Harness
}
}

function debug(int dbg, var msg)
{
say(sprintf("DEBUG: %s\n", [msg]));
}

/* Internal Helper Routines
*/

Expand Down

0 comments on commit 2de0727

Please sign in to comment.