svn commit: r259210 - in head: bin bin/date bin/date/tests bin/mv bin/mv/tests bin/pax bin/pax/tests bin/sh bin/sh/tests bin/sh/tests/builtins bin/sh/tests/errors bin/sh/tests/execution bin/sh/test...

Julio Merino jmmv at FreeBSD.org
Wed Dec 11 04:09:22 UTC 2013


Author: jmmv
Date: Wed Dec 11 04:09:17 2013
New Revision: 259210
URL: http://svnweb.freebsd.org/changeset/base/259210

Log:
  Migrate tools/regression/bin/ tests to the new layout.
  
  This change is a proof of concept on how to easily integrate existing
  tests from the tools/regression/ hierarchy into the /usr/tests/ test
  suite and on how to adapt them to the new layout for src.
  
  To achieve these goals, this change:
  
  - Moves tests from tools/regression/bin/<tool>/ to bin/<tool>/tests/.
  - Renames the previous regress.sh files to legacy_test.sh.
  - Adds Makefiles to build and install the tests and all their supporting
    data files into /usr/tests/bin/.
  - Plugs the legacy_test test programs into the test suite using the new
    TAP backend for Kyua (appearing in 0.8) so that the code of the test
    programs does not have to change.
  - Registers the new directories in the BSD.test.dist mtree file.
  
  Reviewed by:	freebsd-testing
  Approved by:	rpaulo (mentor)

Added:
  head/bin/date/tests/
  head/bin/date/tests/Makefile   (contents, props changed)
  head/bin/date/tests/legacy_test.sh
     - copied unchanged from r259205, head/tools/regression/bin/date/regress.sh
  head/bin/mv/tests/
  head/bin/mv/tests/Makefile   (contents, props changed)
  head/bin/mv/tests/legacy_test.sh
     - copied unchanged from r258552, head/tools/regression/bin/mv/regress.sh
  head/bin/pax/tests/
  head/bin/pax/tests/Makefile   (contents, props changed)
     - copied unchanged from r258552, head/tools/regression/bin/pax/regress.t
  head/bin/sh/tests/
  head/bin/sh/tests/Makefile   (contents, props changed)
  head/bin/sh/tests/builtins/
     - copied from r258552, head/tools/regression/bin/sh/builtins/
  head/bin/sh/tests/builtins/Makefile   (contents, props changed)
  head/bin/sh/tests/errors/
     - copied from r258552, head/tools/regression/bin/sh/errors/
  head/bin/sh/tests/errors/Makefile   (contents, props changed)
  head/bin/sh/tests/execution/
     - copied from r258552, head/tools/regression/bin/sh/execution/
  head/bin/sh/tests/execution/Makefile   (contents, props changed)
  head/bin/sh/tests/expansion/
     - copied from r258552, head/tools/regression/bin/sh/expansion/
  head/bin/sh/tests/expansion/Makefile   (contents, props changed)
  head/bin/sh/tests/legacy_test.sh
     - copied, changed from r258552, head/tools/regression/bin/sh/regress.sh
  head/bin/sh/tests/parameters/
     - copied from r258552, head/tools/regression/bin/sh/parameters/
  head/bin/sh/tests/parameters/Makefile   (contents, props changed)
  head/bin/sh/tests/parser/
     - copied from r258552, head/tools/regression/bin/sh/parser/
  head/bin/sh/tests/parser/Makefile   (contents, props changed)
  head/bin/sh/tests/set-e/
     - copied from r258552, head/tools/regression/bin/sh/set-e/
  head/bin/sh/tests/set-e/Makefile   (contents, props changed)
  head/bin/test/tests/
  head/bin/test/tests/Makefile   (contents, props changed)
  head/bin/test/tests/legacy_test.sh
     - copied unchanged from r258552, head/tools/regression/bin/test/regress.sh
  head/bin/tests/
  head/bin/tests/Makefile   (contents, props changed)
Directory Properties:
  head/bin/pax/tests/legacy_test.sh   (props changed)
Deleted:
  head/tools/regression/bin/
Modified:
  head/bin/Makefile
  head/bin/date/Makefile
  head/bin/mv/Makefile
  head/bin/pax/Makefile
  head/bin/sh/Makefile
  head/bin/test/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/bin/Makefile
==============================================================================
--- head/bin/Makefile	Wed Dec 11 03:41:07 2013	(r259209)
+++ head/bin/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -52,6 +52,10 @@ SUBDIR+=	rmail
 SUBDIR+=	csh
 .endif
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=	tests
+.endif
+
 .include <bsd.arch.inc.mk>
 
 SUBDIR:=	${SUBDIR:O}

Modified: head/bin/date/Makefile
==============================================================================
--- head/bin/date/Makefile	Wed Dec 11 03:41:07 2013	(r259209)
+++ head/bin/date/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -1,7 +1,13 @@
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	date
 SRCS=	date.c netdate.c vary.c
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=    tests
+.endif
+
 .include <bsd.prog.mk>

Added: head/bin/date/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/date/tests/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/bin/date
+
+TAP_TESTS_SH=	legacy_test
+
+.include <tap.test.mk>

Copied: head/bin/date/tests/legacy_test.sh (from r259205, head/tools/regression/bin/date/regress.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/date/tests/legacy_test.sh	Wed Dec 11 04:09:17 2013	(r259210, copy of r259205, head/tools/regression/bin/date/regress.sh)
@@ -0,0 +1,91 @@
+#!/bin/sh
+
+#
+# Regression tests for date(1)
+#
+# Submitted by Edwin Groothuis <edwin at FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+#
+# These two date/times have been chosen carefully, they
+# create both the single digit and double/multidigit version of
+# the values.
+#
+# To create a new one, make sure you are using the UTC timezone!
+#
+
+TEST1=3222243		# 1970-02-07 07:04:03
+TEST2=1005600000	# 2001-11-12 21:11:12
+
+export LC_ALL=C
+export TZ=UTC
+count=0
+
+check()
+{
+	S=$1
+	A1=$2
+	A2=$3
+
+	count=`expr ${count} + 1`
+
+	if [ -z "${A2}" ]; then A2=${A1}; fi
+
+	R=`date -r ${TEST1} +%${S}`
+	if [ "${R}" = "${A1}" ]; then
+		echo "ok ${S}{t1}"
+	else
+		echo "no ok ${S}{t1} - (got ${R}, expected ${A1})"
+	fi
+
+	R=`date -r ${TEST2} +%${S}`
+	if [ "${R}" = "${A2}" ]; then
+		echo "ok ${S}{t2}"
+	else
+		echo "no ok ${S}{t2} - (got ${R}, expected ${A2})"
+	fi
+}
+
+echo "1..78"
+
+check A Saturday Monday
+check a Sat Mon
+check B February November
+check b Feb Nov
+check C 19 20
+check c "Sat Feb  7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
+check D 02/07/70 11/12/01
+check d 07 12
+check e " 7" 12
+check F "1970-02-07" "2001-11-12"
+check G 1970 2001
+check g 70 01
+check H 07 21
+check h Feb Nov
+check I 07 09
+check j 038 316
+check k " 7" 21
+check l " 7" " 9"
+check M 04 20
+check m 02 11
+check p AM PM
+check R 07:04 21:20
+check r "07:04:03 AM" "09:20:00 PM"
+check S 03 00
+check s ${TEST1} ${TEST2}
+check U 05 45
+check u 6 1
+check V 06 46
+check v " 7-Feb-1970" "12-Nov-2001"
+check W 05 46
+check w 6 1
+check X "07:04:03" "21:20:00"
+check x "02/07/70" "11/12/01"
+check Y 1970 2001
+check y 70 01
+check Z UTC UTC
+check z +0000 +0000
+check % % %
+check + "Sat Feb  7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"

Modified: head/bin/mv/Makefile
==============================================================================
--- head/bin/mv/Makefile	Wed Dec 11 03:41:07 2013	(r259209)
+++ head/bin/mv/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -1,6 +1,12 @@
 #	@(#)Makefile	8.2 (Berkeley) 4/2/94
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	mv
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=    tests
+.endif
+
 .include <bsd.prog.mk>

Added: head/bin/mv/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/mv/tests/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/bin/mv
+
+TAP_TESTS_SH=	legacy_test
+
+.include <tap.test.mk>

Copied: head/bin/mv/tests/legacy_test.sh (from r258552, head/tools/regression/bin/mv/regress.sh)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/mv/tests/legacy_test.sh	Wed Dec 11 04:09:17 2013	(r259210, copy of r258552, head/tools/regression/bin/mv/regress.sh)
@@ -0,0 +1,296 @@
+#!/bin/sh
+# $FreeBSD$
+
+# A directory in a device different from that where the tests are run
+TMPDIR=/tmp/regress.$$
+COUNT=0
+
+# Begin an individual test
+begin()
+{
+	COUNT=`expr $COUNT + 1`
+	OK=1
+	if [ -z "$FS" ]
+	then
+		NAME="$1"
+	else
+		NAME="$1 (cross device)"
+	fi
+	rm -rf testdir $TMPDIR/testdir
+	mkdir -p testdir $TMPDIR/testdir
+	cd testdir
+}
+
+# End an individual test
+end()
+{
+	if [ $OK = 1 ]
+	then
+		printf 'ok '
+	else
+		printf 'not ok '
+	fi
+	echo "$COUNT - $NAME"
+	cd ..
+	rm -rf testdir $TMPDIR/testdir
+}
+
+# Make a file that can later be verified
+mkf()
+{
+	CN=`basename $1`
+	echo "$CN-$CN" >$1
+}
+
+# Verify that the file specified is correct
+ckf()
+{
+	if [ -f $2 ] && echo "$1-$1" | diff - $2 >/dev/null
+	then
+		ok
+	else
+		notok
+	fi
+}
+
+# Make a fifo that can later be verified
+mkp()
+{
+	mkfifo $1
+}
+
+# Verify that the file specified is correct
+ckp()
+{
+	if [ -p $2 ]
+	then
+		ok
+	else
+		notok
+	fi
+}
+
+# Make a directory that can later be verified
+mkd()
+{
+	CN=`basename $1`
+	mkdir -p $1/"$CN-$CN"
+}
+
+# Verify that the directory specified is correct
+ckd()
+{
+	if [ -d $2/$1-$1 ]
+	then
+		ok
+	else
+		notok
+	fi
+}
+
+# Verify that the specified file does not exist
+# (is not there)
+cknt()
+{
+	if [ -r $1 ]
+	then
+		notok
+	else
+		ok
+	fi
+}
+
+# A part of a test succeeds
+ok()
+{
+	:
+}
+
+# A part of a test fails
+notok()
+{
+	OK=0
+}
+
+# Verify that the exit code passed is for unsuccessful termination
+ckfail()
+{
+	if [ $1 -gt 0 ]
+	then
+		ok
+	else
+		notok
+	fi
+}
+
+# Verify that the exit code passed is for successful termination
+ckok()
+{
+	if [ $1 -eq 0 ]
+	then
+		ok
+	else
+		notok
+	fi
+}
+
+# Run all tests locally and across devices
+echo 1..32
+for FS in '' $TMPDIR/testdir/
+do
+	begin 'Rename file'
+	mkf fa
+	mv fa ${FS}fb
+	ckok $?
+	ckf fa ${FS}fb
+	cknt fa
+	end
+
+	begin 'Move files into directory'
+	mkf fa
+	mkf fb
+	mkdir -p ${FS}1/2/3
+	mv fa fb ${FS}1/2/3
+	ckok $?
+	ckf fa ${FS}1/2/3/fa
+	ckf fb ${FS}1/2/3/fb
+	cknt fa
+	cknt fb
+	end
+
+	begin 'Move file from directory to file'
+	mkdir -p 1/2/3
+	mkf 1/2/3/fa
+	mv 1/2/3/fa ${FS}fb
+	ckok $?
+	ckf fa ${FS}fb
+	cknt 1/2/3/fa
+	end
+
+	begin 'Move file from directory to existing file'
+	mkdir -p 1/2/3
+	mkf 1/2/3/fa
+	:> ${FS}fb
+	mv 1/2/3/fa ${FS}fb
+	ckok $?
+	ckf fa ${FS}fb
+	cknt 1/2/3/fa
+	end
+
+	begin 'Move file from directory to existing directory'
+	mkdir -p 1/2/3
+	mkf 1/2/3/fa
+	mkdir -p ${FS}db/fa
+	# Should fail per POSIX step 3a:
+	# Destination path is a file of type directory and
+	# source_file is not a file of type directory
+	mv 1/2/3/fa ${FS}db 2>/dev/null
+	ckfail $?
+	ckf fa 1/2/3/fa
+	end
+
+	begin 'Move file from directory to directory'
+	mkdir -p da1/da2/da3
+	mkdir -p ${FS}db1/db2/db3
+	mkf da1/da2/da3/fa
+	mv da1/da2/da3/fa ${FS}db1/db2/db3/fb
+	ckok $?
+	ckf fa ${FS}db1/db2/db3/fb
+	cknt da1/da2/da3/fa
+	end
+
+	begin 'Rename directory'
+	mkd da
+	mv da ${FS}db
+	ckok $?
+	ckd da ${FS}db
+	cknt da
+	end
+
+	begin 'Move directory to directory name'
+	mkd da1/da2/da3/da
+	mkdir -p ${FS}db1/db2/db3
+	mv da1/da2/da3/da ${FS}db1/db2/db3/db
+	ckok $?
+	ckd da ${FS}db1/db2/db3/db
+	cknt da1/da2/da3/da
+	end
+
+	begin 'Move directory to directory'
+	mkd da1/da2/da3/da
+	mkdir -p ${FS}db1/db2/db3
+	mv da1/da2/da3/da ${FS}db1/db2/db3
+	ckok $?
+	ckd da ${FS}db1/db2/db3/da
+	cknt da1/da2/da3/da
+	end
+
+	begin 'Move directory to existing empty directory'
+	mkd da1/da2/da3/da
+	mkdir -p ${FS}db1/db2/db3/da
+	mv da1/da2/da3/da ${FS}db1/db2/db3
+	ckok $?
+	ckd da ${FS}db1/db2/db3/da
+	cknt da1/da2/da3/da
+	end
+
+	begin 'Move directory to existing non-empty directory'
+	mkd da1/da2/da3/da
+	mkdir -p ${FS}db1/db2/db3/da/full
+	# Should fail (per the semantics of rename(2))
+	mv da1/da2/da3/da ${FS}db1/db2/db3 2>/dev/null
+	ckfail $?
+	ckd da da1/da2/da3/da
+	end
+
+	begin 'Move directory to existing file'
+	mkd da1/da2/da3/da
+	mkdir -p ${FS}db1/db2/db3
+	:> ${FS}db1/db2/db3/da
+	# Should fail per POSIX step 3b:
+	# Destination path is a file not of type directory
+	# and source_file is a file of type directory
+	mv da1/da2/da3/da ${FS}db1/db2/db3/da 2>/dev/null
+	ckfail $?
+	ckd da da1/da2/da3/da
+	end
+
+	begin 'Rename fifo'
+	mkp fa
+	mv fa ${FS}fb
+	ckok $?
+	ckp fa ${FS}fb
+	cknt fa
+	end
+
+	begin 'Move fifos into directory'
+	mkp fa
+	mkp fb
+	mkdir -p ${FS}1/2/3
+	mv fa fb ${FS}1/2/3
+	ckok $?
+	ckp fa ${FS}1/2/3/fa
+	ckp fb ${FS}1/2/3/fb
+	cknt fa
+	cknt fb
+	end
+
+	begin 'Move fifo from directory to fifo'
+	mkdir -p 1/2/3
+	mkp 1/2/3/fa
+	mv 1/2/3/fa ${FS}fb
+	ckok $?
+	ckp fa ${FS}fb
+	cknt 1/2/3/fa
+	end
+
+	begin 'Move fifo from directory to directory'
+	mkdir -p da1/da2/da3
+	mkdir -p ${FS}db1/db2/db3
+	mkp da1/da2/da3/fa
+	mv da1/da2/da3/fa ${FS}db1/db2/db3/fb
+	ckok $?
+	ckp fa ${FS}db1/db2/db3/fb
+	cknt da1/da2/da3/fa
+	end
+done

Modified: head/bin/pax/Makefile
==============================================================================
--- head/bin/pax/Makefile	Wed Dec 11 03:41:07 2013	(r259209)
+++ head/bin/pax/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -1,6 +1,8 @@
 #       @(#)Makefile	8.1 (Berkeley) 5/31/93
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 # To install on versions prior to BSD 4.4 the following may have to be
 # defined with CFLAGS +=
 #
@@ -30,4 +32,8 @@ SRCS=	ar_io.c ar_subs.c buf_subs.c cache
 	gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \
 	tables.c tar.c tty_subs.c
 
+.if ${MK_TESTS} != "no"
+SUBDIR+=    tests
+.endif
+
 .include <bsd.prog.mk>

Added: head/bin/pax/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/pax/tests/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,9 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/bin/pax
+
+TAP_TESTS_SH=	legacy_test
+
+.include <tap.test.mk>

Copied: head/bin/pax/tests/legacy_test.sh (from r258552, head/tools/regression/bin/pax/regress.t)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/pax/tests/legacy_test.sh	Wed Dec 11 04:09:17 2013	(r259210, copy of r258552, head/tools/regression/bin/pax/regress.t)
@@ -0,0 +1,91 @@
+#! /usr/bin/perl
+#
+# $FreeBSD$
+
+use strict;
+use warnings;
+
+use Test::More tests => 6;
+use File::Path qw(rmtree mkpath);
+use Cwd;
+
+my $n = 0;
+sub create_file {
+    my $fn = shift;
+
+    $n++;
+    (my $dir = $fn) =~ s,/[^/]+$,,;
+    mkpath $dir;
+    open my $fd, ">", $fn or die "$fn: $!";
+    print $fd "file $n\n";
+}
+
+
+ustar_pathnames: { SKIP: {
+    # Prove that pax breaks up ustar pathnames properly
+
+    my $top = getcwd . "/ustar-pathnames-1";
+    skip "Current path is too long", 6 if length $top > 92;
+    rmtree $top;
+    my $subdir = "x" . "x" x (92 - length $top);
+    my $work94 = "$top/$subdir";
+    mkpath $work94;		# $work is 94 characters long
+
+    my $x49 = "x" x 49;
+    my $x50 = "x" x 50;
+    my $x60 = "x" x 60;
+    my $x95 = "x" x 95;
+
+    my @paths = (
+	"$work94/x099",		# 99 chars
+	"$work94/xx100",		# 100 chars
+	"$work94/xxx101",		# 101 chars
+	"$work94/$x49/${x50}x199",	# 199 chars
+	"$work94/$x49/${x50}xx200",	# 200 chars
+	"$work94/$x49/${x50}xxx201",	# 201 chars
+	"$work94/$x60/${x95}254",	# 254 chars
+	"$work94/$x60/${x95}x255",	# 255 chars
+    );
+
+    my @l = map { length } @paths;
+
+    my $n = 0;
+    create_file $_ for @paths;
+    system "pax -wf ustar.ok $work94";
+    ok($? == 0, "Wrote 'ustar.ok' containing files with lengths @l");
+
+    (my $orig = $top) =~ s,1$,2,;
+    rmtree $orig;
+    rename $top, $orig;
+
+    system "pax -rf ustar.ok";
+    ok($? == 0, "Restored 'ustar.ok' containing files with lengths @l");
+
+    system "diff -ru $orig $top";
+    ok($? == 0, "Restored files are identical");
+
+    rmtree $top;
+    rename $orig, $top;
+
+    # 256 chars (with components < 100 chars) should not work
+    push @paths, "$work94/x$x60/${x95}x256";	# 256 chars
+    push @l, length $paths[-1];
+    create_file $paths[-1];
+    system "pax -wf ustar.fail1 $work94";
+    ok($?, "Failed to write 'ustar.fail1' containing files with lengths @l");
+
+    # Components with 100 chars shouldn't work
+    unlink $paths[-1];
+    $paths[-1] = "$work94/${x95}xc100";		# 100 char filename
+    $l[-1] = length $paths[-1];
+    create_file $paths[-1];
+    system "pax -wf ustar.fail2 $work94";
+    ok($?, "Failed to write 'ustar.fail2' with a 100 char filename");
+
+    unlink $paths[-1];
+    $paths[-1] = "$work94/${x95}xc100/x";	# 100 char component
+    $l[-1] = length $paths[-1];
+    create_file $paths[-1];
+    system "pax -wf ustar.fail3 $work94";
+    ok($?, "Failed to write 'ustar.fail3' with a 100 char component");
+}}

Modified: head/bin/sh/Makefile
==============================================================================
--- head/bin/sh/Makefile	Wed Dec 11 03:41:07 2013	(r259209)
+++ head/bin/sh/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -1,6 +1,8 @@
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 # $FreeBSD$
 
+.include <bsd.own.mk>
+
 PROG=	sh
 INSTALLFLAGS= -S
 SHSRCS=	alias.c arith_yacc.c arith_yylex.c cd.c echo.c error.c eval.c \
@@ -59,7 +61,8 @@ syntax.c syntax.h: mksyntax
 token.h: mktokens
 	sh ${.CURDIR}/mktokens
 
-regress:
-	cd ${.CURDIR}/../../tools/regression/bin/sh && ${MAKE} SH=${.OBJDIR}/sh
+.if ${MK_TESTS} != "no"
+SUBDIR+=    tests
+.endif
 
 .include <bsd.prog.mk>

Added: head/bin/sh/tests/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,12 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTSDIR=	${TESTSBASE}/bin/sh
+
+TAP_TESTS_SH=	legacy_test
+TAP_TESTS_SH_SED_legacy_test=	-e 's,__SH__,/bin/sh,g'
+
+SUBDIR+=	builtins errors execution expansion parameters parser set-e
+
+.include <tap.test.mk>

Added: head/bin/sh/tests/builtins/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/builtins/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,147 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+FILESDIR=	${TESTSBASE}/bin/sh/builtins
+KYUAFILE=	no
+
+FILES=		alias.0 alias.0.stdout
+FILES+=		alias.1 alias.1.stderr
+FILES+=		alias3.0 alias3.0.stdout
+FILES+=		alias4.0
+FILES+=		break1.0
+FILES+=		break2.0 break2.0.stdout
+FILES+=		break3.0
+FILES+=		break4.4
+FILES+=		break5.4
+FILES+=		builtin1.0
+FILES+=		case1.0
+FILES+=		case2.0
+FILES+=		case3.0
+FILES+=		case4.0
+FILES+=		case5.0
+FILES+=		case6.0
+FILES+=		case7.0
+FILES+=		case8.0
+FILES+=		case9.0
+FILES+=		case10.0
+FILES+=		case11.0
+FILES+=		case12.0
+FILES+=		case13.0
+FILES+=		case14.0
+FILES+=		case15.0
+FILES+=		case16.0
+FILES+=		case17.0
+FILES+=		case18.0
+FILES+=		case19.0
+FILES+=		cd1.0
+FILES+=		cd2.0
+FILES+=		cd3.0
+FILES+=		cd4.0
+FILES+=		cd5.0
+FILES+=		cd6.0
+FILES+=		cd7.0
+FILES+=		cd8.0
+FILES+=		command1.0
+FILES+=		command2.0
+FILES+=		command3.0
+FILES+=		command3.0.stdout
+FILES+=		command4.0
+FILES+=		command5.0
+FILES+=		command5.0.stdout
+FILES+=		command6.0
+FILES+=		command6.0.stdout
+FILES+=		command7.0
+FILES+=		command8.0
+FILES+=		command9.0
+FILES+=		command10.0
+FILES+=		command11.0
+FILES+=		command12.0
+FILES+=		dot1.0
+FILES+=		dot2.0
+FILES+=		dot3.0
+FILES+=		dot4.0
+FILES+=		eval1.0
+FILES+=		eval2.0
+FILES+=		eval3.0
+FILES+=		eval4.0
+FILES+=		eval5.0
+FILES+=		eval6.0
+FILES+=		exec1.0
+FILES+=		exec2.0
+FILES+=		exit1.0
+FILES+=		exit2.8
+FILES+=		exit3.0
+FILES+=		export1.0
+FILES+=		fc1.0
+FILES+=		fc2.0
+FILES+=		for1.0
+FILES+=		for2.0
+FILES+=		for3.0
+FILES+=		getopts1.0 getopts1.0.stdout
+FILES+=		getopts2.0 getopts2.0.stdout
+FILES+=		hash1.0 hash1.0.stdout
+FILES+=		hash2.0 hash2.0.stdout
+FILES+=		hash3.0 hash3.0.stdout
+FILES+=		hash4.0
+FILES+=		jobid1.0
+FILES+=		jobid2.0
+FILES+=		lineno.0 lineno.0.stdout
+FILES+=		local1.0
+FILES+=		local2.0
+FILES+=		local3.0
+FILES+=		local4.0
+FILES+=		locale1.0
+FILES+=		printf1.0
+FILES+=		printf2.0
+FILES+=		printf3.0
+FILES+=		printf4.0
+FILES+=		read1.0 read1.0.stdout
+FILES+=		read2.0
+FILES+=		read3.0 read3.0.stdout
+FILES+=		read4.0 read4.0.stdout
+FILES+=		read5.0
+FILES+=		read6.0
+FILES+=		read7.0
+FILES+=		return1.0
+FILES+=		return2.1
+FILES+=		return3.1
+FILES+=		return4.0
+FILES+=		return5.0
+FILES+=		return6.4
+FILES+=		return7.4
+FILES+=		return8.0
+FILES+=		set1.0
+FILES+=		set2.0
+FILES+=		trap1.0
+FILES+=		trap10.0
+FILES+=		trap11.0
+FILES+=		trap12.0
+FILES+=		trap13.0
+FILES+=		trap14.0
+FILES+=		trap2.0
+FILES+=		trap3.0
+FILES+=		trap4.0
+FILES+=		trap5.0
+FILES+=		trap6.0
+FILES+=		trap7.0
+FILES+=		trap8.0
+FILES+=		trap9.0
+FILES+=		type1.0 type1.0.stderr
+FILES+=		type2.0
+FILES+=		type3.0
+FILES+=		unalias.0
+FILES+=		var-assign.0
+FILES+=		var-assign2.0
+FILES+=		wait1.0
+FILES+=		wait2.0
+FILES+=		wait3.0
+FILES+=		wait4.0
+FILES+=		wait5.0
+FILES+=		wait6.0
+FILES+=		wait7.0
+FILES+=		wait8.0
+FILES+=		wait9.127
+FILES+=		wait10.0
+
+.include <bsd.test.mk>

Added: head/bin/sh/tests/errors/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/errors/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+FILESDIR=	${TESTSBASE}/bin/sh/errors
+KYUAFILE=	no
+
+FILES=		assignment-error1.0
+FILES+=		assignment-error2.0
+FILES+=		backquote-error1.0
+FILES+=		backquote-error2.0
+FILES+=		bad-binary1.126
+FILES+=		bad-keyword1.0
+FILES+=		bad-parm-exp1.0
+FILES+=		bad-parm-exp2.2 bad-parm-exp2.2.stderr
+FILES+=		bad-parm-exp3.2 bad-parm-exp3.2.stderr
+FILES+=		bad-parm-exp4.2 bad-parm-exp4.2.stderr
+FILES+=		bad-parm-exp5.2 bad-parm-exp5.2.stderr
+FILES+=		bad-parm-exp6.2 bad-parm-exp6.2.stderr
+FILES+=		option-error.0
+FILES+=		redirection-error.0
+FILES+=		redirection-error2.2
+FILES+=		redirection-error3.0
+FILES+=		redirection-error4.0
+FILES+=		redirection-error5.0
+FILES+=		redirection-error6.0
+FILES+=		redirection-error7.0
+FILES+=		write-error1.0
+
+.include <bsd.test.mk>

Added: head/bin/sh/tests/execution/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/execution/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+FILESDIR=	${TESTSBASE}/bin/sh/execution
+KYUAFILE=	no
+
+FILES=		bg1.0
+FILES+=		bg2.0
+FILES+=		bg3.0
+FILES+=		bg4.0
+FILES+=		bg5.0
+FILES+=		bg6.0 bg6.0.stdout
+FILES+=		bg7.0
+FILES+=		bg8.0
+FILES+=		bg9.0
+FILES+=		bg10.0 bg10.0.stdout
+FILES+=		fork1.0
+FILES+=		fork2.0
+FILES+=		fork3.0
+FILES+=		func1.0
+FILES+=		func2.0
+FILES+=		func3.0
+FILES+=		hash1.0
+FILES+=		int-cmd1.0
+FILES+=		killed1.0
+FILES+=		killed2.0
+FILES+=		not1.0
+FILES+=		not2.0
+FILES+=		path1.0
+FILES+=		redir1.0
+FILES+=		redir2.0
+FILES+=		redir3.0
+FILES+=		redir4.0
+FILES+=		redir5.0
+FILES+=		redir6.0
+FILES+=		redir7.0
+FILES+=		set-n1.0
+FILES+=		set-n2.0
+FILES+=		set-n3.0
+FILES+=		set-n4.0
+FILES+=		set-x1.0
+FILES+=		set-x2.0
+FILES+=		set-x3.0
+FILES+=		shellproc1.0
+FILES+=		subshell1.0 subshell1.0.stdout
+FILES+=		subshell2.0
+FILES+=		subshell3.0
+FILES+=		subshell4.0
+FILES+=		unknown1.0
+FILES+=		var-assign1.0
+
+.include <bsd.test.mk>

Added: head/bin/sh/tests/expansion/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/expansion/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,86 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+FILESDIR=	${TESTSBASE}/bin/sh/expansion
+KYUAFILE=	no
+
+FILES=		arith1.0
+FILES+=		arith2.0
+FILES+=		arith3.0
+FILES+=		arith4.0
+FILES+=		arith5.0
+FILES+=		arith6.0
+FILES+=		arith7.0
+FILES+=		arith8.0
+FILES+=		arith9.0
+FILES+=		arith10.0
+FILES+=		arith11.0
+FILES+=		arith12.0
+FILES+=		arith13.0
+FILES+=		assign1.0
+FILES+=		cmdsubst1.0
+FILES+=		cmdsubst2.0
+FILES+=		cmdsubst3.0
+FILES+=		cmdsubst4.0
+FILES+=		cmdsubst5.0
+FILES+=		cmdsubst6.0
+FILES+=		cmdsubst7.0
+FILES+=		cmdsubst8.0
+FILES+=		cmdsubst9.0
+FILES+=		cmdsubst10.0
+FILES+=		cmdsubst11.0
+FILES+=		cmdsubst12.0
+FILES+=		cmdsubst13.0
+FILES+=		cmdsubst14.0
+FILES+=		cmdsubst15.0
+FILES+=		cmdsubst16.0
+FILES+=		cmdsubst17.0
+FILES+=		export1.0
+FILES+=		export2.0
+FILES+=		export3.0
+FILES+=		heredoc1.0
+FILES+=		heredoc2.0
+FILES+=		ifs1.0
+FILES+=		ifs2.0
+FILES+=		ifs3.0
+FILES+=		ifs4.0
+FILES+=		length1.0
+FILES+=		length2.0
+FILES+=		length3.0
+FILES+=		length4.0
+FILES+=		length5.0
+FILES+=		length6.0
+FILES+=		length7.0
+FILES+=		length8.0
+FILES+=		local1.0
+FILES+=		local2.0
+FILES+=		pathname1.0
+FILES+=		pathname2.0
+FILES+=		pathname3.0
+FILES+=		pathname4.0
+FILES+=		plus-minus1.0
+FILES+=		plus-minus2.0
+FILES+=		plus-minus3.0
+FILES+=		plus-minus4.0
+FILES+=		plus-minus5.0
+FILES+=		plus-minus6.0
+FILES+=		plus-minus7.0
+FILES+=		plus-minus8.0
+FILES+=		question1.0
+FILES+=		readonly1.0
+FILES+=		set-u1.0
+FILES+=		set-u2.0
+FILES+=		set-u3.0
+FILES+=		tilde1.0
+FILES+=		tilde2.0
+FILES+=		trim1.0
+FILES+=		trim2.0
+FILES+=		trim3.0
+FILES+=		trim4.0
+FILES+=		trim5.0
+FILES+=		trim6.0
+FILES+=		trim7.0
+FILES+=		trim8.0
+
+.include <bsd.test.mk>

Copied and modified: head/bin/sh/tests/legacy_test.sh (from r258552, head/tools/regression/bin/sh/regress.sh)
==============================================================================
--- head/tools/regression/bin/sh/regress.sh	Mon Nov 25 13:30:06 2013	(r258552, copy source)
+++ head/bin/sh/tests/legacy_test.sh	Wed Dec 11 04:09:17 2013	(r259210)
@@ -1,10 +1,13 @@
 # $FreeBSD$
 
-if [ -z "${SH}" ]; then
-	echo '${SH} is not set, please correct and re-run.'
-	exit 1
-fi
-export SH=${SH}
+: ${SH:="__SH__"}
+export SH
+
+# TODO(jmmv): The Kyua TAP interface should be passing us the value of
+# "srcdir" as an environment variable, just as it does with the ATF
+# interface in the form of a configuration variable.  For now, just try
+# to guess this.
+: ${TESTS_DATA:=$(dirname ${0})}
 
 COUNTER=1
 
@@ -17,6 +20,7 @@ do_test() {
 		rm tmp.stdout tmp.stderr
 		return
 	fi
+	sed -I '' -e "s|^${TESTS_DATA}|.|" tmp.stderr
 	for i in stdout stderr; do
 		if [ -f ${1}.${i} ]; then
 			if ! cmp -s tmp.${i} ${1}.${i}; then
@@ -34,7 +38,7 @@ do_test() {
 	rm tmp.stdout tmp.stderr
 }
 
-TESTS=$(find -Es . -regex ".*\.[0-9]+")
+TESTS=$(find -Es ${TESTS_DATA} -regex ".*\.[0-9]+")
 printf "1..%d\n" $(echo ${TESTS} | wc -w)
 
 for i in ${TESTS} ; do

Added: head/bin/sh/tests/parameters/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/bin/sh/tests/parameters/Makefile	Wed Dec 11 04:09:17 2013	(r259210)
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+FILESDIR=	${TESTSBASE}/bin/sh/parameters
+KYUAFILE=	no
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list