svn commit: r215022 - in head: bin/test tools/regression/bin tools/regression/bin/test

Jilles Tjoelker jilles at FreeBSD.org
Mon Nov 8 23:15:11 UTC 2010


Author: jilles
Date: Mon Nov  8 23:15:10 2010
New Revision: 215022
URL: http://svn.freebsd.org/changeset/base/215022

Log:
  test: Move tests to tools/regression/bin/test.
  Convert the tests to the perl prove format.
  Remove obsolete TEST.README (results of an old TEST.sh for some old Unices)
  and TEST.csh (old tests without correct values, far less complete than
  TEST.sh).
  
  MFC after:	1 week

Added:
  head/tools/regression/bin/test/
  head/tools/regression/bin/test/Makefile   (contents, props changed)
  head/tools/regression/bin/test/regress.sh
     - copied, changed from r214813, head/bin/test/TEST.sh
  head/tools/regression/bin/test/regress.t   (contents, props changed)
Deleted:
  head/bin/test/TEST.README
  head/bin/test/TEST.csh
  head/bin/test/TEST.sh
Modified:
  head/tools/regression/bin/Makefile

Modified: head/tools/regression/bin/Makefile
==============================================================================
--- head/tools/regression/bin/Makefile	Mon Nov  8 22:12:25 2010	(r215021)
+++ head/tools/regression/bin/Makefile	Mon Nov  8 23:15:10 2010	(r215022)
@@ -1,5 +1,5 @@
 # $FreeBSD$
 
-SUBDIR=	date mv pax sh
+SUBDIR=	date mv pax sh test
 
 .include <bsd.subdir.mk>

Added: head/tools/regression/bin/test/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/test/Makefile	Mon Nov  8 23:15:10 2010	(r215022)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+all:
+	sh regress.sh

Copied and modified: head/tools/regression/bin/test/regress.sh (from r214813, head/bin/test/TEST.sh)
==============================================================================
--- head/bin/test/TEST.sh	Thu Nov  4 22:05:50 2010	(r214813, copy source)
+++ head/tools/regression/bin/test/regress.sh	Mon Nov  8 23:15:10 2010	(r215022)
@@ -30,44 +30,29 @@
 #
 # $FreeBSD$
 
-# force a specified test program, e.g. `env test=/bin/test sh TEST.sh'
+# force a specified test program, e.g. `env test=/bin/test sh regress.sh'
 : ${test=test}		
 
-ERROR=0 FAILED=0
-
 t ()
 {
 	# $1 -> exit code
 	# $2 -> $test expression
 
-	echo -n "$1: $test $2 "
-
+	count=$((count+1))
 	# check for syntax errors
 	syntax="`eval $test $2 2>&1`"
-	if test -z "$syntax"; then
-
-	case $1 in
-		0) if eval $test $2; then echo " OK"; else failed;fi;;
-		1) if eval $test $2; then failed; else echo " OK";fi;;
-	esac
-
+	ret=$?
+	if test -n "$syntax"; then
+		printf "not ok %s - (syntax error)\n" "$count $2"
+	elif [ "$ret" != "$1" ]; then
+		printf "not ok %s - (got $ret, expected $1)\n" "$count $2"
 	else
-		error
+		printf "ok %s\n" "$count $2"
 	fi
 }
 
-error () 
-{
-	echo ""; echo "	$syntax"
-	ERROR=`expr $ERROR + 1`
-}
-
-failed () 
-{
-	echo ""; echo "	failed"
-	FAILED=`expr $FAILED + 1`
-}
-
+count=0
+echo "1..94"
 
 t 0 'b = b' 
 t 1 'b != b' 
@@ -172,6 +157,3 @@ t 1 '-z y -o y = "#" -o y = x'
 t 0 '0 -ne 0 -o ! -f /'
 t 0 '1 -ne 0 -o ! -f /etc/passwd'
 t 1 '0 -ne 0 -o ! -f /etc/passwd'
-
-echo ""
-echo "Syntax errors: $ERROR Failed: $FAILED"

Added: head/tools/regression/bin/test/regress.t
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/tools/regression/bin/test/regress.t	Mon Nov  8 23:15:10 2010	(r215022)
@@ -0,0 +1,6 @@
+#!/bin/sh
+# $FreeBSD$
+
+cd `dirname $0`
+
+sh regress.sh


More information about the svn-src-head mailing list