pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/regress/make-quoting Imported make-quoting, a regressi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d137b5c850c6
branches:  trunk
changeset: 493844:d137b5c850c6
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sun May 15 21:10:16 2005 +0000

description:
Imported make-quoting, a regression test to make sure various weird quoting
styles stay valid when updating the pkgsrc make(1) program. The test cases
also serve as kind of demonstration how things work inside make(1).

diffstat:

 regress/make-quoting/Makefile           |  26 ++++++++++++++++++++++++++
 regress/make-quoting/files/continue.mk  |  19 +++++++++++++++++++
 regress/make-quoting/files/continue.out |   7 +++++++
 regress/make-quoting/files/dblquote.mk  |  13 +++++++++++++
 regress/make-quoting/files/dblquote.out |   2 ++
 regress/make-quoting/files/for.mk       |  11 +++++++++++
 regress/make-quoting/files/for.out      |   7 +++++++
 regress/make-quoting/files/ltarget.mk   |  13 +++++++++++++
 regress/make-quoting/files/ltarget.out  |   1 +
 regress/make-quoting/files/nestfor.mk   |  17 +++++++++++++++++
 regress/make-quoting/files/nestfor.out  |   1 +
 regress/make-quoting/files/quoting.mk   |  16 ++++++++++++++++
 regress/make-quoting/files/quoting.out  |   6 ++++++
 regress/make-quoting/files/sglquote.mk  |  16 ++++++++++++++++
 regress/make-quoting/files/sglquote.out |   6 ++++++
 regress/make-quoting/files/vtarget.mk   |  10 ++++++++++
 regress/make-quoting/files/vtarget.out  |   1 +
 regress/make-quoting/spec               |   9 +++++++++
 18 files changed, 181 insertions(+), 0 deletions(-)

diffs (253 lines):

diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/Makefile     Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,26 @@
+# $NetBSD: Makefile,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+
+DISTNAME=      regress-make-1.0
+CATEGORIES=    regress
+DISTFILES=     # empty
+
+MAINTAINER=    rillig%NetBSD.org@localhost
+COMMENT=       Test Makefile quoting
+
+REGRESS_TESTS= continue dblquote for ltarget nestfor quoting sglquote  \
+       vtarget
+
+do-extract:
+       @${_PKG_SILENT}${_PKG_DEBUG}                                    \
+       ${MKDIR} ${WRKSRC:Q}
+
+do-build:
+.for t in ${REGRESS_TESTS}
+       @${_PKG_SILENT}${_PKG_DEBUG}                                    \
+       ${ECHO_MSG} "Running testcase "${t:Q};                          \
+       ${MAKE} ${MAKEFLAGS} -s -f ${FILESDIR:Q}/${t:Q}.mk              \
+       | diff - ${FILESDIR:Q}/${t:Q}.out
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/continue.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/continue.mk    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,19 @@
+# $NetBSD: continue.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates that .for variables that end in a backslash are
+# interpreted as line-continuations when they are placed at the end of a
+# line.
+#
+
+LIST=          a:\ a:\foo.bar
+
+.PHONY: all
+all:
+.for l in ${LIST}
+       echo ${l:Q}
+       echo "second line"
+.endfor
+.for l in ${LIST}
+       echo ${l:Q}""
+       echo "second line"
+.endfor
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/continue.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/continue.out   Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,7 @@
+a: echo second line
+a:\foo.bar
+second line
+a:\
+second line
+a:\foo.bar
+second line
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/dblquote.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/dblquote.mk    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: dblquote.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates that quoted strings are interpreted when appying
+# the ``modifiers'', not when creating strings by assignment.
+#
+
+DBLQUOTE=      "
+DBLQUOTE+=     "a   b"
+DBLQUOTE+=     "
+
+all:
+       echo ${DBLQUOTE:Q}
+       echo ${DBLQUOTE:M*:Q}
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/dblquote.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/dblquote.out   Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,2 @@
+" "a   b" "
+" "a b" "
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/for.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/for.mk Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,11 @@
+# $NetBSD: for.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# .for loops don't interpret variables in sh(1) mode, but split them at
+# whitespace.
+
+LIST_1=                1 2 "3     3"  '4 ' 5'5'5"5"5
+
+all:
+.for i in ${LIST_1}
+       echo ${i:Q}
+.endfor
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/for.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/for.out        Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,7 @@
+1
+2
+"3
+3"
+'4
+'
+5'5'5"5"5
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/ltarget.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/ltarget.mk     Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,13 @@
+# $NetBSD: ltarget.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates that the ${.TARGET} variable must be quoted when
+# the target is specified directly.
+#
+# See also vtarget.
+#
+
+all: foo`date`
+
+.PHONY: foo`date`
+foo`date`:
+       echo ${.TARGET:Q}
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/ltarget.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/ltarget.out    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,1 @@
+foo`date`
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/nestfor.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/nestfor.mk     Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,17 @@
+# $NetBSD: nestfor.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file tests what happens if the same variable name is used in
+# nested .for loops.
+#
+# The result is somewhat surprising, in that the outer i is used.
+#
+
+X=             # empty
+.for i in a b c
+.  for i in 0 1 2
+X+=            ${i}
+.  endfor
+.endfor
+
+all:
+       echo ${X:M*:Q}
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/nestfor.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/nestfor.out    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,1 @@
+a a a b b b c c c
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/quoting.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/quoting.mk     Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: quoting.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates various techniques for quoting variables when
+# passing them to the shell.
+#
+
+EVIL_STRING?=  "   "
+
+.PHONY: all
+all:
+       echo ${EVIL_STRING}
+       echo ${EVIL_STRING:Q}
+       echo "${EVIL_STRING}"
+       echo "${EVIL_STRING:Q}"
+       echo ${EVIL_STRING:Q}""
+       echo x${EVIL_STRING:Q} | sed 1s,.,,
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/quoting.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/quoting.out    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,6 @@
+   
+"   "
+ 
+"\ \ \ "
+"   "
+"   "
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/sglquote.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/sglquote.mk    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,16 @@
+# $NetBSD: sglquote.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates the differences between single and double
+# quotes.
+#
+
+STR_1=         '\''\''a   b' 'z'
+STR_2=         "\""\""a   b" "z"
+
+all:
+       echo ${STR_1}
+       echo ${STR_1:Q}
+       echo ${STR_1:M*:Q}
+       echo ${STR_2}
+       echo ${STR_2:Q}
+       echo ${STR_2:M*:Q}
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/sglquote.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/sglquote.out   Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,6 @@
+\\a   b z
+'\''\''a   b' 'z'
+'\''\''a   b' 'z'
+""a   b z
+"\""\""a   b" "z"
+"\""\""a   b" "z"
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/vtarget.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/vtarget.mk     Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,10 @@
+# $NetBSD: vtarget.mk,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+# This file demonstrates that the ${.TARGET} variable does not have to
+# be quoted when the target is specified by a quoted variable.
+#
+
+FOO=           a    b `date`
+
+${FOO:Q}:
+       echo ${.TARGET}
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/files/vtarget.out
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/files/vtarget.out    Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,1 @@
+a    b `date`
diff -r 1ede009fee04 -r d137b5c850c6 regress/make-quoting/spec
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/make-quoting/spec Sun May 15 21:10:16 2005 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: spec,v 1.1.1.1 2005/05/15 21:10:16 rillig Exp $
+#
+
+MAKEARGS_TEST=build
+MAKEARGS_CLEAN=clean
+
+check_result() {
+       exit_status 0
+}



Home | Main Index | Thread Index | Old Index