svn commit: r269884 - in head: tools/build/mk usr.bin/yacc/tests

Garrett Cooper ngie at FreeBSD.org
Tue Aug 12 18:10:31 UTC 2014


Author: ngie
Date: Tue Aug 12 17:51:26 2014
New Revision: 269884
URL: http://svnweb.freebsd.org/changeset/base/269884

Log:
  Complete the usr.bin/yacc kyua integration work I originally
  submitted via r268811
  
  - Install the Kyuafile by adding FILES to FILESGROUPS
  - Run the testcases with an unprivileged user
  
    Some of the testcases depend upon behavior that's broken when
    run as root on FreeBSD because of how permissions are treated
    with access(2) vs eaccess(2), open(2), etc
  
  - Simplify the test driver to just inspect the exit code from
    run_test because it now exits with 0 if successful and exits
    with !0 if unsuccessful
  - Don't do ad hoc temporary directory creation/deletion; let Kyua
    handle that
  - Add entries for files removed in r268811 to
    OptionalObsoleteFiles.inc
  
  PR: 191020
  X-MFC with: r268811
  Approved by: jmmv (mentor)
  Reviewed by: bapt
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.bin/yacc/tests/Makefile
  head/usr.bin/yacc/tests/yacc_tests.sh

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- head/tools/build/mk/OptionalObsoleteFiles.inc	Tue Aug 12 17:03:13 2014	(r269883)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc	Tue Aug 12 17:51:26 2014	(r269884)
@@ -4575,6 +4575,24 @@ OLD_DIRS+=usr/tests/usr.bin/make/archive
 OLD_DIRS+=usr/tests/usr.bin/make/archives/fmt_44bsd
 OLD_DIRS+=usr/tests/usr.bin/make/archives
 OLD_DIRS+=usr/tests/usr.bin/make
+OLD_FILES+=usr/tests/usr.bin/yacc/legacy_test
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.00.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.01.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.02.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.03.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.04.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.05.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.06.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.07.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.08.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.09.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.10.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.11.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.12.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.13.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.14.out
+OLD_FILES+=usr/tests/usr.bin/yacc/regress.sh
+OLD_FILES+=usr/tests/usr.bin/yacc/undefined.y
 .endif
 .else
 # ATF libraries.

Modified: head/usr.bin/yacc/tests/Makefile
==============================================================================
--- head/usr.bin/yacc/tests/Makefile	Tue Aug 12 17:03:13 2014	(r269883)
+++ head/usr.bin/yacc/tests/Makefile	Tue Aug 12 17:51:26 2014	(r269884)
@@ -9,11 +9,15 @@ TEST_DIR=	${.CURDIR}/../../../contrib/by
 TESTSDIR=	${TESTSBASE}/usr.bin/yacc
 
 PLAIN_TESTS_SH=	yacc_tests
+# NOTE: due to caveats with how permissions are handled on FreeBSD
+# with root, this must be run as a non-privileged user; otherwise
+# the testcases will fail unexpectedly.
+TEST_METADATA.yacc_tests+=	required_user="unprivileged"
 
 SCRIPTS=	run_test
 SCRIPTSDIR=	${TESTSDIR}
 
-FILESGROUPS=	FILEStest FILEStest_yacc
+FILESGROUPS=	FILES FILEStest FILEStest_yacc
 
 FILEStestDIR=	${TESTSDIR}
 
@@ -245,36 +249,30 @@ FILEStest_yacc+=	help.error
 FILEStest_yacc+=	help.output
 FILEStest_yacc+=	no_b_opt.error
 FILEStest_yacc+=	no_b_opt.output
-# XXX: expected: `f - cannot open "nosuchfile.c"; gets
-# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
-#FILEStest_yacc+=	no_b_opt1.error
-#FILEStest_yacc+=	no_b_opt1.output
-#FILEStest_yacc+=	no_code_c.error
-#FILEStest_yacc+=	no_code_c.output
-#FILEStest_yacc+=	no_defines.error
-#FILEStest_yacc+=	no_defines.output
-#FILEStest_yacc+=	no_graph.error
-#FILEStest_yacc+=	no_graph.output
-#FILEStest_yacc+=	no_include.error
-#FILEStest_yacc+=	no_include.output
+FILEStest_yacc+=	no_b_opt1.error
+FILEStest_yacc+=	no_b_opt1.output
+FILEStest_yacc+=	no_code_c.error
+FILEStest_yacc+=	no_code_c.output
+FILEStest_yacc+=	no_defines.error
+FILEStest_yacc+=	no_defines.output
+FILEStest_yacc+=	no_graph.error
+FILEStest_yacc+=	no_graph.output
+FILEStest_yacc+=	no_include.error
+FILEStest_yacc+=	no_include.output
 FILEStest_yacc+=	no_opts.error
 FILEStest_yacc+=	no_opts.output
-# XXX: expected: `f - cannot open "nosuchfile.c"; gets
-# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
-#FILEStest_yacc+=	no_output.error
-#FILEStest_yacc+=	no_output.output
-#FILEStest_yacc+=	no_output1.error
-#FILEStest_yacc+=	no_output1.output
+FILEStest_yacc+=	no_output.error
+FILEStest_yacc+=	no_output.output
+FILEStest_yacc+=	no_output1.error
+FILEStest_yacc+=	no_output1.output
 FILEStest_yacc+=	no_output2.error
 FILEStest_yacc+=	no_output2.output
 FILEStest_yacc+=	no_p_opt.error
 FILEStest_yacc+=	no_p_opt.output
-# XXX: expected: `f - cannot open "nosuchfile.c"; gets
-# `e - line 0 of "nosuchfile.y", unexpected end-of-file`.
-#FILEStest_yacc+=	no_p_opt1.error
-#FILEStest_yacc+=	no_p_opt1.output
-#FILEStest_yacc+=	no_verbose.error
-#FILEStest_yacc+=	no_verbose.output
+FILEStest_yacc+=	no_p_opt1.error
+FILEStest_yacc+=	no_p_opt1.output
+FILEStest_yacc+=	no_verbose.error
+FILEStest_yacc+=	no_verbose.output
 FILEStest_yacc+=	nostdin.error
 FILEStest_yacc+=	nostdin.output
 FILEStest_yacc+=	ok_syntax1.error

Modified: head/usr.bin/yacc/tests/yacc_tests.sh
==============================================================================
--- head/usr.bin/yacc/tests/yacc_tests.sh	Tue Aug 12 17:03:13 2014	(r269883)
+++ head/usr.bin/yacc/tests/yacc_tests.sh	Tue Aug 12 17:51:26 2014	(r269884)
@@ -3,22 +3,15 @@
 
 set -e
 
-cd $(dirname $0)
+# Setup the environment for run_test
+# - run_test looks for `#define YYBTYACC` in ../config.h
+# - run_test assumes a yacc binary exists in ../yacc instead of running "yacc"
+# - run_test spams the test dir with files (polluting subsequent test runs),
+#   so it's better to copy all the files to a temporary directory created by
+#   kyua
+echo > "./config.h"
+mkdir "test"
+cp -Rf "$(dirname "$0")"/* "test"
+cp -p /usr/bin/yacc ./yacc
 
-TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXX)
-TEST_DIR="$TMPDIR/test"
-trap "cd /; rm -Rf $TMPDIR" EXIT INT TERM
-
-# Setup the environment for run_test.sh
-mkdir -p "$TEST_DIR"
-cp -Rf * "$TEST_DIR/."
-echo > "$TMPDIR/config.h"
-ln /usr/bin/yacc $TMPDIR/yacc
-
-log=$TMPDIR/run_test.log
-(cd $TEST_DIR && ./run_test 2>&1 && : > run_test.ok) | tee $log
-if [ -f run_test.ok ] && ! egrep "^...(diff|not found)[^\*]+$" $log; then
-	exit 0
-else
-	exit 1
-fi
+cd "test" && ./run_test


More information about the svn-src-all mailing list