diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2009-05-13 19:57:58 +0200 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2009-06-03 16:26:30 +0200 |
commit | 641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048 (patch) | |
tree | 2ff45a1c31a742f485af7843cb7923f59e819434 | |
parent | 53aeb7f4cf4935fbf48d745e6f38a9793120c1a9 (diff) | |
download | samba-641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048.tar.gz samba-641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048.tar.bz2 samba-641f8d62df2d7ba0e80f3c8d78c3f8185dcf7048.zip |
Support reporting current time in selftest output.
-rw-r--r-- | selftest/output/html.pm | 10 | ||||
-rw-r--r-- | selftest/output/plain.pm | 13 | ||||
-rw-r--r-- | selftest/output/subunit.pm | 7 | ||||
-rwxr-xr-x | selftest/selftest.pl | 9 |
4 files changed, 32 insertions, 7 deletions
diff --git a/selftest/output/html.pm b/selftest/output/html.pm index e490765d06..d4d8204ea8 100644 --- a/selftest/output/html.pm +++ b/selftest/output/html.pm @@ -138,7 +138,7 @@ sub end_testsuite($$$$) print TEST "</table>\n"; - print TEST "<div class=\"duration\">Duration: " . (time() - $self->{START_TIME}) . "s</div>\n"; + print TEST "<div class=\"duration\">Duration: " . ($self->{last_time} - $self->{START_TIME}) . "s</div>\n"; $self->print_html_footer(*TEST); @@ -192,12 +192,18 @@ sub end_testsuite($$$$) print INDEX "</tr>\n"; } +sub report_time($$) +{ + my ($self, $time) = @_; + $self->{last_time} = $time; +} + sub start_test($$) { my ($self, $parents, $testname) = @_; if ($#$parents == -1) { - $self->{START_TIME} = time(); + $self->{START_TIME} = $self->{last_time}; $self->start_testsuite($testname); return; } diff --git a/selftest/output/plain.pm b/selftest/output/plain.pm index 5312a9e27b..26056038f5 100644 --- a/selftest/output/plain.pm +++ b/selftest/output/plain.pm @@ -29,7 +29,7 @@ sub new($$$$$$$) { verbose => $verbose, immediate => $immediate, statistics => $statistics, - start_time => time(), + start_time => undef, test_output => {}, suitesfailed => [], suites_ok => 0, @@ -41,6 +41,15 @@ sub new($$$$$$$) { bless($self, $class); } +sub report_time($$) +{ + my ($self, $time) = @_; + unless ($self->{start_time}) { + $self->{start_time} = $time; + } + $self->{last_time} = $time; +} + sub output_msg($$); sub start_testsuite($$) @@ -49,7 +58,7 @@ sub start_testsuite($$) $self->{index}++; $self->{NAME} = $name; - $self->{START_TIME} = time(); + $self->{START_TIME} = $self->{last_time}; my $duration = $self->{START_TIME} - $self->{start_time}; diff --git a/selftest/output/subunit.pm b/selftest/output/subunit.pm index 720fe7285c..e99b76c1b9 100644 --- a/selftest/output/subunit.pm +++ b/selftest/output/subunit.pm @@ -33,6 +33,13 @@ sub new($) { bless($self, $class); } +sub report_time($$) +{ + my ($self, $time) = @_; + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($time); + printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec; +} + sub start_testsuite($$) { my ($self, $name) = @_; diff --git a/selftest/selftest.pl b/selftest/selftest.pl index 7e64208ff3..b786c9a50f 100755 --- a/selftest/selftest.pl +++ b/selftest/selftest.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2005-2008 Jelmer Vernooij <jelmer@samba.org> +# Copyright (C) 2005-2009 Jelmer Vernooij <jelmer@samba.org> # Copyright (C) 2007-2009 Stefan Metzmacher <metze@samba.org> # This program is free software; you can redistribute it and/or modify @@ -254,6 +254,7 @@ sub run_testsuite($$$$$$) my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; my $pcap_file = setup_pcap($name); + $msg_ops->report_time(time()); $msg_ops->start_test([], $name); unless (open(RESULT, "$cmd 2>&1|")) { @@ -276,6 +277,7 @@ sub run_testsuite($$$$$$) my $exitcode = $? >> 8; + $msg_ops->report_time(time()); if ($ret == 1) { $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); } else { @@ -692,7 +694,7 @@ if ($opt_format eq "buildfarm") { } else { die("Invalid output format '$opt_format'"); } - +$msg_ops->report_time(time()); foreach (@available) { my $name = $$_[0]; @@ -886,7 +888,8 @@ $envvarstr my $envvars = setup_env($envname); if (not defined($envvars)) { - $msg_ops->skip_testsuite($name, "unable to set up environment $envname"); + $msg_ops->skip_testsuite($name, + "unable to set up environment $envname"); next; } |