Port to Solaris 8 perl, which does not support "use warnings;".
[coreutils.git] / tests / rm / empty-name
bloba2af5be4cf0b64178bb3568d422c323b5883adbb
1 #!/bin/sh
2 # Make sure that rm -r '' fails.
4 # Copyright (C) 1998, 2003, 2005, 2007 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
20 # On SunOS 4.1.3, running rm -r '' in a nonempty directory may
21 # actually remove files with names of entries in the current directory
22 # but relative to `/' rather than relative to the current directory.
24 : ${PERL=perl}
25 : ${srcdir=.}
27 $PERL -e 'use warnings;' > /dev/null 2>&1 || {
28 echo 1>&2 "$0: configure didn't find a usable version of Perl," \
29 "so can't run this test"
30 exit 77
33 me=`echo $0|sed 's,.*/,,'`
34 exec $PERL -w -I$srcdir/.. -MCoreutils -M"CuTmpdir qw($me)" -- - << \EOF
35 require 5.003;
36 use strict;
38 (my $program_name = $0) =~ s|.*/||;
40 # Turn off localisation of executable's ouput.
41 @ENV{qw(LANGUAGE LANG LC_ALL)} = ('C') x 3;
43 my $prog = 'rm';
45 my @Tests =
47 # test-name options input expected-output
49 ['empty-name-1', "''", {EXIT => 1},
50 {ERR => "$prog: cannot remove `': No such file or directory\n"}],
53 my $save_temps = $ENV{SAVE_TEMPS};
54 my $verbose = $ENV{VERBOSE};
56 my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);
57 exit $fail;
58 EOF