summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Carvalho <mestre.smash@gmail.com>2010-12-24 23:10:49 +0000
committerCraig A. Berry <craigberry@mac.com>2011-01-02 21:58:52 -0600
commitf52c37b45fe0cf91d5a5c7d022a895b84edc08dc (patch)
tree6383f590ad11d686c4a8e62a67ad1f7615c54cb2
parent4b0f0df66552ad75ebcd3783df216fe47ab04e0b (diff)
downloadperl-f52c37b45fe0cf91d5a5c7d022a895b84edc08dc.tar.gz
Add new test file t/porting/filenames.t
Check portability of filenames from the MANIFEST. Modified by committer to remove check for multiple dots -- there are already too many violations and there are workarounds to handle them. Also tweaked to report full path so it's easier to find culprits. Still need checks for dots in directory names and paths that differ only by case.
-rw-r--r--AUTHORS1
-rw-r--r--MANIFEST1
-rw-r--r--t/porting/filenames.t87
3 files changed, 89 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index df09569ca5..f27059d4bf 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -771,6 +771,7 @@ Noah <sitz@onastick.net>
Norbert Pueschel <pueschel@imsdd.meb.uni-bonn.de>
Norio Suzuki <kipp@shonanblue.ne.jp>
Norton T. Allen <allen@huarp.harvard.edu>
+Nuno Carvalho <mestre.smash@gmail.com>
Offer Kaye <offer.kaye@gmail.com>
Olaf Flebbe <o.flebbe@science-computing.de>
Olaf Titz <olaf@bigred.inka.de>
diff --git a/MANIFEST b/MANIFEST
index fa0262a381..bd787aca44 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4870,6 +4870,7 @@ t/porting/checkcase.t Check whether we are case-insensitive-fs-friendly
t/porting/diag.t Test completeness of perldiag.pod
t/porting/dual-life.t Check that dual-life bins are in utils/
t/porting/exec-bit.t Check that exec-bit bins are identified
+t/porting/filenames.t Check the MANIFEST for filename portability.
t/porting/FindExt.t Test win32/FindExt.pm
t/porting/maintainers.t Test that Porting/Maintaners.pl is up to date
t/porting/manifest.t Test that this MANIFEST file is well formed
diff --git a/t/porting/filenames.t b/t/porting/filenames.t
new file mode 100644
index 0000000000..07232c4b3d
--- /dev/null
+++ b/t/porting/filenames.t
@@ -0,0 +1,87 @@
+#!./perl -w
+
+=head1 filenames.t
+
+Test the well-formed-ness of filenames names in the MANIFEST file. Current
+tests being done:
+
+=over 4
+
+=item * no more than 39 characters before the dot, and 39 after
+
+=item * no filenames starting with -
+
+=item * don't use any of these names (regardless of case) before the dot: CON,
+PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1,
+LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9
+
+=item * no spaces, ( or & in filenames
+
+=back
+
+=cut
+
+BEGIN {
+ chdir 't';
+ @INC = '../lib';
+}
+
+use strict;
+use File::Spec;
+use File::Basename;
+require './test.pl';
+
+plan('no_plan');
+
+my $manifest = File::Spec->catfile(File::Spec->updir(), 'MANIFEST');
+
+my @dont = qw/CON PRN AUX NUL COM1 COM2 COM3 COM4 COM5 COM6 COM7 COM8 COM9 LPT1 LPT2 LPT3 LPT4 LPT5 LPT6 LPT7 LPT8 LPT9/;
+my @more_dont = ('\s','\(','\&');
+
+open my $m, '<', $manifest or die "Can't open '$manifest': $!";
+my @files;
+while (<$m>) {
+ chomp;
+ my($path) = split /\t+/;
+
+ validate_file_name($path);
+}
+close $m or die $!;
+
+sub validate_file_name {
+ my $path = shift;
+ my $filename = basename $path;
+
+ if ($filename =~ m/^\-/) {
+ fail("starts with -: $path");
+ return;
+ }
+
+ my($before, $after) = split /\./, $filename;
+ if (length $before > 39) {
+ fail("more than 39 characters before the dot: $path");
+ return;
+ }
+ if ($after and (length $after > 39)) {
+ fail("more than 39 characters after the dot: $path");
+ return;
+ }
+
+ foreach (@dont) {
+ if ($filename =~ m/^$_\./i) {
+ fail("found $_ before the dot: $path");
+ return;
+ }
+ }
+
+ foreach (@more_dont) {
+ if ($filename =~ m/$_/) {
+ fail("found $_: $path");
+ return;
+ }
+ }
+
+ ok($filename, $filename);
+}
+
+# EOF