1 | # $Id: root 2413 2010-09-11 17:43:04Z bird $ -*-perl-*-
|
---|
2 | ## @file
|
---|
3 | # $(root path...)
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008-2010 knut st. osmundsen <[email protected]>
|
---|
8 | #
|
---|
9 | # This file is part of kBuild.
|
---|
10 | #
|
---|
11 | # kBuild is free software; you can redistribute it and/or modify
|
---|
12 | # it under the terms of the GNU General Public License as published by
|
---|
13 | # the Free Software Foundation; either version 3 of the License, or
|
---|
14 | # (at your option) any later version.
|
---|
15 | #
|
---|
16 | # kBuild is distributed in the hope that it will be useful,
|
---|
17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
19 | # GNU General Public License for more details.
|
---|
20 | #
|
---|
21 | # You should have received a copy of the GNU General Public License
|
---|
22 | # along with kBuild. If not, see <http://www.gnu.org/licenses/>
|
---|
23 | #
|
---|
24 | #
|
---|
25 |
|
---|
26 | $description = "Tests the $(path ) function";
|
---|
27 |
|
---|
28 | $details = "Testing edges and some simple stuff.";
|
---|
29 |
|
---|
30 | if ($is_kmk) {
|
---|
31 |
|
---|
32 | # TEST #0 - check that the feature is present.
|
---|
33 | # --------------------------------------------
|
---|
34 | run_make_test('
|
---|
35 | ifneq ($(root /a),/)
|
---|
36 | $(error sub-test 0 failed)
|
---|
37 | endif
|
---|
38 | .PHONY: all
|
---|
39 | all: ; @:
|
---|
40 | ',
|
---|
41 | '',
|
---|
42 | '');
|
---|
43 |
|
---|
44 | # TEST #1 - the real test.
|
---|
45 | # ------------------------
|
---|
46 | run_make_test('
|
---|
47 | ifneq ($(root /asdf/asdf/adsf),/)
|
---|
48 | $(error sub-test 0 failed:$(root /asdf/asdf/adsf))
|
---|
49 | endif
|
---|
50 | ifneq ($(root asdf/asdf/adsf),)
|
---|
51 | $(error sub-test 1 failed)
|
---|
52 | endif
|
---|
53 | ifneq ($(root asdf/asdf/adsf/),)
|
---|
54 | $(error sub-test 2 failed)
|
---|
55 | endif
|
---|
56 | ifneq ($(root asdf/asdf/adsf/),)
|
---|
57 | $(error sub-test 3 failed)
|
---|
58 | endif
|
---|
59 | ifneq ($(root a),)
|
---|
60 | $(error sub-test 4 failed)
|
---|
61 | endif
|
---|
62 | ifneq ($(root ),)
|
---|
63 | $(error sub-test 5 failed)
|
---|
64 | endif
|
---|
65 | ifneq ($(root //a),//)
|
---|
66 | $(error sub-test 6 failed)
|
---|
67 | endif
|
---|
68 | ifneq ($(root /a),/)
|
---|
69 | $(error sub-test 7 failed)
|
---|
70 | endif
|
---|
71 | ifneq ($(root ///a),///)
|
---|
72 | $(error sub-test 8 failed)
|
---|
73 | endif
|
---|
74 | ifneq ($(root /a /b /c d /e),/ / / /)
|
---|
75 | $(error sub-test 9 failed)
|
---|
76 | endif
|
---|
77 |
|
---|
78 | .PHONY: all
|
---|
79 | all: ; @:
|
---|
80 | ',
|
---|
81 | '',
|
---|
82 | '');
|
---|
83 |
|
---|
84 |
|
---|
85 | # TEST #2 - DOS PATH stuff.
|
---|
86 | # ------------------------
|
---|
87 | if ($port_type eq 'W32' || $port_type eq 'OS/2' || $port_type eq 'DOS') {
|
---|
88 | run_make_test('
|
---|
89 | ifneq ($(root D:),D:)
|
---|
90 | $(error sub-test 0 failed)
|
---|
91 | endif
|
---|
92 | ifneq ($(root D:/),D:/)
|
---|
93 | $(error sub-test 1 failed)
|
---|
94 | endif
|
---|
95 | ifneq ($(root D:\\),D:\\)
|
---|
96 | $(error sub-test 2 failed)
|
---|
97 | endif
|
---|
98 | ifneq ($(root D:\\\\),D:\\\\)
|
---|
99 | $(error sub-test 3 failed)
|
---|
100 | endif
|
---|
101 | ifneq ($(root D:\\\\a),D:\\\\)
|
---|
102 | $(error sub-test 4 failed)
|
---|
103 | endif
|
---|
104 | ifneq ($(root D:\\/a),D:\\/)
|
---|
105 | $(error sub-test 5 failed)
|
---|
106 | endif
|
---|
107 | ifneq ($(root a:\\\\//asdf/asdf\\asdf),a:\\\\//)
|
---|
108 | $(error sub-test 6 failed)
|
---|
109 | endif
|
---|
110 | ifneq ($(root z://\\\\asdf/asdf\\asdf),z://\\\\)
|
---|
111 | $(error sub-test 7 failed)
|
---|
112 | endif
|
---|
113 |
|
---|
114 | .PHONY: all
|
---|
115 | all: ; @:
|
---|
116 | ',
|
---|
117 | '',
|
---|
118 | '');
|
---|
119 | }
|
---|
120 |
|
---|
121 | # TEST #3 - UNC PATH stuff.
|
---|
122 | # ------------------------
|
---|
123 | if ($port_type eq 'W32' || $port_type eq 'OS/2') {
|
---|
124 | run_make_test('
|
---|
125 | ifneq ($(root //./),//./)
|
---|
126 | $(error sub-test 0 failed)
|
---|
127 | endif
|
---|
128 | ifneq ($(root \\\\.\\),\\\\.\\)
|
---|
129 | $(error sub-test 1 failed)
|
---|
130 | endif
|
---|
131 | ifneq ($(root \\\\\\.\\),\\\\\\)
|
---|
132 | $(error sub-test 2 failed)
|
---|
133 | endif
|
---|
134 | ifneq ($(root ///.\\),///)
|
---|
135 | $(error sub-test 3 failed)
|
---|
136 | endif
|
---|
137 | ifneq ($(root /\\.\\),/\\.\\)
|
---|
138 | $(error sub-test 4 failed)
|
---|
139 | endif
|
---|
140 | ifneq ($(root \\/.\\),\\/.\\)
|
---|
141 | $(error sub-test 5 failed)
|
---|
142 | endif
|
---|
143 | ifneq ($(root //srv/),//srv/)
|
---|
144 | $(error sub-test 6 failed)
|
---|
145 | endif
|
---|
146 | ifneq ($(root //srv),)
|
---|
147 | $(error sub-test 7 failed)
|
---|
148 | endif
|
---|
149 | ifneq ($(root //srv/share),//srv/share)
|
---|
150 | $(error sub-test 8 failed)
|
---|
151 | endif
|
---|
152 | ifneq ($(root //srv/share/),//srv/share/)
|
---|
153 | $(error sub-test 9 failed)
|
---|
154 | endif
|
---|
155 | ifneq ($(root //srv/share/asdf),//srv/share/)
|
---|
156 | $(error sub-test 10 failed)
|
---|
157 | endif
|
---|
158 |
|
---|
159 | .PHONY: all
|
---|
160 | all: ; @:
|
---|
161 | ',
|
---|
162 | '',
|
---|
163 | '');
|
---|
164 | }
|
---|
165 |
|
---|
166 | }
|
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 | # Indicate that we're done.
|
---|
171 | 1;
|
---|
172 |
|
---|