Merge branch 'master' into psgi
Florian Ragwitz [Sat, 4 Dec 2010 21:40:14 +0000 (21:40 +0000)]
master:
Stop passing along @INC
Use the proper way of setting @INC for tests
Aggregate http-server.t tests
Allow aggregating specific tests only
Use the harness instead of all of prove
Make the no-tabs test happy again

Makefile.PL
t/aggregate.t
t/author/http-server.t

index cb27dfe..c016f5a 100644 (file)
@@ -63,11 +63,13 @@ test_requires 'Test::More' => '0.88';
 test_requires 'Data::Dump';
 
 # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
-if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.35_05')) {
-    author_requires('Test::Aggregate', '0.35_05');
+if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.364')) {
+    author_requires('Test::Aggregate', '0.364');
     author_requires('Test::Simple', '0.88');
+    open my $fh, '>', '.aggregating';
 }
 else {
+    unlink '.aggregating';
     tests join q{ },
         grep { $_ ne 't/aggregate.t' }
         map  { glob } qw[t/*.t t/aggregate/*.t];
index 7943b5b..6722046 100644 (file)
@@ -7,14 +7,14 @@ use FindBin;
 use lib "$FindBin::Bin/lib";
 
 BEGIN {
-    unless (eval { require Test::Aggregate; Test::Aggregate->VERSION('0.35_05'); 1 }) {
+    unless (eval { require Test::Aggregate; Test::Aggregate->VERSION('0.364'); 1 }) {
         require Test::More;
-        Test::More::plan(skip_all => 'Test::Aggregate 0.35_05 required for test aggregation');
+        Test::More::plan(skip_all => 'Test::Aggregate 0.364 required for test aggregation');
     }
 }
 
 my $tests = Test::Aggregate->new({
-    dirs          => 't/aggregate',
+    (@ARGV ? (tests => \@ARGV) : (dirs => 't/aggregate')),
     verbose       => 0,
     set_filenames => 1,
     findbin       => 1,
index 8f60174..5f8a213 100644 (file)
@@ -49,12 +49,14 @@ while ( check_port( 'localhost', $port ) != 1 ) {
 # run the testsuite against the HTTP server
 $ENV{CATALYST_SERVER} = "http://localhost:$port";
 
+chdir '..';
+
 my $return;
 if ( $single_test ) {
-    $return = system( "$^X -I../lib/ $single_test" );
+    $return = system( "$^X -Ilib/ $single_test" );
 }
 else {
-    $return = prove( '-r', '-I../lib/', glob('../t/aggregate/live_*.t') );
+    $return = prove(grep { $_ ne '..' } glob('t/aggregate/live_*.t'));
 }
 
 # shut it down
@@ -84,11 +86,21 @@ sub check_port {
 }
 
 sub prove {
+    my (@tests) = @_;
     if (!(my $pid = fork)) {
-        require App::Prove;
-        my $prove = App::Prove->new;
-        $prove->process_args(@_);
-        exit( $prove->run ? 0 : 1 );
+        require TAP::Harness;
+
+        my $aggr = -e '.aggregating';
+        my $harness = TAP::Harness->new({
+            ($aggr ? (test_args => \@tests) : ()),
+            lib => ['lib'],
+        });
+
+        my $aggregator = $aggr
+            ? $harness->runtests('t/aggregate.t')
+            : $harness->runtests(@tests);
+
+        exit $aggregator->has_errors ? 1 : 0;
     } else {
         waitpid $pid, 0;
         return $?;