From 8c6c48595a2497c3487ba5742ac3e6af3c8bbc0a Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 28 Apr 2011 14:10:03 -0400 Subject: [PATCH] Make test runner better. Probably screws up windows. Fixes #30. --- test/run-tests.c | 6 ++++-- test/runner-unix.c | 2 +- test/runner.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/run-tests.c b/test/run-tests.c index 95259c821..b1117ea68 100644 --- a/test/run-tests.c +++ b/test/run-tests.c @@ -34,7 +34,7 @@ static void log_progress(int total, int passed, int failed, char* name) { - LOGF("[%% %3d|+ %3d|- %3d]: %-50s\n", (passed + failed) / total * 100, + LOGF("[%% %3d|+ %3d|- %3d]: %s", (passed + failed) / total * 100, passed, failed, name); } @@ -68,8 +68,8 @@ int main(int argc, char **argv) { continue; } - log_progress(total, passed, failed, task->task_name); rewind_cursor(); + log_progress(total, passed, failed, task->task_name); if (run_task(task, TEST_TIMEOUT, 0)) { passed++; @@ -77,6 +77,8 @@ int main(int argc, char **argv) { failed++; } } + + rewind_cursor(); log_progress(total, passed, failed, "Done."); return 0; diff --git a/test/runner-unix.c b/test/runner-unix.c index afc64bfc2..325704496 100644 --- a/test/runner-unix.c +++ b/test/runner-unix.c @@ -299,6 +299,6 @@ void process_cleanup(process_info_t *p) { /* Move the console cursor one line up and back to the first column. */ int rewind_cursor() { - printf("\033[0A\r"); + printf("\033[2K\r"); return 0; } diff --git a/test/runner.c b/test/runner.c index 1aa4be911..f56f0aa23 100644 --- a/test/runner.c +++ b/test/runner.c @@ -117,7 +117,7 @@ finalize: /* Show error and output from processes if the test failed. */ if (!success) { - LOG("=============================================================\n"); + LOG("\n=============================================================\n"); LOGF("`%s` failed: %s\n", test->task_name, errmsg); for (i = 0; i < process_count; i++) {