Author: tim.bunce
Date: Sun Jul  5 05:48:56 2009
New Revision: 803

Modified:
    trunk/Makefile.PL
    trunk/t/lib/NYTProfTest.pm
    trunk/t/test10.p
    trunk/t/test10.x

Log:
Use separate data file name for each test, so tests can be run concurrently.
Added 'prove' target to makefile that runs prove -j 9 for quicker testing.
Reduced time taken by t/test10.


Modified: trunk/Makefile.PL
==============================================================================
--- trunk/Makefile.PL   (original)
+++ trunk/Makefile.PL   Sun Jul  5 05:48:56 2009
@@ -184,6 +184,10 @@
  # add some extra utility targets to the make file
  sub post_constants {
      q{
+
+prove:: pure_all
+       time nice prove -j 9 --shuffle
+
  svnmanifest::
        svn list -R ....@head | sort | grep -v '/$$' > MANIFEST
        svn diff MANIFEST

Modified: trunk/t/lib/NYTProfTest.pm
==============================================================================
--- trunk/t/lib/NYTProfTest.pm  (original)
+++ trunk/t/lib/NYTProfTest.pm  Sun Jul  5 05:48:56 2009
@@ -17,8 +17,6 @@
  use Devel::NYTProf::Util qw(strip_prefix_from_paths html_safe_filename);


-my $profile_datafile = 'nytprof_t.out';     # non-default to test override  
works
-
  my $tests_per_extn = {p => 1, rdt => 1, x => 3};


@@ -52,9 +50,6 @@
  }


-# but we'll force a specific test data file
-$NYTPROF_TEST{file} = $profile_datafile;
-
  chdir('t') if -d 't';

  if (-d '../blib') {
@@ -128,6 +123,10 @@

      my %env_influence;

+    # non-default to test override works and allow parallel testing
+    my $profile_datafile = "nytprof_$group.out";
+    $NYTPROF_TEST{file} = $profile_datafile;
+
      for my $env (@env_combinations) {
          my $prev_failures = count_of_failed_tests();

@@ -142,7 +141,7 @@

          if ($extra_test_code) {
              note("running $extra_test_count extra tests...");
-            my $profile = eval { Devel::NYTProf::Data->new({filename =>  
$profile_datafile}) };
+            my $profile = eval { Devel::NYTProf::Data->new({ filename =>  
$profile_datafile }) };
              if ($@) {
                  diag($@);
                  fail("extra tests group '$group'") foreach (1 ..  
$extra_test_count);
@@ -192,6 +191,7 @@
      };
      my ($basename, $fork_seqn, $type) = ($1, $2 || 0, $3);

+    my $profile_datafile = $NYTPROF_TEST{file};
      my $test_datafile = (profile_datafiles($profile_datafile))[$fork_seqn];

      if ($type eq 'p') {

Modified: trunk/t/test10.p
==============================================================================
--- trunk/t/test10.p    (original)
+++ trunk/t/test10.p    Sun Jul  5 05:48:56 2009
@@ -1,2 +1,2 @@
-$code = eval 'sub { sleep 2; }';
+$code = eval 'sub { sleep 1; }';
  $code->();

Modified: trunk/t/test10.x
==============================================================================
--- trunk/t/test10.x    (original)
+++ trunk/t/test10.x    Sun Jul  5 05:48:56 2009
@@ -1,5 +1,5 @@
  # Profile data generated by Devel::NYTProf::Reader
  # More information at http://search.cpan.org/dist/Devel-NYTProf/
  # Format: time,calls,time/call,code
-~2,1,0,$code = eval 'sub { sleep 2; }';
+~1,1,0,$code = eval 'sub { sleep 1; }';
  0,1,0,$code->();

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