diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2016-08-03 16:03:57 +1200 |
---|---|---|
committer | Douglas Bagnall <dbagnall@samba.org> | 2016-08-31 07:09:26 +0200 |
commit | dda1b74ea10a45d9a810b2a982e93cfb13dfeaba (patch) | |
tree | ee548b660e5d60af81ae490467fb74331ae6528c | |
parent | db85692e4cd41499b5c4ec3220ae36da77afa2ef (diff) | |
download | samba-dda1b74ea10a45d9a810b2a982e93cfb13dfeaba.tar.gz |
blackbox tests: add timestamps for subunit tests
There is the icky thing with sed because some kinds of `date` don't
have sub-second resolution, which we really want.
Another way to do it would be:
python -c "import datetime; print datetime.datetime.utcnow().strftime('time: %Y-%m-%d %H:%M:%S.%fZ')"
which should be universal, but is a little slower.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
-rwxr-xr-x | testprogs/blackbox/subunit.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh index db7fb056b74..70fe2d7e065 100755 --- a/testprogs/blackbox/subunit.sh +++ b/testprogs/blackbox/subunit.sh @@ -18,14 +18,23 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +timestamp() { + # mark the start time. With Gnu date, you get nanoseconds from %N + # (here truncated to microseconds with %6N), but not on BSDs, + # Solaris, etc, which will apparently leave either %N or N at the end. + date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/%\?NZ$/000000Z/' +} + subunit_start_test () { # emit the current protocol start-marker for test $1 + timestamp echo "test: $1" } subunit_pass_test () { # emit the current protocol test passed marker for test $1 + timestamp echo "success: $1" } @@ -38,6 +47,7 @@ subunit_fail_test () { # the error text. # we use stdin because the failure message can be arbitrarily long, and this # makes it convenient to write in scripts (using <<END syntax. + timestamp echo "failure: $1 [" cat - echo "]" @@ -49,6 +59,7 @@ subunit_error_test () { # the error text. # we use stdin because the failure message can be arbitrarily long, and this # makes it convenient to write in scripts (using <<END syntax. + timestamp echo "error: $1 [" cat - echo "]" |