summaryrefslogtreecommitdiffstats
path: root/usr.bin/m4
diff options
context:
space:
mode:
authorjmmv <jmmv@FreeBSD.org>2014-04-27 01:15:10 +0000
committerjmmv <jmmv@FreeBSD.org>2014-04-27 01:15:10 +0000
commit1e4589b921fdaa1b1d2fc6b6ed016f1e0a01cb8f (patch)
tree94c86cf13dedabad5bdc68f6f227b843a5161343 /usr.bin/m4
parent5b12da65bf9d40526ac9ca480d639bad3cd39cf6 (diff)
downloadFreeBSD-src-1e4589b921fdaa1b1d2fc6b6ed016f1e0a01cb8f.zip
FreeBSD-src-1e4589b921fdaa1b1d2fc6b6ed016f1e0a01cb8f.tar.gz
MFC various moves of tools/regressions/ tests to the new infrastructure.
- r263220 Migrate tools/regression/sbin/ to the new tests layout. - r263222 Add Makefile missed in r263220. - r263226 Migrate tools/regression/{usr.bin/lastcomm,usr.sbin}/ to the new tests layout. - r263227 Migrate most of tools/regression/usr.bin/ to the new tests layout. - r263345 Expand tabs that sneaked in into spaces. - r263346 Migrate tools/regression/usr.bin/make/ to the new tests layout. - r263348 Add Makefiles missed in r263346. - r263351 Migrate tools/regression/usr.bin/pkill/ to the new tests layout. - r263388 Mark multi_test as requiring /usr/share/dict/words. - r263814 Fix path to the run.pl script to let these tests run. - r264742 Prevent building tests when bootstrapping make. This is 'make tinderbox' clean.
Diffstat (limited to 'usr.bin/m4')
-rw-r--r--usr.bin/m4/Makefile6
-rw-r--r--usr.bin/m4/tests/Makefile52
-rw-r--r--usr.bin/m4/tests/args.m49
-rw-r--r--usr.bin/m4/tests/args2.m45
-rw-r--r--usr.bin/m4/tests/comments.m459
-rw-r--r--usr.bin/m4/tests/esyscmd.m443
-rw-r--r--usr.bin/m4/tests/eval.m46
-rw-r--r--usr.bin/m4/tests/ff_after_dnl.m4.uu11
-rw-r--r--usr.bin/m4/tests/gnueval.m47
-rw-r--r--usr.bin/m4/tests/gnuformat.m42
-rw-r--r--usr.bin/m4/tests/gnupatterns.m44
-rw-r--r--usr.bin/m4/tests/gnupatterns2.m46
-rw-r--r--usr.bin/m4/tests/gnuprefix.m42
-rw-r--r--usr.bin/m4/tests/gnusofterror.m44
-rw-r--r--usr.bin/m4/tests/includes.aux3
-rw-r--r--usr.bin/m4/tests/includes.m45
-rw-r--r--usr.bin/m4/tests/legacy_test.sh6
-rw-r--r--usr.bin/m4/tests/m4wrap3.m412
-rw-r--r--usr.bin/m4/tests/patterns.m412
-rw-r--r--usr.bin/m4/tests/quotes.m458
-rw-r--r--usr.bin/m4/tests/redef.m417
-rw-r--r--usr.bin/m4/tests/regress.args.out3
-rw-r--r--usr.bin/m4/tests/regress.args2.out1
-rw-r--r--usr.bin/m4/tests/regress.comments.out47
-rw-r--r--usr.bin/m4/tests/regress.esyscmd.out578
-rw-r--r--usr.bin/m4/tests/regress.eval.out3
-rw-r--r--usr.bin/m4/tests/regress.ff_after_dnl.out2
-rw-r--r--usr.bin/m4/tests/regress.gnueval.out3
-rw-r--r--usr.bin/m4/tests/regress.gnuformat.out1
-rw-r--r--usr.bin/m4/tests/regress.gnupatterns.out3
-rw-r--r--usr.bin/m4/tests/regress.gnupatterns2.out1
-rw-r--r--usr.bin/m4/tests/regress.gnuprefix.out46
-rw-r--r--usr.bin/m4/tests/regress.gnusofterror.out2
-rw-r--r--usr.bin/m4/tests/regress.gnutranslit2.out6
-rw-r--r--usr.bin/m4/tests/regress.includes.out1
-rw-r--r--usr.bin/m4/tests/regress.m4wrap3.out4
-rw-r--r--usr.bin/m4/tests/regress.patterns.out6
-rw-r--r--usr.bin/m4/tests/regress.quotes.out49
-rw-r--r--usr.bin/m4/tests/regress.redef.out2
-rw-r--r--usr.bin/m4/tests/regress.sh33
-rw-r--r--usr.bin/m4/tests/regress.strangequotes.out1
-rw-r--r--usr.bin/m4/tests/regress.translit.out1
-rw-r--r--usr.bin/m4/tests/regress.translit2.out6
-rw-r--r--usr.bin/m4/tests/strangequotes.m4.uu8
-rw-r--r--usr.bin/m4/tests/translit.m44
-rw-r--r--usr.bin/m4/tests/translit2.m49
46 files changed, 1149 insertions, 0 deletions
diff --git a/usr.bin/m4/Makefile b/usr.bin/m4/Makefile
index f0e22f8..e6cf0b6 100644
--- a/usr.bin/m4/Makefile
+++ b/usr.bin/m4/Makefile
@@ -4,6 +4,8 @@
# -DEXTENDED
# if you want the paste & spaste macros.
+.include <bsd.own.mk>
+
PROG= m4
CFLAGS+=-DEXTENDED -I${.CURDIR} -I${.CURDIR}/lib
DPADD= ${LIBY} ${LIBL} ${LIBM}
@@ -22,4 +24,8 @@ tokenizer.o: parser.h
CLEANFILES+= parser.c parser.h tokenizer.o
+.if ${MK_TESTS} != "no"
+SUBDIR+= tests
+.endif
+
.include <bsd.prog.mk>
diff --git a/usr.bin/m4/tests/Makefile b/usr.bin/m4/tests/Makefile
new file mode 100644
index 0000000..2eebc07
--- /dev/null
+++ b/usr.bin/m4/tests/Makefile
@@ -0,0 +1,52 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/usr.bin/m4
+
+TAP_TESTS_SH= legacy_test
+
+FILESDIR= ${TESTSDIR}
+FILES= args.m4
+FILES+= args2.m4
+FILES+= comments.m4
+FILES+= esyscmd.m4
+FILES+= eval.m4
+FILES+= ff_after_dnl.m4.uu
+FILES+= gnueval.m4
+FILES+= gnuformat.m4
+FILES+= gnupatterns.m4
+FILES+= gnupatterns2.m4
+FILES+= gnuprefix.m4
+FILES+= gnusofterror.m4
+FILES+= includes.aux
+FILES+= includes.m4
+FILES+= m4wrap3.m4
+FILES+= patterns.m4
+FILES+= quotes.m4
+FILES+= redef.m4
+FILES+= regress.args.out
+FILES+= regress.args2.out
+FILES+= regress.comments.out
+FILES+= regress.esyscmd.out
+FILES+= regress.eval.out
+FILES+= regress.ff_after_dnl.out
+FILES+= regress.gnueval.out
+FILES+= regress.gnuformat.out
+FILES+= regress.gnupatterns.out
+FILES+= regress.gnupatterns2.out
+FILES+= regress.gnuprefix.out
+FILES+= regress.gnusofterror.out
+FILES+= regress.gnutranslit2.out
+FILES+= regress.includes.out
+FILES+= regress.m4wrap3.out
+FILES+= regress.patterns.out
+FILES+= regress.quotes.out
+FILES+= regress.redef.out
+FILES+= regress.sh
+FILES+= regress.strangequotes.out
+FILES+= regress.translit.out
+FILES+= regress.translit2.out
+FILES+= strangequotes.m4.uu
+FILES+= translit.m4
+FILES+= translit2.m4
+
+.include <bsd.test.mk>
diff --git a/usr.bin/m4/tests/args.m4 b/usr.bin/m4/tests/args.m4
new file mode 100644
index 0000000..3ad30f2
--- /dev/null
+++ b/usr.bin/m4/tests/args.m4
@@ -0,0 +1,9 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/args.m4,v 1.1 2001/10/10 23:23:59 espie Exp $
+dnl Expanding all arguments
+define(`A', `first form: $@, second form $*')dnl
+define(`B', `C')dnl
+A(1,2,`B')
+dnl indirection means macro can get called with argc == 2 !
+indir(`A',1,2,`B')
+indir(`A')
diff --git a/usr.bin/m4/tests/args2.m4 b/usr.bin/m4/tests/args2.m4
new file mode 100644
index 0000000..3f9ed60
--- /dev/null
+++ b/usr.bin/m4/tests/args2.m4
@@ -0,0 +1,5 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/args2.m4,v 1.1 2008/08/16 09:57:12 espie Exp $
+dnl Preserving spaces within nested parentheses
+define(`foo',`$1')dnl
+foo(( check for embedded spaces))
diff --git a/usr.bin/m4/tests/comments.m4 b/usr.bin/m4/tests/comments.m4
new file mode 100644
index 0000000..d7038c4
--- /dev/null
+++ b/usr.bin/m4/tests/comments.m4
@@ -0,0 +1,59 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/comments.m4,v 1.1 2005/09/06 15:33:21 espie Exp $
+dnl checking the way changecom works.
+1: normal
+define(`comment', `COMMENT')dnl
+define(`p', 'XXX')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+2: `changecom(>>)dnl'
+changecom(>>)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+3: `changecom dnl'
+changecom dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+4: `changecom()dnl'
+changecom()dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+5: `changecom(,)dnl'
+changecom(,)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+6: `changecom(`p',q)dnl'
+changecom(`p',q)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+7: `changecom(`p')dnl'
+changecom(`p')dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
+
+8: `changecom(#)dnl'
+changecom(#)dnl
+# this is a comment
+>> this is a comment
+p this is a comment
+p this is a comment q comment too
diff --git a/usr.bin/m4/tests/esyscmd.m4 b/usr.bin/m4/tests/esyscmd.m4
new file mode 100644
index 0000000..7b1342d
--- /dev/null
+++ b/usr.bin/m4/tests/esyscmd.m4
@@ -0,0 +1,43 @@
+dnl $FreeBSD$
+changequote(`{',`}')dnl
+dnl
+esyscmd({sh -c "m4<<EOF
+define(_bp,hi there a)
+define(_comb,
+_bp($1$2)
+_bp($2$1)
+)
+define(bp,
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+_comb(aaaa,foo0)
+_comb(bbbb,foo0)
+_comb(cccc,foo0)
+_comb(dddd,foo0)
+)
+bp(a00)
+bp(b00)
+bp(c00)
+bp(d00)
+bp(e00)
+bp(f00)
+bp(g00)
+bp(h00)
+bp(i00)
+bp(j00)
+bp(k00)
+bp(l00)
+bp(m00)
+bp(n00)
+bp(o00)
+bp(p00)
+bp(q00)
+bp(r00)
+bp(s00)
+bp(t00)
+bp(u00)
+bp(v00)
+bp(w00)
+EOF"})dnl
diff --git a/usr.bin/m4/tests/eval.m4 b/usr.bin/m4/tests/eval.m4
new file mode 100644
index 0000000..361f9b9
--- /dev/null
+++ b/usr.bin/m4/tests/eval.m4
@@ -0,0 +1,6 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/eval.m4,v 1.1 2004/05/12 21:24:37 espie Exp $
+dnl expr parser
+eval(224&127)
+eval(224|127)
+eval(224&&127)
diff --git a/usr.bin/m4/tests/ff_after_dnl.m4.uu b/usr.bin/m4/tests/ff_after_dnl.m4.uu
new file mode 100644
index 0000000..222f9e3
--- /dev/null
+++ b/usr.bin/m4/tests/ff_after_dnl.m4.uu
@@ -0,0 +1,11 @@
+$FreeBSD$
+$OpenBSD: src/regress/usr.bin/m4/ff_after_dnl.m4.uu,v 1.1.1.1 2000/07/01 00:31:01 espie Exp $
+$NetBSD: ff_after_dnl.m4.uu,v 1.1 1997/12/30 23:30:53 cgd Exp $
+
+begin 644 ff_after_dnl.m4
+M"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#$I"F1N;`D)5$A)4R!32$]5
+M3$0@3D]4(%-(3U<@55`@*$Q)3D4@,BD*9&YL_PD)5$A)4R!32$]53$0@3D]4
+M(%-(3U<@55`@*$Q)3D4@,RD*9&YL"?\)5$A)4R!32$]53$0@3D]4(%-(3U<@
+K55`@*$Q)3D4@-"D*"0E42$E3(%-(3U5,1"!32$]7(%50("A,24Y%(#4I"E<@
+`
+end
diff --git a/usr.bin/m4/tests/gnueval.m4 b/usr.bin/m4/tests/gnueval.m4
new file mode 100644
index 0000000..9e7b576
--- /dev/null
+++ b/usr.bin/m4/tests/gnueval.m4
@@ -0,0 +1,7 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/gnueval.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+dnl exponentiation is right associative
+eval(`4**2**3')
+dnl priority between unary operators and *
+eval(`4**2*3')
+eval(`-4**3')
diff --git a/usr.bin/m4/tests/gnuformat.m4 b/usr.bin/m4/tests/gnuformat.m4
new file mode 100644
index 0000000..429d265
--- /dev/null
+++ b/usr.bin/m4/tests/gnuformat.m4
@@ -0,0 +1,2 @@
+dnl $FreeBSD$
+format(`a%15sa%%b%-15sbc%3scd%-3sd', `string', `pouet', `toolong', `toolong2')
diff --git a/usr.bin/m4/tests/gnupatterns.m4 b/usr.bin/m4/tests/gnupatterns.m4
new file mode 100644
index 0000000..735d1cf
--- /dev/null
+++ b/usr.bin/m4/tests/gnupatterns.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+patsubst(`string with a + to replace with a minus', `+', `minus')
+patsubst(`string with aaaaa to replace with a b', `a+', `b')
+patsubst(`+string with a starting + to replace with a minus', `^+', `minus')
diff --git a/usr.bin/m4/tests/gnupatterns2.m4 b/usr.bin/m4/tests/gnupatterns2.m4
new file mode 100644
index 0000000..23170b7
--- /dev/null
+++ b/usr.bin/m4/tests/gnupatterns2.m4
@@ -0,0 +1,6 @@
+dnl $FreeBSD$
+define(`zoinx',dnl
+`patsubst($1,\(\w+\)\(\W*\),\1 )')dnl
+zoinx(acosl asinl atanl \
+ cosl sinl tanl \
+ coshl sinhl tanhl)
diff --git a/usr.bin/m4/tests/gnuprefix.m4 b/usr.bin/m4/tests/gnuprefix.m4
new file mode 100644
index 0000000..fff9784
--- /dev/null
+++ b/usr.bin/m4/tests/gnuprefix.m4
@@ -0,0 +1,2 @@
+dumpdef()
+m4_dumpdef()
diff --git a/usr.bin/m4/tests/gnusofterror.m4 b/usr.bin/m4/tests/gnusofterror.m4
new file mode 100644
index 0000000..5ddc028
--- /dev/null
+++ b/usr.bin/m4/tests/gnusofterror.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/gnusofterror.m4,v 1.1 2012/04/12 16:58:15 espie Exp $
+include(`hey I do not exit')dnl
+abc
diff --git a/usr.bin/m4/tests/includes.aux b/usr.bin/m4/tests/includes.aux
new file mode 100644
index 0000000..a977969
--- /dev/null
+++ b/usr.bin/m4/tests/includes.aux
@@ -0,0 +1,3 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.aux,v 1.1 2008/08/16 10:02:32 espie Exp $
+hello world dnl
diff --git a/usr.bin/m4/tests/includes.m4 b/usr.bin/m4/tests/includes.m4
new file mode 100644
index 0000000..c06e763
--- /dev/null
+++ b/usr.bin/m4/tests/includes.m4
@@ -0,0 +1,5 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/includes.m4,v 1.1 2008/08/16 10:02:32 espie Exp $
+dnl Check that include can occur within parameters
+define(`foo', include(includes.aux))dnl
+foo
diff --git a/usr.bin/m4/tests/legacy_test.sh b/usr.bin/m4/tests/legacy_test.sh
new file mode 100644
index 0000000..1b6b806
--- /dev/null
+++ b/usr.bin/m4/tests/legacy_test.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+SRCDIR="$(dirname "${0}")"; export SRCDIR
+
+m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh
diff --git a/usr.bin/m4/tests/m4wrap3.m4 b/usr.bin/m4/tests/m4wrap3.m4
new file mode 100644
index 0000000..a0dffb0
--- /dev/null
+++ b/usr.bin/m4/tests/m4wrap3.m4
@@ -0,0 +1,12 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/m4wrap3.m4,v 1.1 2005/03/02 10:12:41 espie Exp $
+dnl Another test, this time for multiple wrappers
+dnl Check the behavior in presence of recursive m4wraps
+dnl both for POSIX m4 and for gnu-m4 mode
+m4wrap(`this is
+')dnl
+m4wrap(`a string
+')dnl
+m4wrap(`m4wrap(`recurse
+')')dnl
+normal m4 stuff
diff --git a/usr.bin/m4/tests/patterns.m4 b/usr.bin/m4/tests/patterns.m4
new file mode 100644
index 0000000..e064778
--- /dev/null
+++ b/usr.bin/m4/tests/patterns.m4
@@ -0,0 +1,12 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/patterns.m4,v 1.4 2003/06/08 20:11:45 espie Exp $
+patsubst(`quote s in string', `(s)', `\\\1')
+patsubst(`check whether subst
+over several lines
+works as expected', `^', `>>>')
+patsubst(`# This is a line to zap
+# and a second line
+keep this one', `^ *#.*
+')
+dnl Special case: empty regexp
+patsubst(`empty regexp',`',`a ')
diff --git a/usr.bin/m4/tests/quotes.m4 b/usr.bin/m4/tests/quotes.m4
new file mode 100644
index 0000000..c783e22
--- /dev/null
+++ b/usr.bin/m4/tests/quotes.m4
@@ -0,0 +1,58 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/quotes.m4,v 1.2 2005/09/06 15:33:21 espie Exp $
+dnl Checking the way changequote() is supposed to work
+define(`string',`STRING')dnl
+1: normal
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+2: kill quotes
+changequote()dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+3: normal changed quote
+changequote([,])dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+4: empty quotes, kill them too
+changequote(,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+5: start quote only
+changequote(`)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+6: normal quotes are back
+changequote
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
+
+7: start quote+empty end quote
+changequote([,)dnl
+`quoted string'
+[quoted string]
+normal string
+`half quoted string
+going up to that string'
diff --git a/usr.bin/m4/tests/redef.m4 b/usr.bin/m4/tests/redef.m4
new file mode 100644
index 0000000..de01f67
--- /dev/null
+++ b/usr.bin/m4/tests/redef.m4
@@ -0,0 +1,17 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/redef.m4,v 1.2 2001/09/27 22:40:58 espie Exp $
+dnl check all properties of builtin are passed on, including args behavior
+define(`mybuiltin',defn(`builtin'))dnl
+builtin mybuiltin
+define(`mydefine',defn(`define'))dnl
+mydefine(`mydefn',defn(`defn'))dnl
+mydefine(`myundefine',mydefn(`undefine'))dnl
+myundefine(`defn')dnl
+myundefine(`define')dnl
+myundefine(`undefine')dnl
+mydefine(`mydef2',mydefn(`mydefine'))dnl
+mydefine(`mydef', mydefn(`define'))dnl
+myundefine(`mydefine')dnl
+mydef2(`A',`B')dnl
+mydef(`C',`D')dnl
+A C
diff --git a/usr.bin/m4/tests/regress.args.out b/usr.bin/m4/tests/regress.args.out
new file mode 100644
index 0000000..aaa8900
--- /dev/null
+++ b/usr.bin/m4/tests/regress.args.out
@@ -0,0 +1,3 @@
+first form: 1,2,B, second form 1,2,C
+first form: 1,2,B, second form 1,2,C
+first form: , second form
diff --git a/usr.bin/m4/tests/regress.args2.out b/usr.bin/m4/tests/regress.args2.out
new file mode 100644
index 0000000..74bdbd6
--- /dev/null
+++ b/usr.bin/m4/tests/regress.args2.out
@@ -0,0 +1 @@
+( check for embedded spaces)
diff --git a/usr.bin/m4/tests/regress.comments.out b/usr.bin/m4/tests/regress.comments.out
new file mode 100644
index 0000000..157f107
--- /dev/null
+++ b/usr.bin/m4/tests/regress.comments.out
@@ -0,0 +1,47 @@
+1: normal
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+2: changecom(>>)dnl
+# this is a COMMENT
+>> this is a comment
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+3: changecom dnl
+ # this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+4: changecom()dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+5: changecom(,)dnl
+# this is a COMMENT
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
+
+6: changecom(`p',q)dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q COMMENT too
+
+7: changecom(`p')dnl
+# this is a COMMENT
+>> this is a COMMENT
+p this is a comment
+p this is a comment q comment too
+
+8: changecom(#)dnl
+# this is a comment
+>> this is a COMMENT
+'XXX' this is a COMMENT
+'XXX' this is a COMMENT q COMMENT too
diff --git a/usr.bin/m4/tests/regress.esyscmd.out b/usr.bin/m4/tests/regress.esyscmd.out
new file mode 100644
index 0000000..89a1d06
--- /dev/null
+++ b/usr.bin/m4/tests/regress.esyscmd.out
@@ -0,0 +1,578 @@
+
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+hi there a
+hi there a
+
+
diff --git a/usr.bin/m4/tests/regress.eval.out b/usr.bin/m4/tests/regress.eval.out
new file mode 100644
index 0000000..7298b3f
--- /dev/null
+++ b/usr.bin/m4/tests/regress.eval.out
@@ -0,0 +1,3 @@
+96
+255
+1
diff --git a/usr.bin/m4/tests/regress.ff_after_dnl.out b/usr.bin/m4/tests/regress.ff_after_dnl.out
new file mode 100644
index 0000000..8e51f1e
--- /dev/null
+++ b/usr.bin/m4/tests/regress.ff_after_dnl.out
@@ -0,0 +1,2 @@
+ THIS SHOULD SHOW UP (LINE 1)
+ THIS SHOULD SHOW UP (LINE 5)
diff --git a/usr.bin/m4/tests/regress.gnueval.out b/usr.bin/m4/tests/regress.gnueval.out
new file mode 100644
index 0000000..6d7fd49
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnueval.out
@@ -0,0 +1,3 @@
+65536
+48
+-64
diff --git a/usr.bin/m4/tests/regress.gnuformat.out b/usr.bin/m4/tests/regress.gnuformat.out
new file mode 100644
index 0000000..3f484d6
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnuformat.out
@@ -0,0 +1 @@
+a stringa%bpouet bctoolongcdtoolong2d
diff --git a/usr.bin/m4/tests/regress.gnupatterns.out b/usr.bin/m4/tests/regress.gnupatterns.out
new file mode 100644
index 0000000..8e31103
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnupatterns.out
@@ -0,0 +1,3 @@
+string with a minus to replace with a minus
+string with b to replbce with b b
+minusstring with a starting + to replace with a minus
diff --git a/usr.bin/m4/tests/regress.gnupatterns2.out b/usr.bin/m4/tests/regress.gnupatterns2.out
new file mode 100644
index 0000000..c45944a
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnupatterns2.out
@@ -0,0 +1 @@
+acosl asinl atanl cosl sinl tanl coshl sinhl tanhl
diff --git a/usr.bin/m4/tests/regress.gnuprefix.out b/usr.bin/m4/tests/regress.gnuprefix.out
new file mode 100644
index 0000000..186421d
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnuprefix.out
@@ -0,0 +1,46 @@
+`m4_ifelse' `m4_ifelse'
+`m4_dnl' `m4_dnl'
+`m4_expr' `m4_expr'
+`m4_builtin' `m4_builtin'
+`m4_popdef' `m4_popdef'
+`m4_eval' `m4_eval'
+`m4_len' `m4_len'
+`m4_indir' `m4_indir'
+`m4_sinclude' `m4_sinclude'
+`m4_index' `m4_index'
+`m4_traceoff' `m4_traceoff'
+`m4___file__' `m4___file__'
+`m4_unix' `m4_unix'
+`m4_mkstemp' `m4_mkstemp'
+`m4_changecom' `m4_changecom'
+`m4_defn' `m4_defn'
+`m4_decr' `m4_decr'
+`m4_translit' `m4_translit'
+`m4_patsubst' `m4_patsubst'
+`m4_dumpdef' `m4_dumpdef'
+`m4___line__' `m4___line__'
+`m4_esyscmd' `m4_esyscmd'
+`m4_traceon' `m4_traceon'
+`m4_incr' `m4_incr'
+`m4_shift' `m4_shift'
+`m4_syscmd' `m4_syscmd'
+`m4_include' `m4_include'
+`m4_pushdef' `m4_pushdef'
+`m4_paste' `m4_paste'
+`m4_regexp' `m4_regexp'
+`m4_changequote' `m4_changequote'
+`m4_undivert' `m4_undivert'
+`m4_m4exit' `m4_m4exit'
+`m4_substr' `m4_substr'
+`m4_m4wrap' `m4_m4wrap'
+`m4_ifdef' `m4_ifdef'
+`m4_sysval' `m4_sysval'
+`m4_divert' `m4_divert'
+`m4_maketemp' `m4_maketemp'
+`m4_spaste' `m4_spaste'
+`m4_define' `m4_define'
+`m4_undefine' `m4_undefine'
+`m4_divnum' `m4_divnum'
+`m4_errprint' `m4_errprint'
+dumpdef()
+
diff --git a/usr.bin/m4/tests/regress.gnusofterror.out b/usr.bin/m4/tests/regress.gnusofterror.out
new file mode 100644
index 0000000..322fa4c
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnusofterror.out
@@ -0,0 +1,2 @@
+m4: gnusofterror.m4 at line 3: include(hey I do not exit): No such file or directory
+abc
diff --git a/usr.bin/m4/tests/regress.gnutranslit2.out b/usr.bin/m4/tests/regress.gnutranslit2.out
new file mode 100644
index 0000000..5c88e73
--- /dev/null
+++ b/usr.bin/m4/tests/regress.gnutranslit2.out
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+ABCDEFGHIJ
+ABC-0980-ZYX
+ABC-0980-ZYX
diff --git a/usr.bin/m4/tests/regress.includes.out b/usr.bin/m4/tests/regress.includes.out
new file mode 100644
index 0000000..4a1f475
--- /dev/null
+++ b/usr.bin/m4/tests/regress.includes.out
@@ -0,0 +1 @@
+hello world
diff --git a/usr.bin/m4/tests/regress.m4wrap3.out b/usr.bin/m4/tests/regress.m4wrap3.out
new file mode 100644
index 0000000..51b43f4
--- /dev/null
+++ b/usr.bin/m4/tests/regress.m4wrap3.out
@@ -0,0 +1,4 @@
+normal m4 stuff
+this is
+a string
+recurse
diff --git a/usr.bin/m4/tests/regress.patterns.out b/usr.bin/m4/tests/regress.patterns.out
new file mode 100644
index 0000000..c273b58
--- /dev/null
+++ b/usr.bin/m4/tests/regress.patterns.out
@@ -0,0 +1,6 @@
+quote \s in \string
+>>>check whether subst
+>>>over several lines
+>>>works as expected
+keep this one
+a ea ma pa ta ya a ra ea ga ea xa p
diff --git a/usr.bin/m4/tests/regress.quotes.out b/usr.bin/m4/tests/regress.quotes.out
new file mode 100644
index 0000000..fe5b8a4
--- /dev/null
+++ b/usr.bin/m4/tests/regress.quotes.out
@@ -0,0 +1,49 @@
+m4: unclosed quote:
+ quotes.m4 at line 55
+1: normal
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+2: kill quotes
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+3: normal changed quote
+`quoted STRING'
+quoted string
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+4: empty quotes, kill them too
+`quoted STRING'
+[quoted STRING]
+normal STRING
+`half quoted STRING
+going up to that STRING'
+
+5: start quote only
+quoted string'[quoted STRING]
+normal STRING
+half quoted stringgoing up to that STRING'
+
+6: normal quotes are back
+
+quoted string
+[quoted STRING]
+normal STRING
+half quoted string
+going up to that string
+
+7: start quote+empty end quote
+`quoted STRING'
+quoted string]
+normal string
+`half quoted string
+going up to that string'
diff --git a/usr.bin/m4/tests/regress.redef.out b/usr.bin/m4/tests/regress.redef.out
new file mode 100644
index 0000000..ee482f0
--- /dev/null
+++ b/usr.bin/m4/tests/regress.redef.out
@@ -0,0 +1,2 @@
+builtin mybuiltin
+B C
diff --git a/usr.bin/m4/tests/regress.sh b/usr.bin/m4/tests/regress.sh
new file mode 100644
index 0000000..c1d8b45
--- /dev/null
+++ b/usr.bin/m4/tests/regress.sh
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+echo 1..21
+
+test_m4() {
+ m4 "${@}" 2>&1 | sed -e "s,${SRCDIR}/,,g"
+}
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`args', `test_m4 ${SRCDIR}/args.m4')
+REGRESSION_TEST(`args2', `test_m4 ${SRCDIR}/args2.m4')
+REGRESSION_TEST(`comments', `test_m4 ${SRCDIR}/comments.m4')
+REGRESSION_TEST(`esyscmd', `test_m4 ${SRCDIR}/esyscmd.m4')
+REGRESSION_TEST(`eval', `test_m4 ${SRCDIR}/eval.m4')
+REGRESSION_TEST(`ff_after_dnl', `uudecode -o /dev/stdout ${SRCDIR}/ff_after_dnl.m4.uu | m4')
+REGRESSION_TEST(`gnueval', `test_m4 -g ${SRCDIR}/gnueval.m4')
+REGRESSION_TEST(`gnuformat', `test_m4 -g ${SRCDIR}/gnuformat.m4')
+REGRESSION_TEST(`gnupatterns', `test_m4 -g ${SRCDIR}/gnupatterns.m4')
+REGRESSION_TEST(`gnupatterns2', `test_m4 -g ${SRCDIR}/gnupatterns2.m4')
+REGRESSION_TEST(`gnuprefix', `test_m4 -P ${SRCDIR}/gnuprefix.m4 2>&1')
+REGRESSION_TEST(`gnusofterror', `test_m4 -g ${SRCDIR}/gnusofterror.m4 2>&1')
+REGRESSION_TEST(`gnutranslit2', `test_m4 -g ${SRCDIR}/translit2.m4')
+REGRESSION_TEST(`includes', `test_m4 -I${SRCDIR} ${SRCDIR}/includes.m4')
+REGRESSION_TEST(`m4wrap3', `test_m4 ${SRCDIR}/m4wrap3.m4')
+REGRESSION_TEST(`patterns', `test_m4 ${SRCDIR}/patterns.m4')
+REGRESSION_TEST(`quotes', `test_m4 ${SRCDIR}/quotes.m4 2>&1')
+REGRESSION_TEST(`strangequotes', `uudecode -o /dev/stdout ${SRCDIR}/strangequotes.m4.uu | m4')
+REGRESSION_TEST(`redef', `test_m4 ${SRCDIR}/redef.m4')
+REGRESSION_TEST(`translit', `test_m4 ${SRCDIR}/translit.m4')
+REGRESSION_TEST(`translit2', `test_m4 ${SRCDIR}/translit2.m4')
+
+REGRESSION_END()
diff --git a/usr.bin/m4/tests/regress.strangequotes.out b/usr.bin/m4/tests/regress.strangequotes.out
new file mode 100644
index 0000000..f19297b
--- /dev/null
+++ b/usr.bin/m4/tests/regress.strangequotes.out
@@ -0,0 +1 @@
+4 to 5
diff --git a/usr.bin/m4/tests/regress.translit.out b/usr.bin/m4/tests/regress.translit.out
new file mode 100644
index 0000000..54abdd3
--- /dev/null
+++ b/usr.bin/m4/tests/regress.translit.out
@@ -0,0 +1 @@
+onkp
diff --git a/usr.bin/m4/tests/regress.translit2.out b/usr.bin/m4/tests/regress.translit2.out
new file mode 100644
index 0000000..5c56177
--- /dev/null
+++ b/usr.bin/m4/tests/regress.translit2.out
@@ -0,0 +1,6 @@
+[HAVE_abc def h/]
+[HAVE_abc~def~h/]
+ABCDEFGHIJ
+A12345678J
+ABC-0980-ZYX
+Abc-0980-Zyx
diff --git a/usr.bin/m4/tests/strangequotes.m4.uu b/usr.bin/m4/tests/strangequotes.m4.uu
new file mode 100644
index 0000000..e3d840f
--- /dev/null
+++ b/usr.bin/m4/tests/strangequotes.m4.uu
@@ -0,0 +1,8 @@
+$FreeBSD$
+$OpenBSD: src/regress/usr.bin/m4/strangequotes.m4.uu,v 1.2 2001/09/19 19:15:08 espie Exp $
+
+begin 644 strangequotes.m4
+M8VAA;F=E<75O=&4HJRR[*61N;`ID969I;F4HJT&[+""K)#$@=&\@)#*[*61N
+*;`I!*#0L(#4I"F4H
+`
+end
diff --git a/usr.bin/m4/tests/translit.m4 b/usr.bin/m4/tests/translit.m4
new file mode 100644
index 0000000..19af2e1
--- /dev/null
+++ b/usr.bin/m4/tests/translit.m4
@@ -0,0 +1,4 @@
+dnl $FreeBSD$
+dnl $OpenBSD: src/regress/usr.bin/m4/translit.m4,v 1.1 2010/03/23 20:11:52 espie Exp $
+dnl first one should match, not second one
+translit(`onk*', `**', `p_')
diff --git a/usr.bin/m4/tests/translit2.m4 b/usr.bin/m4/tests/translit2.m4
new file mode 100644
index 0000000..ec26c08
--- /dev/null
+++ b/usr.bin/m4/tests/translit2.m4
@@ -0,0 +1,9 @@
+dnl $FreeBSD$
+translit(`[HAVE_abc/def.h
+]', `
+/.', `/ ')
+translit(`[HAVE_abc/def.h=]', `=/.', `/~~')
+translit(`0123456789', `0123456789', `ABCDEFGHIJ')
+translit(`0123456789', `[0-9]', `[A-J]')
+translit(`abc-0980-zyx', `abcdefghijklmnopqrstuvwxyz', `ABCDEFGHIJKLMNOPQRSTUVWXYZ')
+translit(`abc-0980-zyx', `[a-z]', `[A-Z]')
OpenPOWER on IntegriCloud