X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/028bf728e74682b00bb4314e33ce78574dee577a..da5a0da22ef5f5dd64e1fcdcac2c5ed1c0398085:/t/lib/cygwin.t diff --git a/t/lib/cygwin.t b/t/lib/cygwin.t index 9033d3f..ba86170 100644 --- a/t/lib/cygwin.t +++ b/t/lib/cygwin.t @@ -52,13 +52,16 @@ is(Cygwin::mount_flags("/cygdrive") =~ /,cygdrive/, 1, "check cygdrive mount_fl # Cygdrive mount prefix my @flags = split(/,/, Cygwin::mount_flags('/cygdrive')); my $prefix = pop(@flags); -ok($prefix, "cygdrive mount prefix = " . (($prefix) ? $prefix : '')); -chomp(my $prefix2 = `df | grep -i '^c: ' | cut -d% -f2 | xargs`); -$prefix2 =~ s/\/c$//i; -if (! $prefix2) { - $prefix2 = '/'; +ok($prefix, "cygdrive mount prefix = " . (($prefix) ? $prefix : '')); +my $prefix2 = readlink "/proc/cygdrive"; +unless ($prefix2) { + # fallback to old Cygwin, the drive need not actually exist, so + # this will always work (but might return the wrong prefix if the + # user re-mounted C:\ + chomp($prefix2 = `cygpath C:`); + $prefix2 = substr($prefix2, 0, -1-(length($prefix2)>2)); } -is($prefix, $prefix2, 'cygdrive mount prefix'); +is($prefix, $prefix2, 'cygdrive mount prefix2 = ' . $prefix2); my @mnttbl = Cygwin::mount_table(); ok(@mnttbl > 0, "non empty mount_table");