[svn:Module-Build] r13192 - in Module-Build/trunk: . lib/Module/Build t t/lib

[email protected] Mon, 10 Aug 2009 06:05:42 -0700 (PDT)
Newsgroups perl.module.build.checkins
Message-ID <[email protected]>
Author: dagolden
Date: Mon Aug 10 06:05:40 2009
New Revision: 13192

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Compat.pm
   Module-Build/trunk/t/PL_files.t
   Module-Build/trunk/t/add_property.t
   Module-Build/trunk/t/help.t
   Module-Build/trunk/t/lib/DistGen.pm
   Module-Build/trunk/t/script_dist.t
   Module-Build/trunk/t/tilde.t
   Module-Build/trunk/t/write_default_maniskip.t

Log:
Multiple test fixes for OS2

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes	(original)
+++ Module-Build/trunk/Changes	Mon Aug 10 06:05:40 2009
@@ -2,6 +2,9 @@
 
 0.34_06 - 
 
+ Bug fixes:
+ - Multiple test fixes for OS2 [Ilya Zakharevich]
+
 0.34_05 - Sun Aug  9 22:31:37 EDT 2009
 
  Bug fixes:

Modified: Module-Build/trunk/lib/Module/Build/Compat.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Compat.pm	(original)
+++ Module-Build/trunk/lib/Module/Build/Compat.pm	Mon Aug 10 06:05:40 2009
@@ -318,7 +318,9 @@
   my $unlink = $class->oneliner('1 while unlink $ARGV[0]', [], [$args{makefile}]);
   $unlink =~ s/\$/\$\$/g unless $class->is_vmsish;
 
-  my $maketext = <<"EOF";
+  my $maketext = ($^O eq 'os2' ? "SHELL = sh\n\n" : '');
+
+  $maketext .= <<"EOF";
 all : force_do_it
 	$perl $Build
 realclean : force_do_it

Modified: Module-Build/trunk/t/PL_files.t
==============================================================================
--- Module-Build/trunk/t/PL_files.t	(original)
+++ Module-Build/trunk/t/PL_files.t	Mon Aug 10 06:05:40 2009
@@ -82,5 +82,5 @@
     my %cleanup = map { $_ => 1 } $mb->cleanup;
     is($cleanup{foo}, undef, "generated special file not added to cleanup");
 
-
+    $dist->chdir_original if $dist->did_chdir;
 }

Modified: Module-Build/trunk/t/add_property.t
==============================================================================
--- Module-Build/trunk/t/add_property.t	(original)
+++ Module-Build/trunk/t/add_property.t	Mon Aug 10 06:05:40 2009
@@ -91,3 +91,5 @@
 ok $err = $@, 'Should catch exception for invalid "installdirs" value';
 like $err, qr/ERROR: installdirs must be one of "core", "site", or "vendor"/,
   'And it should suggest the proper values in the error message';
+
+$dist->chdir_original if $dist->did_chdir;

Modified: Module-Build/trunk/t/help.t
==============================================================================
--- Module-Build/trunk/t/help.t	(original)
+++ Module-Build/trunk/t/help.t	Mon Aug 10 06:05:40 2009
@@ -22,7 +22,7 @@
 
 my $restart = sub {
   $dist->clean();
-  chdir( $cwd );
+  DistGen::chdir_all( $cwd );
   File::Path::rmtree( $tmp );
   # we're redefining the same package as we go, so...
   delete($::{'MyModuleBuilder::'});
@@ -274,7 +274,7 @@
 
 # cleanup
 $dist->clean();
-chdir( $cwd );
+DistGen::chdir_all($cwd);
 File::Path::rmtree( $tmp );
 
 # vim:ts=2:sw=2:et:sta

Modified: Module-Build/trunk/t/lib/DistGen.pm
==============================================================================
--- Module-Build/trunk/t/lib/DistGen.pm	(original)
+++ Module-Build/trunk/t/lib/DistGen.pm	Mon Aug 10 06:05:40 2009
@@ -62,6 +62,13 @@
 
   return($string);
 }
+
+sub chdir_all ($) {
+  # OS/2 has "current directory per disk", undeletable; 
+  # doing chdir() to another disk won't change cur-dir of initial disk...
+  chdir('/') if $^O eq 'os2';
+  chdir shift;
+}
 ########################################################################
 
 sub new {
@@ -388,7 +395,7 @@
     }
   }, ($^O eq 'VMS' ? './' : File::Spec->curdir) );
 
-  chdir( $here );
+  chdir_all( $here );
 }
 
 sub remove {
@@ -478,7 +485,7 @@
 
   croak("never called chdir_in()") unless($self->{original_dir});
   my $dir = $self->{original_dir};
-  chdir($dir) or die "Can't chdir to '$dir': $!";
+  chdir_all($dir) or die "Can't chdir to '$dir': $!";
 }
 ########################################################################
 

Modified: Module-Build/trunk/t/script_dist.t
==============================================================================
--- Module-Build/trunk/t/script_dist.t	(original)
+++ Module-Build/trunk/t/script_dist.t	Mon Aug 10 06:05:40 2009
@@ -77,3 +77,4 @@
   my $yml = YAML::LoadFile('META.yml');
   is_deeply($yml->{provides}, \%meta_provides);
 }
+$dist->chdir_original if $dist->did_chdir;

Modified: Module-Build/trunk/t/tilde.t
==============================================================================
--- Module-Build/trunk/t/tilde.t	(original)
+++ Module-Build/trunk/t/tilde.t	Mon Aug 10 06:05:40 2009
@@ -55,10 +55,6 @@
 
     is( run_sample( $p => '~/foo' )->$p(),  "$home/foo" );
 
-    is( run_sample( $p => '~~'    )->$p(),  '~~' );
-
-    is( run_sample( $p => '~ foo' )->$p(),  '~ foo' );
-
     is( run_sample( $p => '~/ foo')->$p(),  "$home/ foo" );
       
     is( run_sample( $p => '~/fo o')->$p(),  "$home/fo o" );
@@ -91,6 +87,10 @@
 
     $mb->$p('~');
     is( $mb->$p(),      '~', 'API does not expand tildes' );
+
+    skip "On OS/2 EMX all users are equal", 2 if $^O eq 'os2';
+    is( run_sample( $p => '~~'    )->$p(),  '~~' );
+    is( run_sample( $p => '~ foo' )->$p(),  '~ foo' );
 }
 
 # Again, with named users

Modified: Module-Build/trunk/t/write_default_maniskip.t
==============================================================================
--- Module-Build/trunk/t/write_default_maniskip.t	(original)
+++ Module-Build/trunk/t/write_default_maniskip.t	Mon Aug 10 06:05:40 2009
@@ -5,11 +5,14 @@
 
 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
 use MBTest 'no_plan';
+use DistGen;
+use Cwd;
 
 use_ok 'Module::Build';
 ensure_blib 'Module::Build';
 
 {
+    my $cwd = Cwd::cwd;
     chdir MBTest->tmpdir();
 
     my $build = Module::Build->new(
@@ -34,4 +37,6 @@
     like $have, qr/^\Q$head\E/, "default MANIFEST.SKIP used";
     like $have, qr/^# Avoid Module::Build generated /ms, "Module::Build specific entries";
     like $have, qr/Foo-Bar-/, "distribution tarball entry";
+
+    DistGen::chdir_all($cwd);
 }