Author: tim.bunce
Date: Sat Mar  7 13:30:26 2009
New Revision: 703

Modified:
    trunk/NYTProf.xs
    trunk/t/lib/NYTProfTest.pm

Log:
Fix extra %s in log warn format.
Extend test harness to include combinations of compress=1|0 and savesrc=1|0
(savesrc is currently disabled because this testing caused coredumps etc.  
I'm investigating.)


Modified: trunk/NYTProf.xs
==============================================================================
--- trunk/NYTProf.xs    (original)
+++ trunk/NYTProf.xs    Sat Mar  7 13:30:26 2009
@@ -1186,7 +1186,7 @@
          --next_fid;
          /* write a log message if tracing */
          if (trace_level >= 2)
-            warn("Old fid %2u (after %2u:%-4u) %x e%u:%u %.*s %s%s\n",
+            warn("Old fid %2u (after %2u:%-4u) %x e%u:%u %.*s %s\n",
                  found->id, last_executed_fid, last_executed_line,
                  found->fid_flags, found->eval_fid, found->eval_line_num,
                  found->key_len, found->key, (found->key_abs) ?  
found->key_abs : "");

Modified: trunk/t/lib/NYTProfTest.pm
==============================================================================
--- trunk/t/lib/NYTProfTest.pm  (original)
+++ trunk/t/lib/NYTProfTest.pm  Sat Mar  7 13:30:26 2009
@@ -63,15 +63,23 @@

  my @test_opt_leave      = (defined $opts{leave})      ?  
($opts{leave})      : (1, 0);
  my @test_opt_use_db_sub = (defined $opts{use_db_sub}) ?  
($opts{use_db_sub}) : (0, 1);
+my @test_opt_savesrc    = (defined $opts{savesrc})    ?  
($opts{savesrc})    : (0, 1);
+my @test_opt_compress   = (defined $opts{compress})   ?  
($opts{compress})   : (0, 1);

  # build @env_combinations
  my @env_combinations;
  for my $leave (@test_opt_leave) {
      for my $use_db_sub (@test_opt_use_db_sub) {
-        push @env_combinations, {
-            start      => 'init',
-            leave      => $leave,
-            use_db_sub => $use_db_sub,
+        for my $savesrc (@test_opt_savesrc) {
+            for my $compress (@test_opt_compress) {
+                push @env_combinations, {
+                    start      => 'init',
+                    leave      => $leave,
+                    use_db_sub => $use_db_sub,
+                    #    savesrc    => $savesrc,
+                    compress   => $compress,
+                }
+            }
          }
      }
  }
@@ -131,6 +139,7 @@

      my %env = (%$env, %NYTPROF_TEST);
      local $ENV{NYTPROF} = join ":", map {"$_=$env{$_}"} sort keys %env;
+    warn "NYTPROF=$ENV{NYTPROF}\n" if $opts{v};

      #print $test . '.'x (20 - length $test);
      $test =~ / (.+?) \. (?:(\d)\.)? (\w+) $/x or do {
@@ -170,7 +179,7 @@
  }

  sub run_command {
-    my ($cmd) = @_;
+    my ($cmd, $show_stdout) = @_;
      warn "NYTPROF=$ENV{NYTPROF}\n" if $opts{v} && $ENV{NYTPROF};
      local $ENV{PERL5LIB} = $perl5lib;
      warn "$cmd\n" if $opts{v};
@@ -178,7 +187,8 @@
      open(RV, "$cmd |") or die "Can't execute $cmd: $!\n";
      my @results = <RV>;
      my $ok = close RV;
-    warn "Error status $? from $cmd!\n\n" if not $ok;
+    if ($show_stdout or not $ok) { warn $_ for @results }
+    warn "Error status $? from $cmd!\n" if not $ok;
      return $ok;
  }

@@ -399,4 +409,4 @@

  1;

-# vim:ts=8:sw=2
+# vim:ts=8:sw=4

--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to