From f76ef9a7e64ca0f14b26a1c36bfb4da740db1a81 Mon Sep 17 00:00:00 2001 From: Andrew Bettison Date: Mon, 2 Jul 2012 12:26:58 +0930 Subject: [PATCH] Improve test framework: log timestamps --- testframework.sh | 46 ++++++++++++++++++++++++---------------------- tests/dnaprotocol | 2 +- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/testframework.sh b/testframework.sh index ab702344..b36cb434 100644 --- a/testframework.sh +++ b/testframework.sh @@ -399,14 +399,14 @@ escape_grep_extended() { # - sets the $executed variable to a description of the command that was # executed execute() { - echo -n "# execute "; _tfw_shellarg "$@" + tfw_log "# execute" $(_tfw_shellarg "$@") _tfw_getopts execute "$@" shift $_tfw_getopts_shift _tfw_execute "$@" } executeOk() { - echo -n "# executeOk "; _tfw_shellarg "$@" + tfw_log "# executeOk" $(_tfw_shellarg "$@") _tfw_getopts executeok "$@" _tfw_opt_exit_status=0 _tfw_dump_on_fail --stderr @@ -423,7 +423,7 @@ assert() { _tfw_getopts assert "$@" shift $_tfw_getopts_shift _tfw_assert "$@" || _tfw_failexit - echo -n "# assert "; _tfw_shellarg "$@" + tfw_log "# assert" $(_tfw_shellarg "$@") return 0 } @@ -433,7 +433,7 @@ assertExpr() { local awkexpr=$(_tfw_expr_to_awkexpr "$@") _tfw_message="${_tfw_message+$_tfw_message }($awkexpr)" _tfw_assert _tfw_eval_awkexpr "$awkexpr" || _tfw_failexit - echo -n "# assertExpr "; _tfw_shellarg "$awkexpr" + tfw_log "# assertExpr" $(_tfw_shellarg "$awkexpr") return 0 } @@ -464,8 +464,9 @@ fatal() { # will also do this, but tfw_log will work even in a context that stdout (fd 1) # is redirected. tfw_log() { + local ts=$(_tfw_timestamp) cat >&$_tfw_log_fd <