Move a number of tests to xt, restructure extra lists
Peter Rabbitson [Thu, 26 Feb 2015 18:46:47 +0000 (19:46 +0100)]
Instead of the rigid t / xt separation, add more nuance and move some heavy
tests around, in order to improve regular user test times, without
sacrificing cpantesters coverage

Additionally makes it more obvious which tests are decidedly not being run
on user-side installs

Minimal changes: read diff under -C -C -M

28 files changed:
Makefile.PL
maint/Makefile.PL.inc/11_authortests.pl
maint/travis-ci_scripts/20_install.bash
xt/dist/authors.t [moved from xt/authors.t with 100% similarity]
xt/dist/loadable_standalone_testschema_resultclasses.t [moved from xt/standalone_testschema_resultclasses.t with 100% similarity]
xt/dist/pod_coverage.t [moved from xt/podcoverage.t with 100% similarity]
xt/dist/postdistdir/pod_footers.t [moved from xt/footers.t with 100% similarity]
xt/dist/postdistdir/pod_validity.t [moved from xt/pod.t with 100% similarity]
xt/dist/postdistdir/whitespace.t [moved from xt/whitespace.t with 100% similarity]
xt/dist/strictures.t [moved from xt/strictures.t with 100% similarity]
xt/extra/c3_mro.t [moved from t/04_c3_mro.t with 100% similarity]
xt/extra/dbicadmin.t [moved from t/admin/10script.t with 100% similarity]
xt/extra/diagnostics/deprecated_rs_attributes.t [moved from t/search/deprecated_attributes.t with 100% similarity]
xt/extra/diagnostics/malformed_rel_declaration.t [moved from t/relationship/malformed_declaration.t with 100% similarity]
xt/extra/diagnostics/many_to_many_warning.t [moved from t/103many_to_many_warning.t with 100% similarity]
xt/extra/diagnostics/resultset_manager.t [moved from t/40resultsetmanager.t with 100% similarity]
xt/extra/diagnostics/search_in_void_ctx.t [moved from t/search/void.t with 100% similarity]
xt/extra/diagnostics/unresolvable_relationship.t [moved from t/relationship/unresolvable.t with 100% similarity]
xt/extra/internals/dbictest_unlink_guard.t [moved from xt/dbictest_unlink_guard.t with 100% similarity]
xt/extra/internals/discard_changes_in_DESTROY.t [moved from t/discard_changes_in_DESTROY.t with 100% similarity]
xt/extra/internals/ensure_class_loaded.t [moved from t/90ensure_class_loaded.t with 100% similarity]
xt/extra/internals/merge_joinpref_attr.t [moved from t/91merge_joinpref_attr.t with 100% similarity]
xt/extra/internals/namespaces_cleaned.t [moved from t/55namespaces_cleaned.t with 97% similarity]
xt/extra/internals/optional_deps.t [moved from xt/optional_deps.t with 100% similarity]
xt/extra/internals/quote_sub.t [moved from xt/quote_sub.t with 100% similarity]
xt/extra/lean_startup.t [moved from t/53lean_startup.t with 100% similarity]
xt/extra/multicreate_opcount.t [moved from t/multi_create/reentrance_count.t with 100% similarity]
xt/extra/sqlite_deadlock.t [moved from t/zzzzzzz_sqlite_deadlock.t with 100% similarity]

index 172cb66..03de9d1 100644 (file)
@@ -113,9 +113,18 @@ if ($ENV{DBICTEST_SQLT_DEPLOY}) {
   }
 }
 
-tests_recursive (qw|
-    t
-|);
+tests_recursive (
+  't',
+  ( (
+    $Module::Install::AUTHOR
+      or
+    $ENV{DBICTEST_RUN_ALL_TESTS}
+      or
+    ( $ENV{TRAVIS}||'' ) eq 'true'
+      or
+    ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL5_CPANM_IS_RUNNING} and ! $ENV{RELEASE_TESTING} )
+  ) ? 'xt' : () ),
+);
 
 install_script (qw|
     script/dbicadmin
index 442b672..7760de2 100644 (file)
@@ -1,18 +1,15 @@
 require File::Spec;
 require File::Find;
 
-my $xt_dirs;
+my $xt_dist_dirs;
 File::Find::find(sub {
-  return if $xt_dirs->{$File::Find::dir};
-  $xt_dirs->{$File::Find::dir} = 1 if (
+  return if $xt_dist_dirs->{$File::Find::dir};
+  $xt_dist_dirs->{$File::Find::dir} = 1 if (
     $_ =~ /\.t$/ and -f $_
   );
-}, 'xt');
+}, 'xt/dist');
 
-my @xt_tests = map { File::Spec->catfile($_, '*.t') } sort keys %$xt_dirs;
-
-# this will add the xt tests to the `make test` target among other things
-Meta->tests(join (' ', map { $_ || () } @xt_tests, Meta->tests ) );
+my @xt_dist_tests = map { File::Spec->catfile($_, '*.t') } sort keys %$xt_dist_dirs;
 
 # inject an explicit xt test run, mainly to check the contents of
 # lib and the generated POD's *before* anything is copied around
@@ -38,7 +35,7 @@ test_xt : pm_to_blib
     ),
     # test list
     join( ' ',
-      map { $mm_proto->quote_literal($_) } @xt_tests
+      map { $mm_proto->quote_literal($_) } @xt_dist_tests
     ),
   )
 ]}
@@ -55,7 +52,7 @@ dbic_distdir_retest_ws_and_footers :
         '$(ABSPERLRUN)',
         map { $mm_proto->quote_literal($_) } qw(-Ilib -e $ENV{RELEASE_TESTING}=1;$ENV{DBICTEST_NO_MAKEFILE_VERIFICATION}=1;)
       ),
-      'xt/whitespace.t xt/footers.t',
+      'xt/dist/postdistdir/*.t',
     )
   )
 ]}
index a3d1c70..f67cd8b 100755 (executable)
@@ -86,6 +86,7 @@ if [[ "$POISON_ENV" = "true" ]] ; then
   # returned results, look through lib, find all mentioned ENVvars and
   # set them to true and see if anything explodes
   for var in \
+    DBICTEST_RUN_ALL_TESTS \
     DBICTEST_SQLITE_REVERSE_DEFAULT_ORDER \
     $( grep -P '\$ENV\{' -r lib/ --exclude-dir Optional | grep -oP '\bDBIC\w+' | sort -u | grep -vP '^(DBIC_TRACE(_PROFILE)?|DBIC_.+_DEBUG)$' )
   do
similarity index 100%
rename from xt/authors.t
rename to xt/dist/authors.t
similarity index 100%
rename from xt/podcoverage.t
rename to xt/dist/pod_coverage.t
similarity index 100%
rename from xt/pod.t
rename to xt/dist/postdistdir/pod_validity.t
similarity index 100%
rename from xt/strictures.t
rename to xt/dist/strictures.t
similarity index 100%
rename from t/04_c3_mro.t
rename to xt/extra/c3_mro.t
similarity index 100%
rename from t/admin/10script.t
rename to xt/extra/dbicadmin.t
similarity index 97%
rename from t/55namespaces_cleaned.t
rename to xt/extra/internals/namespaces_cleaned.t
index 4992a99..0023602 100644 (file)
@@ -37,12 +37,6 @@ use Test::More;
 
 use lib 't/lib';
 
-BEGIN {
-  require DBICTest::RunMode;
-  plan( skip_all => "Skipping test on plain module install" )
-    if DBICTest::RunMode->is_plain;
-}
-
 use DBICTest;
 use File::Find;
 use File::Spec;
similarity index 100%
rename from t/53lean_startup.t
rename to xt/extra/lean_startup.t