Author: tim.bunce
Date: Tue Jun  2 16:28:32 2009
New Revision: 748

Modified:
    trunk/t/lib/NYTProfTest.pm
    trunk/t/test51-enable.t

Log:
Made NYTPROF_TEST=trace=N work for 'extra tests'.
Added extra note() when extra tests are run.
Added sleep after reporting an error status from a subprocess.


Modified: trunk/t/lib/NYTProfTest.pm
==============================================================================
--- trunk/t/lib/NYTProfTest.pm  (original)
+++ trunk/t/lib/NYTProfTest.pm  Tue Jun  2 16:28:32 2009
@@ -42,6 +42,15 @@
  # options the user wants to override when running tests
  my %NYTPROF_TEST = map { split /=/, $_, 2 } split /:/, $ENV{NYTPROF_TEST} | 
| '';

+# set some NYTProf options for this process in case 'extra tests' call
+# Devel::NYTProf::Data methods directly. This is a hack because the options
+# are global and there's no way to discover defaults or restore previous  
values.
+# So we just do trace for now.
+for my $opt (qw(trace)) {
+    DB::set_option($opt, $NYTPROF_TEST{$opt}) if defined  
$NYTPROF_TEST{$opt};
+}
+
+
  # but we'll force a specific test data file
  $NYTPROF_TEST{file} = $profile_datafile;

@@ -127,6 +136,7 @@
          }

          if ($extra_test_code) {
+            note("running $extra_test_count extra tests...");
              my $profile = eval { Devel::NYTProf::Data->new({filename =>  
$profile_datafile}) };
              if ($@) {
                  diag($@);
@@ -200,6 +210,7 @@
          warn "Error status $? from $cmd!\n";
          warn "NYTPROF=$ENV{NYTPROF}\n" if $ENV{NYTPROF} and not $opts{v};
          $show_stdout = 1;
+        sleep 2;
      }
      if ($show_stdout) { warn $_ for @results }
      return $ok;

Modified: trunk/t/test51-enable.t
==============================================================================
--- trunk/t/test51-enable.t     (original)
+++ trunk/t/test51-enable.t     Tue Jun  2 16:28:32 2009
@@ -16,14 +16,14 @@
          my $file_b = "nytprof-test51-b.out";
          my $file_c = "nytprof-test51-c.out";

-        my $pb = Devel::NYTProf::Data->new( { filename => $file_b, quiet  
=> 1 } );
+        my $pb = Devel::NYTProf::Data->new( { filename => $file_b, quiet  
=> 0 } );
          is_deeply(sub_calls($pb), {
              'main::sub1' => 1,
              'main::sub3' => 1,
              'DB::disable_profile' => 1,
          }, "$file_b sub calls");

-        my $pc = Devel::NYTProf::Data->new( { filename => $file_c, quiet  
=> 1 } );
+        my $pc = Devel::NYTProf::Data->new( { filename => $file_c, quiet  
=> 0 } );
          is_deeply(sub_calls($pc), {
              'main::sub7' => 1,
              'DB::finish_profile' => 1,

--~--~---------~--~----~------------~-------~--~----~
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