Author: jkeenan
Date: Sat Jan 26 20:53:35 2008
New Revision: 25270

Modified:
   branches/harness/languages/t/harness
   branches/harness/lib/Parrot/Harness/Smoke.pm
   branches/harness/t/harness

Log:
lib/Parrot/Harness/Smoke.pm and t/harness:  Where possible, eliminate
differences in code in sections dealing with smoke testing.


Modified: branches/harness/languages/t/harness
==============================================================================
--- branches/harness/languages/t/harness        (original)
+++ branches/harness/languages/t/harness        Sat Jan 26 20:53:35 2008
@@ -127,28 +127,18 @@
     Test::Harness::runtests(@tests);
 }
 else {
+    my $html_fn = "languages_smoke.html";
     my @smoke_config_vars = qw(
-      osname
-      archname
-      cc
-      build_dir
-      cpuarch
-      revision
-      VERSION
-      optimize
-      DEVEL
+      osname archname cc build_dir cpuarch revision VERSION optimize DEVEL
     );
 
     eval {
         require Test::TAP::HTMLMatrix;
         require Test::TAP::Model::Visual;
     };
-    die "You must have Test::TAP::HTMLMatrix installed.\n\n$@" if $@;
+    die "You must have Test::TAP::HTMLMatrix installed.\n\n$@"
+        if $@;
 
-    ## FIXME: ###
-    # This is a temporary solution until Test::TAP::Model version
-    # 0.05.  At that point, this function should be removed, and the
-    # verbose line below should be uncommented.
     {
         no warnings qw/redefine once/;
         *Test::TAP::Model::run_tests = sub {
@@ -163,8 +153,8 @@
                 my $data;
                 print STDERR "- $file\n";
                 $data = $self->run_test($file);
-                $stats{tests} += $data->{results}{max};
-                $stats{ok}    += $data->{results}{ok} || 0;
+                $stats{tests} += $data->{results}{max} || 0;
+                $stats{ok}    += $data->{results}{ok}  || 0;
             }
 
             printf STDERR "%s OK from %s tests (%.2f%% ok)\n\n",
@@ -172,7 +162,7 @@
             $stats{tests},
             $stats{ok} / $stats{tests} * 100;
 
-            $self->{meat}{end_time} = time;
+            $self->{meat}{end_time} = time();
         };
 
         my $start = time();
@@ -193,7 +183,6 @@
 
         $v->has_inline_css(1); # no separate css file
 
-        my $html_fn = "languages_smoke.html";
         open HTML, '>', $html_fn;
         print HTML $v->html();
         close HTML;

Modified: branches/harness/lib/Parrot/Harness/Smoke.pm
==============================================================================
--- branches/harness/lib/Parrot/Harness/Smoke.pm        (original)
+++ branches/harness/lib/Parrot/Harness/Smoke.pm        Sat Jan 26 20:53:35 2008
@@ -15,6 +15,7 @@
     generate_html_smoke_report (
         tests       => [EMAIL PROTECTED],
         args        => $args,
+        file        => 'smoke.html',
     );
 
 =cut
@@ -29,6 +30,7 @@
 
 sub generate_html_smoke_report {
     my $argsref = shift;
+    my $html_fn = $argsref->{file};
     my @smoke_config_vars = qw(
         osname archname cc build_dir cpuarch revision VERSION optimize DEVEL
     );
@@ -46,7 +48,7 @@
         my $self = shift;
 
         $self->_init;
-        $self->{meat}{start_time} = time;
+        $self->{meat}{start_time} = time();
 
         my %stats;
 
@@ -63,7 +65,7 @@
             $stats{tests},
             $stats{ok} / $stats{tests} * 100;
 
-        $self->{meat}{end_time} = time;
+        $self->{meat}{end_time} = time();
       };
 
       my $start = time();
@@ -81,15 +83,15 @@
              "branch: unknown",
              "harness_args: " . (($argsref->{args}) ? $argsref->{args} : 
"N/A"),
              map { "$_: $PConfig{$_}" } sort @smoke_config_vars),
-                   );
+      );
 
       $v->has_inline_css(1); # no separate css file
 
-      open HTML, ">", "smoke.html";
-      print HTML $v->html;
+      open HTML, '>', $html_fn;
+      print HTML $v->html();
       close HTML;
 
-      print "smoke.html has been generated.\n";
+      print "$html_fn has been generated.\n";
     }
 }
 

Modified: branches/harness/t/harness
==============================================================================
--- branches/harness/t/harness  (original)
+++ branches/harness/t/harness  Sat Jan 26 20:53:35 2008
@@ -186,6 +186,7 @@
     generate_html_smoke_report ( {
         tests       => [EMAIL PROTECTED],
         args        => $args,
+        file        => 'smoke.html',
     } );
 }
 

Reply via email to