aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/yacc/tests
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2014-08-12 17:51:26 +0000
committerEnji Cooper <ngie@FreeBSD.org>2014-08-12 17:51:26 +0000
commit6add31451a9aef3401a0cf612df351fa74c85e45 (patch)
tree45be2815682b4e1dcdd1b4e1c6f20ba583e6c5a6 /usr.bin/yacc/tests
parent2f9234fdfdc79fb11190493096ef21637f236a20 (diff)
downloadsrc-6add31451a9aef3401a0cf612df351fa74c85e45.tar.gz
src-6add31451a9aef3401a0cf612df351fa74c85e45.zip
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
Notes
Notes: svn path=/head/; revision=269884
Diffstat (limited to 'usr.bin/yacc/tests')
-rw-r--r--usr.bin/yacc/tests/Makefile48
-rwxr-xr-xusr.bin/yacc/tests/yacc_tests.sh29
2 files changed, 34 insertions, 43 deletions
diff --git a/usr.bin/yacc/tests/Makefile b/usr.bin/yacc/tests/Makefile
index 2dadf4e89bcf..c8125a6f39c3 100644
--- a/usr.bin/yacc/tests/Makefile
+++ b/usr.bin/yacc/tests/Makefile
@@ -9,11 +9,15 @@ TEST_DIR= ${.CURDIR}/../../../contrib/byacc/test
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
diff --git a/usr.bin/yacc/tests/yacc_tests.sh b/usr.bin/yacc/tests/yacc_tests.sh
index 9a2973a91c4d..6ad69161f876 100755
--- a/usr.bin/yacc/tests/yacc_tests.sh
+++ b/usr.bin/yacc/tests/yacc_tests.sh
@@ -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