| 1 |
# -*-perl-*- |
| 2 |
$description = "Test the realpath functions."; |
| 3 |
|
| 4 |
$details = ""; |
| 5 |
|
| 6 |
# Check the local directory's realpath |
| 7 |
run_make_test(' |
| 8 |
ifneq ($(realpath .),$(CURDIR)) |
| 9 |
$(warning $(realpath .) != $(CURDIR)) |
| 10 |
endif |
| 11 |
|
| 12 |
ifneq ($(realpath ./),$(CURDIR)) |
| 13 |
$(warning $(realpath ./) != $(CURDIR)) |
| 14 |
endif |
| 15 |
|
| 16 |
ifneq ($(realpath .///),$(CURDIR)) |
| 17 |
$(warning $(realpath .///) != $(CURDIR)) |
| 18 |
endif |
| 19 |
|
| 20 |
.PHONY: all |
| 21 |
all: ; @: |
| 22 |
', |
| 23 |
'', ''); |
| 24 |
|
| 25 |
# Find the realpath to the root of the partition |
| 26 |
create_file('root.mk', 'all:;$(info $(realpath /))'); |
| 27 |
my $root = `$make_path -sf root.mk`; |
| 28 |
unlink('root.mk'); |
| 29 |
$root =~ s/\r?\n//g; |
| 30 |
|
| 31 |
my $tst = ' |
| 32 |
ifneq ($(realpath /.),#ROOT#) |
| 33 |
$(warning $(realpath /.) != #ROOT#) |
| 34 |
endif |
| 35 |
|
| 36 |
ifneq ($(realpath /./),#ROOT#) |
| 37 |
$(warning $(realpath /./) != #ROOT#) |
| 38 |
endif |
| 39 |
|
| 40 |
ifneq ($(realpath /.///),#ROOT#) |
| 41 |
$(warning $(realpath /.///) != #ROOT#) |
| 42 |
endif |
| 43 |
|
| 44 |
ifneq ($(realpath /..),#ROOT#) |
| 45 |
$(warning $(realpath /..) != #ROOT#) |
| 46 |
endif |
| 47 |
|
| 48 |
ifneq ($(realpath /../),#ROOT#) |
| 49 |
$(warning $(realpath /../) != #ROOT#) |
| 50 |
endif |
| 51 |
|
| 52 |
ifneq ($(realpath /..///),#ROOT#) |
| 53 |
$(warning $(realpath /..///) != #ROOT#) |
| 54 |
endif |
| 55 |
|
| 56 |
ifneq ($(realpath . /..),$(CURDIR) #ROOT#) |
| 57 |
$(warning $(realpath . /..) != $(CURDIR) #ROOT#) |
| 58 |
endif |
| 59 |
|
| 60 |
.PHONY: all |
| 61 |
all: ; @: |
| 62 |
'; |
| 63 |
$tst =~ s/#ROOT#/$root/g; |
| 64 |
run_make_test($tst, '', ''); |
| 65 |
|
| 66 |
# On Windows platforms "//" means something special. So, don't do these tests |
| 67 |
# there. |
| 68 |
|
| 69 |
if ($port_type ne 'W32') { |
| 70 |
$tst = ' |
| 71 |
ifneq ($(realpath ///),#ROOT#) |
| 72 |
$(warning $(realpath ///) != #ROOT#) |
| 73 |
endif |
| 74 |
|
| 75 |
ifneq ($(realpath ///.),#ROOT#) |
| 76 |
$(warning $(realpath ///.) != #ROOT#) |
| 77 |
endif |
| 78 |
|
| 79 |
ifneq ($(realpath ///..),#ROOT#) |
| 80 |
$(warning $(realpath ///..) != #ROOT#) |
| 81 |
endif |
| 82 |
|
| 83 |
.PHONY: all |
| 84 |
all: ; @:'; |
| 85 |
$tst =~ s/#ROOT#/$root/g; |
| 86 |
|
| 87 |
run_make_test($tst, '', ''); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
# This tells the test driver that the perl test script executed properly. |
| 92 |
1; |