diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-12-12 23:28:43 -0500 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2015-12-13 19:02:51 -0500 |
commit | 4082a0492160a4c2857de46fe5bc75d91fc306ed (patch) | |
tree | bd2b08e693778c83f7a2bac5f5a68476a7649cd4 /tests/testwrapper.sh | |
parent | ff622ae961a461aff3433ec8ac908e07d303484e (diff) |
tests: fixed paths to input files.
The current test wrapper works only when the inputs are specified using
relative paths. If they're specified with absolute paths, the driver
fails to detect the inputs because it always prepends the input dir name
which itself is a relative path:
$ cd tests
$ ./testwrapper.sh -d . -i $PWD/reject.txt -t ./reject_ver.table
<fails to open inputs>
This normally doesn't show up because people run `./configure` or, for
out of tree builds, `../configure`. But if you happen to run configure
with an absolute path, then automake tends to generate absolute paths
as well leading to test failures.
Fix all of this by dropping the implicit input directory prepending.
- INPUT_NAME is often a list of files, not just a single one
- the input directory is used to find the testname tables which are
usually generated, so it's impossible to use files from both source
and build directories
- most of the time, the full/correct path is already specified
Diffstat (limited to 'tests/testwrapper.sh')
-rwxr-xr-x | tests/testwrapper.sh | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/testwrapper.sh b/tests/testwrapper.sh index 30127b5..051e20b 100755 --- a/tests/testwrapper.sh +++ b/tests/testwrapper.sh @@ -30,10 +30,10 @@ while getopts :d:i:rt1 OPTION ; do TESTNAME="${!OPTIND}" -INPUT_NAME=${INPUT_NAME:-`basename $TESTNAME`.txt} +INPUT_NAME=${INPUT_NAME:-$INPUT_DIRECTORY/`basename $TESTNAME`.txt} if [ "$DO_COMPARISON" -eq "1" ] ; then - test `$TESTNAME 1 < $INPUT_DIRECTORY/$INPUT_NAME` -eq `$TESTNAME < $INPUT_DIRECTORY/$INPUT_NAME` + test `$TESTNAME 1 < $INPUT_NAME` -eq `$TESTNAME < $INPUT_NAME` exit $? fi @@ -42,11 +42,11 @@ if [ $INPUT_COUNT -gt 1 ] ; then exit $? fi -if [ -f ${INPUT_DIRECTORY}/${INPUT_NAME} ] ; then +if [ -f ${INPUT_NAME} ] ; then if [ $USE_REDIRECT == 1 ] ; then - $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_DIRECTORY/$INPUT_NAME + $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} < $INPUT_NAME else - $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} $INPUT_DIRECTORY/$INPUT_NAME + $TESTNAME ${USE_TABLES:+${INPUT_DIRECTORY}/${TESTNAME}.tables} $INPUT_NAME fi else $TESTNAME |