On 18:01 Mon 04 Dec , Alexander Bluhm wrote:
> On Mon, Dec 04, 2017 at 04:56:49PM +0100, Sebastian Benoit wrote:
> > > connected to the Makefile in a source directory, tests looks broken.
> > > 
> > > - lib/libexpat/tests/
> > 
> > (2), but regress/lib/libexpat exists
> 
> I update the libexpat tests together with libexpat sources, so they
> reside in src/lib/libexpat.  In regress/lib/libexpat I have placed
> bsd.regress.mk compatible scripts that run them regularly.
> 
> I would recomment this also for other tests imported from upstream.
> 
> bluhm

Patch below adds similar scripts for ed, perl, gdb, libkeynote, ctags,
m4 and sed. Patch looks huge but it is actually simple. Anyway if you
want splitted patch I will resend.

diff --git a/bin/ed/test/Makefile b/bin/ed/test/Makefile
index de3e737f7fb..5e07c8b65fb 100644
--- a/bin/ed/test/Makefile
+++ b/bin/ed/test/Makefile
@@ -2,7 +2,7 @@
 #      $NetBSD: Makefile,v 1.11 1995/03/21 09:05:14 cgd Exp $
 
 SHELL= /bin/sh
-ED=    ../obj/ed
+ED=    /bin/ed
 
 all: check
        @:
diff --git a/regress/bin/ed/Makefile b/regress/bin/ed/Makefile
new file mode 100644
index 00000000000..c61b326ab79
--- /dev/null
+++ b/regress/bin/ed/Makefile
@@ -0,0 +1,14 @@
+# $OpenBSD $
+
+EDDIR= ${.CURDIR}/../../../bin/ed/test/
+REGRESS_TARGETS= run-regress-ed
+
+run-regress-ed:
+       make -C ${EDDIR} check
+
+clean:
+       make -C ${EDDIR} clean
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/gnu/Makefile b/regress/gnu/Makefile
index 999364693e6..e196fbe7e36 100644
--- a/regress/gnu/Makefile
+++ b/regress/gnu/Makefile
@@ -1,6 +1,6 @@
 # $OpenBSD: Makefile,v 1.2 2002/02/23 01:25:10 art Exp $
 
-SUBDIR+= egcs
+SUBDIR+= egcs usr.bin
 
 install:
 
diff --git a/regress/gnu/usr.bin/Makefile b/regress/gnu/usr.bin/Makefile
new file mode 100644
index 00000000000..addc935809b
--- /dev/null
+++ b/regress/gnu/usr.bin/Makefile
@@ -0,0 +1,7 @@
+# $OpenBSD $
+
+SUBDIR+= perl binutils
+
+install:
+
+.include <bsd.subdir.mk>
diff --git a/regress/gnu/usr.bin/binutils/Makefile 
b/regress/gnu/usr.bin/binutils/Makefile
new file mode 100644
index 00000000000..ff231bd0f83
--- /dev/null
+++ b/regress/gnu/usr.bin/binutils/Makefile
@@ -0,0 +1,7 @@
+# $OpenBSD $
+
+SUBDIR+= gdb
+
+install:
+
+.include <bsd.subdir.mk>
diff --git a/regress/gnu/usr.bin/binutils/gdb/Makefile 
b/regress/gnu/usr.bin/binutils/gdb/Makefile
new file mode 100644
index 00000000000..75e082b53e5
--- /dev/null
+++ b/regress/gnu/usr.bin/binutils/gdb/Makefile
@@ -0,0 +1,14 @@
+# gdb testsuite requires dejagnu package
+
+GDBDIR= ${.CURDIR}/../../../../../gnu/usr.bin/binutils/gdb/testsuite
+
+GDB?= /usr/bin/gdb
+REGRESS_TARGETS= run-regress-gdb
+CLEANFILES= gdb.sum gdb.log
+
+run-regress-gdb:
+       cd ${GDBDIR} && sh ./configure && runtest -tool gdb GDB=${GDB}
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/gnu/usr.bin/perl/Makefile 
b/regress/gnu/usr.bin/perl/Makefile
new file mode 100644
index 00000000000..fd2dd9859d4
--- /dev/null
+++ b/regress/gnu/usr.bin/perl/Makefile
@@ -0,0 +1,14 @@
+PERLDIR= ${.CURDIR}/../../../../gnu/usr.bin/perl/
+
+REGRESS_TARGETS= run-regress-perl
+
+run-regress-perl:
+       ${MAKE} -C ${PERLDIR} -f Makefile.bsd-wrapper
+       ${MAKE} -C ${PERLDIR} -f Makefile.bsd-wrapper test
+
+clean:
+       ${MAKE} -C ${PERLDIR} clean
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/lib/libkeynote/Makefile b/regress/lib/libkeynote/Makefile
new file mode 100644
index 00000000000..2bd874682fc
--- /dev/null
+++ b/regress/lib/libkeynote/Makefile
@@ -0,0 +1,23 @@
+# $OpenBSD $
+
+KEYNOTEDIR=    ${.CURDIR}/../../../lib/libkeynote/testsuite/
+
+REGRESS_TARGETS = run-regress-keynote
+
+run-regress-keynote:
+       keynote verify -e ${KEYNOTEDIR}/test-env \
+               -r false,maybe,probably,true \
+               -k ${KEYNOTEDIR}/auth1 -k ${KEYNOTEDIR}auth2  \
+               -k ${KEYNOTEDIR}/auth3 -k ${KEYNOTEDIR}/auth4  \
+               -l ${KEYNOTEDIR}/test-assertion1 \
+               -l ${KEYNOTEDIR}/test-assertion2 \
+               -l ${KEYNOTEDIR}/test-assertion3 \
+               -l ${KEYNOTEDIR}/test-assertion4 \
+               -l ${KEYNOTEDIR}/test-assertion5 \
+               -l ${KEYNOTEDIR}/test-assertion6 \
+               -l ${KEYNOTEDIR}/test-assertion7
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/ctags/Makefile b/regress/usr.bin/ctags/Makefile
new file mode 100644
index 00000000000..5d2f07039d8
--- /dev/null
+++ b/regress/usr.bin/ctags/Makefile
@@ -0,0 +1,15 @@
+# $OpenBSD $
+
+CTAGSDIR=      ${.CURDIR}/../../../usr.bin/ctags/test/
+
+REGRESS_TARGETS = run-regress-ctags
+CLEANFILES= ${CTAGSDIR}/ctags.out
+
+run-regress-ctags:
+       ctags -f ${CTAGSDIR}/ctags.out ${CTAGSDIR}/ctags.test && \
+               cmp -s ${CTAGSDIR}/ctags.out ${CTAGSDIR}/ctags.tags
+
+.PHONY: ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/m4/Makefile b/regress/usr.bin/m4/Makefile
index cc452c471fe..25660b9e751 100644
--- a/regress/usr.bin/m4/Makefile
+++ b/regress/usr.bin/m4/Makefile
@@ -1,5 +1,7 @@
 #      $OpenBSD: Makefile,v 1.34 2017/10/23 15:21:19 espie Exp $
 
+M4DIR=       ${.CURDIR}/../../../usr.bin/m4/TEST/
+
 FIBOMAX=25
 M4=m4
 
@@ -14,7 +16,8 @@ REGRESS_TARGETS= test-ff_after_dnl test-m4wrap test-m4wrap2 \
     test-gnupatterns2 test-comments test-synch1 test-synch1bis \
     test-gnuformat test-includes test-dumpdef test-gnuprefix \
     test-translit test-translit2 test-gnutranslit2 \
-    test-gnueval test-gnusofterror test-fatalwarnings test-fatalwarnings2
+    test-gnueval test-gnusofterror test-fatalwarnings test-fatalwarnings2 \
+    run_test
 
 test-ff_after_dnl: ff_after_dnl.m4
        ${M4} ff_after_dnl.m4 | diff - ${.CURDIR}/ff_after_dnl.out
@@ -130,6 +133,10 @@ test-fatalwarnings:
 test-fatalwarnings2:
        ${M4} -E -E -g ${.CURDIR}/fatalwarnings.m4 2>&1 | diff -u - 
${.CURDIR}/fatalwarnings.out
 
+run_test:
+       #${M4} ${M4DIR}/test.m4 | diff -u - ${M4DIR}/test.out
+       ${MAKE} -C ${M4DIR}
+
 .PHONY:        ${REGRESS_TARGETS}
 
 .include <bsd.regress.mk>
diff --git a/regress/usr.bin/sed/Makefile b/regress/usr.bin/sed/Makefile
index 47f9871f968..8553b82ca94 100644
--- a/regress/usr.bin/sed/Makefile
+++ b/regress/usr.bin/sed/Makefile
@@ -1,7 +1,10 @@
 #      $OpenBSD: Makefile,v 1.7 2017/07/06 14:17:11 bluhm Exp $
 #      $NetBSD: Makefile,v 1.1 2005/04/04 16:48:45 peter Exp $
 
+SEDDIR=       ${.CURDIR}/../../../usr.bin/sed/TEST/
+
 SED?=  /usr/bin/sed
+SHELL?=        /bin/sh
 
 REGRESS_TARGETS= sedtest substitute hanoi math sierpinski negation \
        inplace inplace2 inplace3 commandl1 commandl2 commandc1 commandD1
@@ -20,10 +23,15 @@ substitute:
 hanoi:
        ${SED} -f ${.CURDIR}/[email protected] ${.CURDIR}/[email protected] > [email protected]
        diff ${.CURDIR}/[email protected] [email protected]
+       ${SED} -f ${SEDDIR}/[email protected] ${SEDDIR}/[email protected] > ${SEDDIR}/[email protected]
+       diff ${SEDDIR}/[email protected] ${SEDDIR}/[email protected]
 
 math:
        ${SED} -f ${.CURDIR}/[email protected] ${.CURDIR}/[email protected] > [email protected]
        diff ${.CURDIR}/[email protected] [email protected]
+       echo "4+7*3" | ${SED} -f ${SEDDIR}/[email protected] > ${SEDDIR}/[email protected]
+       diff ${SEDDIR}/[email protected] ${SEDDIR}/[email protected]
+
 
 sierpinski:
        ${SED} -nf ${.CURDIR}/[email protected] ${.CURDIR}/[email protected] > [email protected]
@@ -64,6 +72,10 @@ commandD1:
        printf 'a\nbb\n' | ${SED} -f ${.CURDIR}/[email protected] > [email protected]
        diff ${.CURDIR}/[email protected] [email protected]
 
-CLEANFILES+=*.out lines* script* *.txt
+clean:
+       @rm -rf ${SEDDIR}/nsed.out ${SEDDIR}/sed.out ${SEDDIR}/hanoi.out \
+               ${SEDDIR}/math.out ${SEDDIR}/lines1 ${SEDDIR}/lines2 
${SEDDIR}/lines3 \
+               ${SEDDIR}/script1 ${SEDDIR}/script2 \
+               *.out lines* script* *.txt
 
 .include <bsd.regress.mk>
diff --git a/usr.bin/ctags/test/ctags.tags b/usr.bin/ctags/test/ctags.tags
new file mode 100644
index 00000000000..3233246c71a
--- /dev/null
+++ b/usr.bin/ctags/test/ctags.tags
@@ -0,0 +1,16 @@
+XYZ    /usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^#define XYZ(A,B)      (A + B \/ 2) * (3 - 26 + l_lineno/
+color  /usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^enum color {red, green, gold, brown};$/
+last   /usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^              struct last {$/
+r4     /usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^ *\/struct struct_xtra{int list;};r4(x,y){};typede/
+routine1       
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^routine1(one,two)     \/* comments here are fun... *\//
+routine2       
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^ 
routine2 (one,two) { puts("hello\\n"); }$/
+routine3       
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^(one,$/
+routine4       
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^routine4(int one, char (*two)(void)) \/* test ANSI/
+struct_one     
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^} 
struct_one;$/
+struct_three   
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^struct struct_three {$/
+struct_two     
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^      
struct struct_two {$/
+struct_xtr     
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^ 
*\/struct struct_xtra{int list;};r4(x,y){};typede/
+struct_xxe     
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^ 
*\/struct struct_xtra{int list;};r4(x,y){};typede/
+u_char /usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  
/^typedef unsigned char u_char;$/
+union_3        
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^      
        union union_3 {$/
+union_one      
/usr/src/regress/usr.bin/ctags/../../../usr.bin/ctags/test//ctags.test  /^union 
union_one {$/
diff --git a/usr.bin/m4/TEST/Makefile b/usr.bin/m4/TEST/Makefile
new file mode 100644
index 00000000000..7e3f7c76a94
--- /dev/null
+++ b/usr.bin/m4/TEST/Makefile
@@ -0,0 +1,11 @@
+#      $OpenBSD $
+
+M4=m4
+REGRESS_TARGETS= run_test
+
+run_test:
+       ${M4} ${.CURDIR}/test.m4 | diff -u - ${.CURDIR}/test.out
+
+.PHONY:        ${REGRESS_TARGETS}
+
+.include <bsd.regress.mk>
diff --git a/usr.bin/m4/TEST/test.out b/usr.bin/m4/TEST/test.out
new file mode 100644
index 00000000000..001551d0c6e
--- /dev/null
+++ b/usr.bin/m4/TEST/test.out
@@ -0,0 +1,640 @@
+#      $OpenBSD: test.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+#      $NetBSD: test.m4,v 1.4 1995/09/28 05:38:05 tls Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)test.m4     8.1 (Berkeley) 6/6/93
+#
+
+# test file for mp (not comprehensive)
+#
+# v7 m4 does not have `decr'.
+#
+
+#
+# include string macros
+#
+#      $OpenBSD: string.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+#      $NetBSD: string.m4,v 1.4 1995/09/28 05:38:03 tls Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)string.m4   8.1 (Berkeley) 6/6/93
+#
+
+
+
+
+
+#
+# create some fortrash strings for an even uglier language
+#
+integer TEXT(5)
+data TEXT(1)/LETt/
+data TEXT(2)/LETe/
+data TEXT(3)/LETx/
+data TEXT(4)/LETt/
+
+data TEXT(5)/EOS/
+
+integer DATA(5)
+data DATA(1)/LETd/
+data DATA(2)/LETa/
+data DATA(3)/LETt/
+data DATA(4)/LETa/
+
+data DATA(5)/EOS/
+
+integer BEGIN(6)
+data BEGIN(1)/LETb/
+data BEGIN(2)/LETe/
+data BEGIN(3)/LETg/
+data BEGIN(4)/LETi/
+data BEGIN(5)/LETn/
+
+data BEGIN(6)/EOS/
+
+integer END(4)
+data END(1)/LETe/
+data END(2)/LETn/
+data END(3)/LETd/
+
+data END(4)/EOS/
+
+integer IF(3)
+data IF(1)/LETi/
+data IF(2)/LETf/
+
+data IF(3)/EOS/
+
+integer THEN(5)
+data THEN(1)/LETt/
+data THEN(2)/LETh/
+data THEN(3)/LETe/
+data THEN(4)/LETn/
+
+data THEN(5)/EOS/
+
+integer ELSE(5)
+data ELSE(1)/LETe/
+data ELSE(2)/LETl/
+data ELSE(3)/LETs/
+data ELSE(4)/LETe/
+
+data ELSE(5)/EOS/
+
+integer CASE(5)
+data CASE(1)/LETc/
+data CASE(2)/LETa/
+data CASE(3)/LETs/
+data CASE(4)/LETe/
+
+data CASE(5)/EOS/
+
+integer REPEAT(7)
+data REPEAT(1)/LETr/
+data REPEAT(2)/LETe/
+data REPEAT(3)/LETp/
+data REPEAT(4)/LETe/
+data REPEAT(5)/LETa/
+data REPEAT(6)/LETt/
+
+data REPEAT(7)/EOS/
+
+integer WHILE(6)
+data WHILE(1)/LETw/
+data WHILE(2)/LETh/
+data WHILE(3)/LETi/
+data WHILE(4)/LETl/
+data WHILE(5)/LETe/
+
+data WHILE(6)/EOS/
+
+integer DEFAULT(8)
+data DEFAULT(1)/LETd/
+data DEFAULT(2)/LETe/
+data DEFAULT(3)/LETf/
+data DEFAULT(4)/LETa/
+data DEFAULT(5)/LETu/
+data DEFAULT(6)/LETl/
+data DEFAULT(7)/LETt/
+
+data DEFAULT(8)/EOS/
+
+integer UNTIL(6)
+data UNTIL(1)/LETu/
+data UNTIL(2)/LETn/
+data UNTIL(3)/LETt/
+data UNTIL(4)/LETi/
+data UNTIL(5)/LETl/
+
+data UNTIL(6)/EOS/
+
+integer FUNCTION(9)
+data FUNCTION(1)/LETf/
+data FUNCTION(2)/LETu/
+data FUNCTION(3)/LETn/
+data FUNCTION(4)/LETc/
+data FUNCTION(5)/LETt/
+data FUNCTION(6)/LETi/
+data FUNCTION(7)/LETo/
+data FUNCTION(8)/LETn/
+
+data FUNCTION(9)/EOS/
+
+integer PROCEDURE(10)
+data PROCEDURE(1)/LETp/
+data PROCEDURE(2)/LETr/
+data PROCEDURE(3)/LETo/
+data PROCEDURE(4)/LETc/
+data PROCEDURE(5)/LETe/
+data PROCEDURE(6)/LETd/
+data PROCEDURE(7)/LETu/
+data PROCEDURE(8)/LETr/
+data PROCEDURE(9)/LETe/
+
+data PROCEDURE(10)/EOS/
+
+integer EXTERNAL(9)
+data EXTERNAL(1)/LETe/
+data EXTERNAL(2)/LETx/
+data EXTERNAL(3)/LETt/
+data EXTERNAL(4)/LETe/
+data EXTERNAL(5)/LETr/
+data EXTERNAL(6)/LETn/
+data EXTERNAL(7)/LETa/
+data EXTERNAL(8)/LETl/
+
+data EXTERNAL(9)/EOS/
+
+integer FORWARD(8)
+data FORWARD(1)/LETf/
+data FORWARD(2)/LETo/
+data FORWARD(3)/LETr/
+data FORWARD(4)/LETw/
+data FORWARD(5)/LETa/
+data FORWARD(6)/LETr/
+data FORWARD(7)/LETd/
+
+data FORWARD(8)/EOS/
+
+integer TYPE(5)
+data TYPE(1)/LETt/
+data TYPE(2)/LETy/
+data TYPE(3)/LETp/
+data TYPE(4)/LETe/
+
+data TYPE(5)/EOS/
+
+integer VAR(4)
+data VAR(1)/LETv/
+data VAR(2)/LETa/
+data VAR(3)/LETr/
+
+data VAR(4)/EOS/
+
+integer CONST(6)
+data CONST(1)/LETc/
+data CONST(2)/LETo/
+data CONST(3)/LETn/
+data CONST(4)/LETs/
+data CONST(5)/LETt/
+
+data CONST(6)/EOS/
+
+integer PROGRAM(8)
+data PROGRAM(1)/LETp/
+data PROGRAM(2)/LETr/
+data PROGRAM(3)/LETo/
+data PROGRAM(4)/LETg/
+data PROGRAM(5)/LETr/
+data PROGRAM(6)/LETa/
+data PROGRAM(7)/LETm/
+
+data PROGRAM(8)/EOS/
+
+integer INPUT(6)
+data INPUT(1)/LETi/
+data INPUT(2)/LETn/
+data INPUT(3)/LETp/
+data INPUT(4)/LETu/
+data INPUT(5)/LETt/
+
+data INPUT(6)/EOS/
+
+integer OUTPUT(7)
+data OUTPUT(1)/LETo/
+data OUTPUT(2)/LETu/
+data OUTPUT(3)/LETt/
+data OUTPUT(4)/LETp/
+data OUTPUT(5)/LETu/
+data OUTPUT(6)/LETt/
+
+data OUTPUT(7)/EOS/
+
+#
+
+
+defined
+#
+# v7 m4 does this wrong. The right output is 
+#      this is A vEry lon sEntEnCE
+# see m4 documentation for translit.
+#
+this is A vEry lon sEntEnCE
+#
+# include towers-of-hanoi
+#
+#      $OpenBSD: hanoi.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+#      $NetBSD: hanoi.m4,v 1.4 1995/09/28 05:37:56 tls Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)hanoi.m4    8.1 (Berkeley) 6/6/93
+#
+
+
+
+
+
+
+
+#
+# some reasonable set of disks
+#
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from A to C
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from C to B
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from A to C
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from B to A
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from A to C
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from C to B
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from B to A
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from C to B
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from A to C
+move disk from B to A
+move disk from B to C
+move disk from A to C
+move disk from A to B
+move disk from C to B
+move disk from C to A
+move disk from B to A
+move disk from C to B
+move disk from A to C
+move disk from A to B
+move disk from C to B
+
+#
+# include ackermann's function
+#
+#      $OpenBSD: ack.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+#      $NetBSD: ack.m4,v 1.4 1995/09/28 05:37:54 tls Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)ack.m4      8.1 (Berkeley) 6/6/93
+#
+
+
+
+#
+# something like (3,3) will blow away un*x m4.
+#
+9
+#
+# include a square_root function for fixed nums
+#
+#      $OpenBSD: sqroot.m4,v 1.3 2003/06/03 02:56:11 millert Exp $
+#      $NetBSD: sqroot.m4,v 1.4 1995/09/28 05:38:01 tls Exp $
+#
+# Copyright (c) 1989, 1993
+#      The Regents of the University of California.  All rights reserved.
+#
+# This code is derived from software contributed to Berkeley by
+# Ozan Yigit.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of the University nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+#      @(#)sqroot.m4   8.1 (Berkeley) 6/6/93
+#
+
+
+
+
+#
+# some square roots.
+#
+3
+10
+negative-square-root
+146
+#
+# some textual material for enjoyment.
+#
+[taken from the 'Clemson University Computer Newsletter',
+ September 1981, pp. 6-7]
+     
+I am a wizard in the magical Kingdom of Transformation and I
+slay dragons for a living.  Actually, I am a systems programmer.
+One of the problems with systems programming is explaining to
+non-computer enthusiasts what that is.  All of the terms I use to
+describe my job are totally meaningless to them.  Usually my response
+to questions about my work is to say as little as possible.  For
+instance, if someone asks what happened at work this week, I say
+"Nothing much" and then I change the subject.
+     
+With the assistance of my brother, a mechanical engineer, I have devised
+an analogy that everyone can understand.  The analogy describes the
+"Kingdom of Transformation" where travelers wander and are magically
+transformed.  This kingdom is the computer and the travelers are information.
+The purpose of the computer is to change information to a more meaningful
+forma.  The law of conservation applies here:  The computer never creates
+and never intentionally destroys data.  With no further ado, let us travel
+to the Kingdom of Transformation:
+     
+In a land far, far away, there is a magical kingdom called the Kingdom of
+Transformation.  A king rules over this land and employs a Council of
+Wizardry.  The main purpose of this kingdom is to provide a way for
+neighboring kingdoms to transform citizens into more useful citizens.  This
+is done by allowing the citizens to enter the kingdom at one of its ports
+and to travel any of the many routes in the kingdom.  They are magically
+transformed along the way.  The income of the Kingdom of Transformation
+comes from the many toll roads within its boundaries.
+     
+The Kingdom of Transformation was created when several kingdoms got
+together and discovered a mutual need for new talents and abilities for
+citizens.  They employed CTK, Inc. (Creators of Transformation, Inc.) to
+create this kingdom.  CTK designed the country, its transportation routes,
+and its laws of transformation, and created the major highway system.
+     
+Hazards
+=======
+     
+Because magic is not truly controllable, CTK invariably, but unknowingly,
+creates dragons.  Dragons are huge fire-breathing beasts which sometimes
+injure or kill travelers.  Fortunately, they do not travel, but always
+remain near their den.
+     
+Other hazards also exist which are potentially harmful.  As the roads
+become older and more weatherbeaten, pot-holes will develop, trees will
+fall on travelers, etc.  CTK maintenance men are called to fix these
+problems.
+     
+Wizards
+=======
+     
+The wizards play a major role in creating and maintaining the kingdom but
+get little credit for their work because it is performed secretly.  The
+wizards do not wan the workers or travelers to learn their incantations
+because many laws would be broken and chaos would result.
+     
+CTK's grand design is always general enough to be applicable in many
+different situations.  As a result, it is often difficult to use.  The
+first duty of the wizards is to tailor the transformation laws so as to be
+more beneficial and easier to use in their particular environment.
+     
+After creation of the kingdom, a major duty of the wizards is to search for
+and kill dragons.  If travelers do not return on time or if they return
+injured, the ruler of the country contacts the wizards.  If the wizards
+determine that the injury or death occurred due to the traveler's
+negligence, they provide the traveler's country with additional warnings.
+If not, they must determine if the cause was a road hazard or a dragon.  If
+the suspect a road hazard, they call in a CTK maintenance man to locate the
+hazard and to eliminate it, as in repairing the pothole in the road.  If
+they think that cause was a dragon, then they must find and slay it.
+     
+The most difficult part of eliminating a dragon is finding it.  Sometimes
+the wizard magically knows where the dragon's lair it, but often the wizard
+must send another traveler along the same route and watch to see where he
+disappears.  This sounds like a failsafe method for finding dragons (and a
+suicide mission for thr traveler) but the second traveler does not always
+disappear.  Some dragons eat any traveler who comes too close; others are
+very picky.
+     
+The wizards may call in CTK who designed the highway system and
+transformation laws to help devise a way to locate the dragon.  CTK also
+helps provide the right spell or incantation to slay the dragon. (There is
+no general spell to slay dragons; each dragon must be eliminated with a
+different spell.)
+     
+Because neither CTK nor wizards are perfect, spells to not always work
+correctly.  At best, nothing happens when the wrong spell is uttered.  At
+worst, the dragon becomes a much larger dragon or multiplies into several
+smaller ones.  In either case, new spells must be found.
+     
+If all existing dragons are quiet (i.e. have eaten sufficiently), wizards
+have time to do other things.  They hide in castles and practice spells and
+incatations.  They also devise shortcuts for travelers and new laws of
+transformation.
+     
+Changes in the Kingdom
+======================
+     
+As new transformation kingdoms are created and old ones are maintained,
+CTK, Inc. is constantly learning new things.  It learns ways to avoid
+creating some of the dragons that they have previously created.  It also
+discovers new and better laws of transformation.  As a result, CTK will
+periodically create a new grand design which is far better than the old.
+The wizards determine when is a good time to implement this new design.
+This is when the tourist season is slow or when no important travelers
+(VIPs) are to arrive.  The kingdom must be closed for the actual
+implementation and is leter reopened as a new and better place to go.
+     
+A final question you might ask is what happens when the number of tourists
+becomes too great for the kingdom to handle in a reasonable period of time
+(i.e., the tourist lines at the ports are too long).  The Kingdom of
+Transformation has three options: (1) shorten the paths that a tourist must
+travel, or (2) convince CTK to develop a faster breed of horses so that the
+travelers can finish sooner, or (3) annex more territories so that the
+kingdom can handle more travelers.
+     
+Thus ends the story of the Kingdom of Transformation.  I hope this has
+explained my job to you:  I slay dragons for a living.
+
+#
+#should do an automatic undivert..
+#
+
+diversion #1
+
+diversion #2
+
+diversion #3
+
+diversion #4
diff --git a/usr.bin/sed/TEST/hanoi.expected b/usr.bin/sed/TEST/hanoi.expected
new file mode 100644
index 00000000000..ec39ea26382
--- /dev/null
+++ b/usr.bin/sed/TEST/hanoi.expected
@@ -0,0 +1,17 @@
+:abcd:    :    :
+:abc :    :d   :
+:ab  :c   :d   :
+:ab  :cd  :    :
+:a   :cd  :b   :
+:ad  :c   :b   :
+:ad  :    :bc  :
+:a   :    :bcd :
+:    :a   :bcd :
+:    :ad  :bc  :
+:c   :ad  :b   :
+:cd  :a   :b   :
+:cd  :ab  :    :
+:c   :ab  :d   :
+:    :abc :d   :
+:    :abcd:    :
+Done!  Try another, or end with ^D.
diff --git a/usr.bin/sed/TEST/hanoi.in b/usr.bin/sed/TEST/hanoi.in
new file mode 100644
index 00000000000..b24c6a6cf76
--- /dev/null
+++ b/usr.bin/sed/TEST/hanoi.in
@@ -0,0 +1,2 @@
+:abcd: : :
+
diff --git a/usr.bin/sed/TEST/math.expected b/usr.bin/sed/TEST/math.expected
new file mode 100644
index 00000000000..7273c0fa8c5
--- /dev/null
+++ b/usr.bin/sed/TEST/math.expected
@@ -0,0 +1 @@
+25
diff --git a/usr.bin/sed/TEST/math.in b/usr.bin/sed/TEST/math.in
new file mode 100644
index 00000000000..bb6203b13e5
--- /dev/null
+++ b/usr.bin/sed/TEST/math.in
@@ -0,0 +1,2 @@
+4+7*3+2^7/3
+(4+8)*2
diff --git a/usr.bin/sed/TEST/sed.test b/usr.bin/sed/TEST/sed.test
index 4579730e812..cf79397bc2b 100644
--- a/usr.bin/sed/TEST/sed.test
+++ b/usr.bin/sed/TEST/sed.test
@@ -42,7 +42,7 @@ main()
 {
        BASE=/usr/bin/sed
        BASELOG=sed.out
-       TEST=../obj/sed
+       TEST=../sed
        TESTLOG=nsed.out
        DICT=/usr/share/dict/words
 
Sergey

Reply via email to