Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Dec 2015 18:27:38 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r291604 - in stable/10: bin/sh/tests bin/sh/tests/builtins bin/sh/tests/errors bin/sh/tests/execution bin/sh/tests/expansion bin/sh/tests/parameters bin/sh/tests/parser bin/sh/tests/set...
Message-ID:  <201512011827.tB1IRcHM044053@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Dec  1 18:27:38 2015
New Revision: 291604
URL: https://svnweb.freebsd.org/changeset/base/291604

Log:
  MFC r269902,r270101:
  
  r269902:
  
  Convert bin/sh/tests to ATF
  
  The new code uses a "test discovery mechanism" to determine
  what tests are available for execution
  
  The test shell can be specified via:
  
    kyua test -v test_suites.FreeBSD.bin.sh.test_shell=/path/to/test/sh
  
  Sponsored by: EMC / Isilon Storage Division
  Approved by: jmmv (mentor)
  Reviewed by: jilles (maintainer)
  
  r270101 (by jilles):
  
  sh: Don't hardcode relative paths in the tests stderr files.
  
  These paths have had to be adjusted to changes in the testsuite runner
  several times, so modify the tests to remove the need for such adjustment.
  
  A cp in functional_test.sh is now unneeded, but this matters little in
  performance.

Added:
  stable/10/bin/sh/tests/functional_test.sh
     - copied, changed from r269902, head/bin/sh/tests/functional_test.sh
Deleted:
  stable/10/bin/sh/tests/legacy_test.sh
Modified:
  stable/10/bin/sh/tests/Makefile
  stable/10/bin/sh/tests/builtins/Makefile
  stable/10/bin/sh/tests/errors/Makefile
  stable/10/bin/sh/tests/errors/bad-parm-exp2.2
  stable/10/bin/sh/tests/errors/bad-parm-exp2.2.stderr
  stable/10/bin/sh/tests/errors/bad-parm-exp3.2
  stable/10/bin/sh/tests/errors/bad-parm-exp3.2.stderr
  stable/10/bin/sh/tests/errors/bad-parm-exp4.2
  stable/10/bin/sh/tests/errors/bad-parm-exp4.2.stderr
  stable/10/bin/sh/tests/errors/bad-parm-exp5.2
  stable/10/bin/sh/tests/errors/bad-parm-exp5.2.stderr
  stable/10/bin/sh/tests/errors/bad-parm-exp6.2
  stable/10/bin/sh/tests/errors/bad-parm-exp6.2.stderr
  stable/10/bin/sh/tests/execution/Makefile
  stable/10/bin/sh/tests/expansion/Makefile
  stable/10/bin/sh/tests/parameters/Makefile
  stable/10/bin/sh/tests/parser/Makefile
  stable/10/bin/sh/tests/set-e/Makefile
  stable/10/tools/build/mk/OptionalObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/bin/sh/tests/Makefile
==============================================================================
--- stable/10/bin/sh/tests/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -4,15 +4,12 @@
 
 TESTSDIR=	${TESTSBASE}/bin/sh
 
-TAP_TESTS_SH=	legacy_test
-TAP_TESTS_SH_SED_legacy_test=	-e 's,__SH__,/bin/sh,g'
-# Some tests in here are silently not run when the tests are executed as
-# root.  Explicitly tell Kyua to drop privileges.
-#
-# TODO(jmmv): Kyua needs to do this by default, not only when explicitly
-# requested.  See https://code.google.com/p/kyua/issues/detail?id=6
-TEST_METADATA.legacy_test+= required_user="unprivileged"
-
-SUBDIR+=	builtins errors execution expansion parameters parser set-e
+TESTS_SUBDIRS+=	builtins
+TESTS_SUBDIRS+=	errors
+TESTS_SUBDIRS+=	execution
+TESTS_SUBDIRS+=	expansion
+TESTS_SUBDIRS+=	parameters
+TESTS_SUBDIRS+=	parser
+TESTS_SUBDIRS+=	set-e
 
 .include <bsd.test.mk>

Modified: stable/10/bin/sh/tests/builtins/Makefile
==============================================================================
--- stable/10/bin/sh/tests/builtins/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/builtins/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -2,8 +2,12 @@
 
 .include <bsd.own.mk>
 
-FILESDIR=	${TESTSBASE}/bin/sh/builtins
-KYUAFILE=	no
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
+
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		alias.0 alias.0.stdout
 FILES+=		alias.1 alias.1.stderr

Modified: stable/10/bin/sh/tests/errors/Makefile
==============================================================================
--- stable/10/bin/sh/tests/errors/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/errors
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		assignment-error1.0
 FILES+=		assignment-error2.0

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp2.2
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp2.2	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp2.2	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,2 +1,2 @@
 # $FreeBSD$
-${}
+eval '${}'

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp2.2.stderr
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp2.2.stderr	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp2.2.stderr	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1 +1 @@
-./errors/bad-parm-exp2.2: ${}: Bad substitution
+eval: ${}: Bad substitution

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp3.2
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp3.2	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp3.2	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,2 +1,2 @@
 # $FreeBSD$
-${foo/}
+eval '${foo/}'

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp3.2.stderr
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp3.2.stderr	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp3.2.stderr	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1 +1 @@
-./errors/bad-parm-exp3.2: ${foo/}: Bad substitution
+eval: ${foo/}: Bad substitution

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp4.2
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp4.2	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp4.2	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,2 +1,2 @@
 # $FreeBSD$
-${foo:@abc}
+eval '${foo:@abc}'

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp4.2.stderr
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp4.2.stderr	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp4.2.stderr	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1 +1 @@
-./errors/bad-parm-exp4.2: ${foo:@...}: Bad substitution
+eval: ${foo:@...}: Bad substitution

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp5.2
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp5.2	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp5.2	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,2 +1,2 @@
 # $FreeBSD$
-${/}
+eval '${/}'

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp5.2.stderr
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp5.2.stderr	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp5.2.stderr	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1 +1 @@
-./errors/bad-parm-exp5.2: ${/}: Bad substitution
+eval: ${/}: Bad substitution

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp6.2
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp6.2	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp6.2	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,2 +1,2 @@
 # $FreeBSD$
-${#foo^}
+eval '${#foo^}'

Modified: stable/10/bin/sh/tests/errors/bad-parm-exp6.2.stderr
==============================================================================
--- stable/10/bin/sh/tests/errors/bad-parm-exp6.2.stderr	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/errors/bad-parm-exp6.2.stderr	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1 +1 @@
-./errors/bad-parm-exp6.2: ${foo...}: Bad substitution
+eval: ${foo...}: Bad substitution

Modified: stable/10/bin/sh/tests/execution/Makefile
==============================================================================
--- stable/10/bin/sh/tests/execution/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/execution/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/execution
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		bg1.0
 FILES+=		bg2.0

Modified: stable/10/bin/sh/tests/expansion/Makefile
==============================================================================
--- stable/10/bin/sh/tests/expansion/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/expansion/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/expansion
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		arith1.0
 FILES+=		arith2.0

Copied and modified: stable/10/bin/sh/tests/functional_test.sh (from r269902, head/bin/sh/tests/functional_test.sh)
==============================================================================
--- head/bin/sh/tests/functional_test.sh	Wed Aug 13 04:14:50 2014	(r269902, copy source)
+++ stable/10/bin/sh/tests/functional_test.sh	Tue Dec  1 18:27:38 2015	(r291604)
@@ -39,13 +39,7 @@ check()
 	local out_file="${SRCDIR}/${tc}.stdout"
 	[ -f "${out_file}" ] && out_flag="-o file:${out_file}"
 
-	# We need to copy the testcase scenario file because some of the
-	# testcases hardcode relative paths in the stderr/stdout.
-	#
-	# TODO: we might be able to generate this path at build time
-	cp ${SRCDIR}/${tc} .
-
-	atf_check -s exit:${tc##*.} ${err_flag} ${out_flag} ${SH} "./${tc}"
+	atf_check -s exit:${tc##*.} ${err_flag} ${out_flag} ${SH} "${SRCDIR}/${tc}"
 }
 
 add_testcase()

Modified: stable/10/bin/sh/tests/parameters/Makefile
==============================================================================
--- stable/10/bin/sh/tests/parameters/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/parameters/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/parameters
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		env1.0
 FILES+=		exitstatus1.0

Modified: stable/10/bin/sh/tests/parser/Makefile
==============================================================================
--- stable/10/bin/sh/tests/parser/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/parser/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/parser
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		alias1.0
 FILES+=		alias2.0

Modified: stable/10/bin/sh/tests/set-e/Makefile
==============================================================================
--- stable/10/bin/sh/tests/set-e/Makefile	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/bin/sh/tests/set-e/Makefile	Tue Dec  1 18:27:38 2015	(r291604)
@@ -1,9 +1,11 @@
 # $FreeBSD$
 
-.include <bsd.own.mk>
+TESTSDIR=	${TESTSBASE}/bin/sh/${.CURDIR:T}
 
-FILESDIR=	${TESTSBASE}/bin/sh/set-e
-KYUAFILE=	no
+.PATH: ${.CURDIR:H}
+ATF_TESTS_SH=	functional_test
+
+FILESDIR=	${TESTSDIR}
 
 FILES=		and1.0
 FILES+=		and2.1

Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/10/tools/build/mk/OptionalObsoleteFiles.inc	Tue Dec  1 18:21:25 2015	(r291603)
+++ stable/10/tools/build/mk/OptionalObsoleteFiles.inc	Tue Dec  1 18:27:38 2015	(r291604)
@@ -4468,6 +4468,7 @@ OLD_FILES+=usr/share/aclocal/atf-common.
 OLD_FILES+=usr/share/aclocal/atf-sh.m4
 OLD_DIRS+=usr/share/aclocal
 OLD_FILES+=usr/tests/bin/date/legacy_test
+OLD_FILES+=usr/tests/bin/sh/legacy_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c/test_helpers_test
 OLD_FILES+=usr/tests/lib/atf/test-programs/fork_test
 OLD_FILES+=usr/tests/lib/atf/libatf-c++/application_test



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512011827.tB1IRcHM044053>