mirror of
https://https.git.savannah.gnu.org/git/make.git
synced 2026-01-29 19:04:18 +00:00
When using Perl's backticks make sure that the path to the command invoked is quoted. On Windows, in particular, paths to commands such as diff, etc. may contain whitespace.
93 lines
1.8 KiB
Perl
93 lines
1.8 KiB
Perl
# -*-perl-*-
|
|
$description = "Test the realpath functions.";
|
|
|
|
$details = "";
|
|
|
|
# Check the local directory's realpath
|
|
run_make_test('
|
|
ifneq ($(realpath .),$(CURDIR))
|
|
$(warning $(realpath .) != $(CURDIR))
|
|
endif
|
|
|
|
ifneq ($(realpath ./),$(CURDIR))
|
|
$(warning $(realpath ./) != $(CURDIR))
|
|
endif
|
|
|
|
ifneq ($(realpath .///),$(CURDIR))
|
|
$(warning $(realpath .///) != $(CURDIR))
|
|
endif
|
|
|
|
.PHONY: all
|
|
all: ; @:
|
|
',
|
|
'', '');
|
|
|
|
# Find the realpath to the root of the partition
|
|
create_file('root.mk', 'all:;$(info $(realpath /))');
|
|
my $root = `"$make_path" -sf root.mk`;
|
|
unlink('root.mk');
|
|
$root =~ s/\r?\n//g;
|
|
|
|
my $tst = '
|
|
ifneq ($(realpath /.),#ROOT#)
|
|
$(warning $(realpath /.) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath /./),#ROOT#)
|
|
$(warning $(realpath /./) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath /.///),#ROOT#)
|
|
$(warning $(realpath /.///) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath /..),#ROOT#)
|
|
$(warning $(realpath /..) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath /../),#ROOT#)
|
|
$(warning $(realpath /../) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath /..///),#ROOT#)
|
|
$(warning $(realpath /..///) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath . /..),$(CURDIR) #ROOT#)
|
|
$(warning $(realpath . /..) != $(CURDIR) #ROOT#)
|
|
endif
|
|
|
|
.PHONY: all
|
|
all: ; @:
|
|
';
|
|
$tst =~ s/#ROOT#/$root/g;
|
|
run_make_test($tst, '', '');
|
|
|
|
# On Windows platforms "//" means something special. So, don't do these tests
|
|
# there.
|
|
|
|
if ($port_type ne 'W32') {
|
|
$tst = '
|
|
ifneq ($(realpath ///),#ROOT#)
|
|
$(warning $(realpath ///) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath ///.),#ROOT#)
|
|
$(warning $(realpath ///.) != #ROOT#)
|
|
endif
|
|
|
|
ifneq ($(realpath ///..),#ROOT#)
|
|
$(warning $(realpath ///..) != #ROOT#)
|
|
endif
|
|
|
|
.PHONY: all
|
|
all: ; @:';
|
|
$tst =~ s/#ROOT#/$root/g;
|
|
|
|
run_make_test($tst, '', '');
|
|
}
|
|
|
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
1;
|