[Libsysio-commit] HEAD: libsysio/tests test_getcwd.pl
Brought to you by:
lward
From: Sonja T. <so...@us...> - 2004-03-12 21:46:00
|
Update of /cvsroot/libsysio/libsysio/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22126/tests Modified Files: test_getcwd.pl Log Message: Fix bug in test_getcwd.pl that caused a failure when the cwd had a symlink somewhere along its path. Index: test_getcwd.pl =================================================================== RCS file: /cvsroot/libsysio/libsysio/tests/test_getcwd.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -b -B -p -r1.5 -r1.6 --- test_getcwd.pl 21 Jan 2004 15:13:56 -0000 1.5 +++ test_getcwd.pl 12 Mar 2004 21:18:18 -0000 1.6 @@ -6,6 +6,8 @@ use strict; use FindBin; use lib "$FindBin::Bin"; use helper; +use Fcntl ':mode'; + sub usage { @@ -35,9 +37,15 @@ sub check_wkdir my $iodir = <$outfh>; chop($iodir); - if ($wdir ne $iodir) { - helper::print_and_exit($cmdfh, $outfh, 0, - "ERROR! wdir ($wdir) does not match sysio's cwd ($iodir)\n"); + # Only compare the last portion of the working directory + my @iodirs = split(/\//, $iodir); + my @wdirs = split(/\//, $wdir); + + if ($iodirs[-1] ne $wdirs[-1]) { + helper::print_and_exit + ($cmdfh, + $outfh, 0, + "ERROR! topmost wdir ($wdirs[-1]) does not match sysio's ($iodirs[-1])\n"); } } @@ -75,7 +83,7 @@ sub process_cmd # Get current working directory from environment my $cwd = $ENV{PWD}; - check_wkdir($cwd, $outfh, $cmdfh); + } # Now change to dir |