Date: Sun, 13 Jan 2008 04:29:34 +0200 (EET) From: Giorgos Keramidas <keramida@FreeBSD.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Diomidis Spinellis <dds@FreeBSD.org> Subject: bin/119614: regression tests for tr(1) Message-ID: <200801130229.m0D2TYpV002257@kobe.laptop> Resent-Message-ID: <200801130230.m0D2U0P7044287@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 119614
>Category: bin
>Synopsis: regression tests for tr(1)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sun Jan 13 02:30:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Giorgos Keramidas
>Release: FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:
System: FreeBSD kobe 8.0-CURRENT FreeBSD 8.0-CURRENT #0: \
Tue Jan 8 23:38:14 EET 2008 \
build@kobe:/home/build/obj/home/build/src/sys/KOBE i386
>Description:
The attached patch adds a small set of regression tests for tr(1).
It is far from a complete set of tests, but we can always expand
it (I'm hoping for the help of Diomidis for directions about the
best way to do that).
>How-To-Repeat:
After applying the patch, it should be possible to run:
cd /usr/src/tools/regression/usr.bin/tr
make
>Fix:
--- regression-tr.patch begins here ---
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/Makefile
--- a/tools/regression/usr.bin/Makefile Sun Jan 13 04:24:27 2008 +0200
+++ b/tools/regression/usr.bin/Makefile Sun Jan 13 04:24:28 2008 +0200
@@ -1,5 +1,16 @@
# $FreeBSD: src/tools/regression/usr.bin/Makefile,v 1.12 2007/06/03 03:29:31 grog Exp $
-SUBDIR= calendar file2c join jot m4 printf sed uudecode uuencode xargs lastcomm
+SUBDIR = calendar
+SUBDIR+= file2c
+SUBDIR+= join
+SUBDIR+= jot
+SUBDIR+= lastcomm
+SUBDIR+= m4
+SUBDIR+= printf
+SUBDIR+= sed
+SUBDIR+= tr
+SUBDIR+= uudecode
+SUBDIR+= uuencode
+SUBDIR+= xargs
.include <bsd.subdir.mk>
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/Makefile Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+all:
+ @m4 ${.CURDIR}/../regress.m4 ${.CURDIR}/regress.sh | sh /dev/stdin ${.CURDIR}
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.00.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.00.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+qui3k 2rown
+fox jump54
+ov5r th5 l1zy
+4og
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.01.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.01.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.02.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.02.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+quik brown
+fox jumpd
+ovr th lzy
+do
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.03.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.03.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+QUICK BROWN
+FOX JUMPED
+OVER THE LAZY
+DOG
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.04.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.04.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+..... .....
+... ......
+.... ... ....
+...
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.05.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.05.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.06.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.06.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,9 @@
+??? bottles of beer on the wall, ??? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+?? bottles of beer on the wall, ?? bottles of beer.
+Take one down and pass it around - ?? bottles of beer on the wall.
+...
+? bottles of beer on the wall, ? bottles of beer!!!
+Take one down and pass it around - ? bottle of beer on the wall.
+? bottle of beer on the wall, ? bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.07.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.07.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,9 @@
+### ####### ## #### ## ### ####, ### ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+## ####### ## #### ## ### ####, ## ####### ## ####.
+#### ### #### ### #### ## ###### - ## ####### ## #### ## ### ####.
+...
+# ####### ## #### ## ### ####, # ####### ## ####!!!
+#### ### #### ### #### ## ###### - # ###### ## #### ## ### ####.
+# ###### ## #### ## ### ####, # ###### ## ####!!!
+#### ## #### ### #### ## ###### - ## #### ####### ## #### ## ### ####!!!
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.08.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.08.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,9 @@
+100,100.
+-99.
+99,99.
+-98.
+...
+2,2!!!
+-1.
+1,1!!!
+-!!!
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.09.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.09.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,1 @@
+?#
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.0a.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.0a.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,1 @@
+$?$$$$$$$$
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.0b.out
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.0b.out Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,1 @@
+100befbeeea100befbeeaeedadaad99befbeeea99befbeeea99befbeeaeedadaad98befbeeea2befbeeea2befbeeaeedadaad1befbeeea1befbeeea1befbeeaedadaadEbefbeeea
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.in Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,4 @@
+quick brown
+fox jumped
+over the lazy
+dog
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.sh Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+echo 1..12
+
+REGRESSION_START($1)
+
+REGRESSION_TEST(`00', `tr abcde 12345 < regress.in')
+REGRESSION_TEST(`01', `tr 12345 abcde < regress.in')
+REGRESSION_TEST(`02', `tr -d aceg < regress.in')
+REGRESSION_TEST(`03', `tr "[[:lower:]]" "[[:upper:]]" < regress.in')
+REGRESSION_TEST(`04', `tr "[[:alpha:]]" . < regress.in')
+REGRESSION_TEST(`05', `tr "[[:lower:]]" "[[:upper:]]" < regress.in | tr "[[:upper:]]" "[[:lower:]]"')
+REGRESSION_TEST(`06', `tr "[[:digit:]]" "?" < regress2.in')
+REGRESSION_TEST(`07', `tr "[[:alnum:]]" "#" < regress2.in')
+REGRESSION_TEST(`08', `tr "[[:upper:]]" "[[:lower:]]" < regress2.in | tr -d "[^[:alpha:]] "')
+REGRESSION_TEST(`09', `printf "\\f\\r\\n" | tr "\\014\\r" "?#"')
+REGRESSION_TEST(`0a', `printf "0xdeadbeef\\n" | tr "x[[:xdigit:]]" "?\$"')
+REGRESSION_TEST(`0b', `(tr -cd "[[:xdigit:]]" < regress2.in ; echo)')
+
+REGRESSION_END()
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress.t Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+cd `dirname $0`
+
+m4 ../regress.m4 regress.sh | sh
diff -r cdc776357ea9 -r 5f6d24ce0a4d tools/regression/usr.bin/tr/regress2.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/regression/usr.bin/tr/regress2.in Sun Jan 13 04:24:28 2008 +0200
@@ -0,0 +1,9 @@
+100 bottles of beer on the wall, 100 bottles of beer.
+Take one down and pass it around - 99 bottles of beer on the wall.
+99 bottles of beer on the wall, 99 bottles of beer.
+Take one down and pass it around - 98 bottles of beer on the wall.
+...
+2 bottles of beer on the wall, 2 bottles of beer!!!
+Take one down and pass it around - 1 bottle of beer on the wall.
+1 bottle of beer on the wall, 1 bottle of beer!!!
+Take it down and pass it around - NO MORE bottles of beer on the wall!!!
--- regression-tr.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801130229.m0D2TYpV002257>
