Fri Jul 3 15:41:37 2020 UTC ()
make(1): add test for :R modifier


(rillig)
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmisc.exp
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmisc.mk

cvs diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmisc.exp (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/modmisc.exp 2020/07/03 15:33:01 1.4
+++ src/usr.bin/make/unit-tests/modmisc.exp 2020/07/03 15:41:37 1.5
@@ -1,13 +1,14 @@ @@ -1,13 +1,14 @@
1path=':/bin:/tmp::/:.:/no/such/dir:.' 1path=':/bin:/tmp::/:.:/no/such/dir:.'
2path='/bin:/tmp:/:/no/such/dir' 2path='/bin:/tmp:/:/no/such/dir'
3path='/bin:/tmp:/:/no/such/dir' 3path='/bin:/tmp:/:/no/such/dir'
4path='/bin':'/tmp':'/':'/no/such/dir' 4path='/bin':'/tmp':'/':'/no/such/dir'
5path='/bin':'/tmp':'/':'/no/such/dir' 5path='/bin':'/tmp':'/':'/no/such/dir'
6path_/usr/xbin=/opt/xbin/ 6path_/usr/xbin=/opt/xbin/
7paths=/bin /tmp / /no/such/dir /opt/xbin 7paths=/bin /tmp / /no/such/dir /opt/xbin
8PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN 8PATHS=/BIN /TMP / /NO/SUCH/DIR /OPT/XBIN
9The answer is 42 9The answer is 42
10head of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b . . conf.d 10head of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b . . conf.d
11tail of 'a/b/c def archive.tar.gz conf.d/file' is 'c def archive.tar.gz file 11tail of 'a/b/c def archive.tar.gz conf.d/file' is 'c def archive.tar.gz file
12suffix of 'a/b/c def archive.tar.gz conf.d/file' is 'gz d/file 12suffix of 'a/b/c def archive.tar.gz conf.d/file' is 'gz d/file
 13root of 'a/b/c def archive.tar.gz conf.d/file' is 'a/b/c def archive.tar conf
13exit status 0 14exit status 0

cvs diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/modmisc.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/modmisc.mk 2020/07/03 15:33:01 1.4
+++ src/usr.bin/make/unit-tests/modmisc.mk 2020/07/03 15:41:37 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $Id: modmisc.mk,v 1.4 2020/07/03 15:33:01 rillig Exp $ 1# $Id: modmisc.mk,v 1.5 2020/07/03 15:41:37 rillig Exp $
2# 2#
3# miscellaneous modifier tests 3# miscellaneous modifier tests
4 4
5# do not put any dirs in this list which exist on some 5# do not put any dirs in this list which exist on some
6# but not all target systems - an exists() check is below. 6# but not all target systems - an exists() check is below.
7path=:/bin:/tmp::/:.:/no/such/dir:. 7path=:/bin:/tmp::/:.:/no/such/dir:.
8# strip cwd from path. 8# strip cwd from path.
9MOD_NODOT=S/:/ /g:N.:ts: 9MOD_NODOT=S/:/ /g:N.:ts:
10# and decorate, note that $'s need to be doubled. Also note that  10# and decorate, note that $'s need to be doubled. Also note that
11# the modifier_variable can be used with other modifiers. 11# the modifier_variable can be used with other modifiers.
12MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@ 12MOD_NODOTX=S/:/ /g:N.:@d@'$$d'@
13# another mod - pretend it is more interesting 13# another mod - pretend it is more interesting
14MOD_HOMES=S,/home/,/homes/, 14MOD_HOMES=S,/home/,/homes/,
@@ -32,13 +32,14 @@ path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/ @@ -32,13 +32,14 @@ path_$d?= ${d:${MOD_OPT}:${MOD_HOMES}}/
32paths+= ${d:${MOD_OPT}:${MOD_HOMES}} 32paths+= ${d:${MOD_OPT}:${MOD_HOMES}}
33.endfor 33.endfor
34 34
35modvarloop: 35modvarloop:
36 @echo "path_/usr/xbin=${path_/usr/xbin}" 36 @echo "path_/usr/xbin=${path_/usr/xbin}"
37 @echo "paths=${paths}" 37 @echo "paths=${paths}"
38 @echo "PATHS=${paths:tu}" 38 @echo "PATHS=${paths:tu}"
39 39
40PATHNAMES= a/b/c def archive.tar.gz conf.d/file 40PATHNAMES= a/b/c def archive.tar.gz conf.d/file
41mod-HTE: 41mod-HTE:
42 @echo "head of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q} 42 @echo "head of '"${PATHNAMES:Q}"' is '"${PATHNAMES:H:Q}
43 @echo "tail of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q} 43 @echo "tail of '"${PATHNAMES:Q}"' is '"${PATHNAMES:T:Q}
44 @echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q} 44 @echo "suffix of '"${PATHNAMES:Q}"' is '"${PATHNAMES:E:Q}
 45 @echo "root of '"${PATHNAMES:Q}"' is '"${PATHNAMES:R:Q}