Initial attempt at putting podcheck.t on a diet.
authorCraig A. Berry <craigberry@mac.com>
Sat, 13 Aug 2011 15:35:12 +0000 (10:35 -0500)
committerCraig A. Berry <craigberry@mac.com>
Sat, 13 Aug 2011 16:01:52 +0000 (11:01 -0500)
The current design of this test is to scan *every* file in a dirty
build directory to see if it contains POD, excluding only a short
list of files and file types that it knows about.  This means that
on most platforms it was scanning executable code, object code,
object libraries, dynamic libraries, and many other build products
too numerous to mention.

The present commit expands the exclusion list considerably and
makes that list slightly more cross-platform, but it's probably
still quite incomplete.  Whether that list is even worth
maintaining or the test should be based on an inclusion list
rather than an exclusion list is a question worth asking.

On my system, the present austerity measures, despite the addition
of Config, reduce memory consumption by 14% (but it's still a pig,
gulping something like 160MB).  Physical I/O is reduced by 105%
and elapsed time by 25%.

t/porting/podcheck.t

index 2bfddfd..a1f35a1 100644 (file)
@@ -5,6 +5,7 @@ use warnings;
 use feature 'unicode_strings';
 
 use Carp;
+use Config;
 use Digest;
 use File::Find;
 use File::Spec;
@@ -300,14 +301,40 @@ my $missing_name_description = "The NAME should have a dash and short descriptio
 # objects, tests, etc can't be pods, so don't look for them. Also skip
 # files output by the patch program.  Could also ignore most of .gitignore
 # files, but not all, so don't.
+
+my $obj_ext = $Config{'obj_ext'}; $obj_ext =~ tr/.//d; # dot will be added back
+my $lib_ext = $Config{'lib_ext'}; $lib_ext =~ tr/.//d;
+my $lib_so  = $Config{'so'};      $lib_so  =~ tr/.//d;
+my $dl_ext  = $Config{'dlext'};   $dl_ext  =~ tr/.//d;
+
 my $non_pods = qr/ (?: \.
-                       (?: [achot]  | zip | gz | bz2 | jar | tar | tgz | PL | so
+                       (?: [achot]  | zip | gz | bz2 | jar | tar | tgz | PL
                            | orig | rej | patch   # Patch program output
                            | sw[op] | \#.*  # Editor droppings
                            | old      # buildtoc output
+                           | xs       # pod should be in the .pm file
+                           | al       # autosplit files
+                           | bs       # bootstrap files
+                           | (?i:sh)  # shell scripts, hints, templates
+                           | lst      # assorted listing files
+                           | bat      # Windows,Netware,OS2 batch files
+                           | cmd      # Windows,Netware,OS2 command files
+                           | lis      # VMS compiler listings
+                           | map      # VMS linker maps
+                           | opt      # VMS linker options files
+                           | mms      # MM(K|S) description files
+                           | ts       # timestamp files generated during build
+                           | $obj_ext # object files
+                           | exe      # $Config{'exe_ext'} might be empty string
+                           | $lib_ext # object libraries
+                           | $lib_so  # shared libraries
+                           | $dl_ext  # dynamic libraries
                        )
                        $
                     ) | ~$ | \ \(Autosaved\)\.txt$ # Other editor droppings
+                           | ^cxx\$demangler_db\.$ # VMS name mangler database
+                           | ^typemap\.?$          # typemap files
+                           | ^(?i:Makefile\.PL)$
                 /x;
 
 
@@ -1179,8 +1206,12 @@ sub is_pod_file {
         return;
     }
 
-    return if $_ =~ /^\./;           # No hidden Unix files
-    return if $_ =~ $non_pods;
+    if ($_ =~ /^\./           # No hidden Unix files
+        || $_ =~ $non_pods) {
+        note("Not considering $_") if DEBUG;
+        return;
+    }
+               
 
     my $filename = $File::Find::name;