From 775dcc66689e18fe7c037b59a4b1b7394742a008 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 12 Dec 2015 23:39:33 -0500 Subject: sys-devel/flex: fix tests #567332 --- .../flex/files/flex-2.6.0-out-of-tree-build.patch | 16 ++++ .../flex/files/flex-2.6.0-out-of-tree-test.patch | 90 ++++++++++++++++++++++ sys-devel/flex/flex-2.6.0.ebuild | 5 ++ 3 files changed, 111 insertions(+) create mode 100644 sys-devel/flex/files/flex-2.6.0-out-of-tree-build.patch create mode 100644 sys-devel/flex/files/flex-2.6.0-out-of-tree-test.patch (limited to 'sys-devel/flex') diff --git a/sys-devel/flex/files/flex-2.6.0-out-of-tree-build.patch b/sys-devel/flex/files/flex-2.6.0-out-of-tree-build.patch new file mode 100644 index 000000000000..36c69f235f77 --- /dev/null +++ b/sys-devel/flex/files/flex-2.6.0-out-of-tree-build.patch @@ -0,0 +1,16 @@ +https://bugs.gentoo.org/567332 + +this is a snippet taken from the upstream commit: +09eae589d3954a1e1206aa01108ee75ef57776da Used in-tree header file for c++ tests. + +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -35,6 +35,8 @@ + # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE. + ++AM_CPPFLAGS = -I$(top_srcdir)/src ++ + VPATH = @srcdir@ + am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ diff --git a/sys-devel/flex/files/flex-2.6.0-out-of-tree-test.patch b/sys-devel/flex/files/flex-2.6.0-out-of-tree-test.patch new file mode 100644 index 000000000000..fafa085baf20 --- /dev/null +++ b/sys-devel/flex/files/flex-2.6.0-out-of-tree-test.patch @@ -0,0 +1,90 @@ +https://bugs.gentoo.org/567332 +https://github.com/westes/flex/pull/39 + +From e7761df66e8412093d0c1c25ce24e3a912076564 Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Sat, 12 Dec 2015 23:28:43 -0500 +Subject: [PATCH] tests: fix 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 + + +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. +In practice, it doesn't even make sense: +- 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 +--- + tests/Makefile.am | 4 ++-- + tests/testwrapper.sh | 10 +++++----- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index cc9c178..6d1d9fe 100644 +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -35,7 +35,7 @@ LOG_COMPILER = $(srcdir)/testwrapper.sh + LOG_COMPILER = $(srcdir)/testwrapper.sh + AM_LOG_FLAGS = -d $(srcdir) -r + REJECT_LOG_COMPILER = $(srcdir)/testwrapper.sh +-AM_REJECT_LOG_FLAGS = -d $(srcdir) -i reject.txt -r ++AM_REJECT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/reject.txt -r + TABLE_LOG_COMPILER = $(srcdir)/testwrapper.sh + AM_TABLE_LOG_FLAGS = -d $(builddir) -i $(srcdir)/reject.txt -t + DIRECT_LOG_COMPILER = $(srcdir)/testwrapper.sh +@@ -437,7 +437,7 @@ tableopts_tests := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sert + tableopts_tests := $(tableopts_opttests) $(tableopts_vertests) $(tableopts_sertests) + tableopts_c := $(addsuffix .c,$(tableopts_tests)) + OPT_LOG_COMPILER = $(srcdir)/testwrapper.sh +-AM_OPT_LOG_FLAGS = -d $(srcdir) -i tableopts.txt -r ++AM_OPT_LOG_FLAGS = -d $(srcdir) -i $(srcdir)/tableopts.txt -r + SER_LOG_COMPILER = $(srcdir)/testwrapper.sh + AM_SER_LOG_FLAGS = -d $(builddir) -i $(srcdir)/tableopts.txt -r -t + VER_LOG_COMPILER = $(srcdir)/testwrapper.sh +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 +-- +2.6.2 + diff --git a/sys-devel/flex/flex-2.6.0.ebuild b/sys-devel/flex/flex-2.6.0.ebuild index aa83cdcb0560..b603320301d1 100644 --- a/sys-devel/flex/flex-2.6.0.ebuild +++ b/sys-devel/flex/flex-2.6.0.ebuild @@ -22,6 +22,11 @@ DEPEND="${RDEPEND} nls? ( sys-devel/gettext ) test? ( sys-devel/bison )" +src_prepare() { + epatch "${FILESDIR}"/${P}-out-of-tree-build.patch #567332 + epatch "${FILESDIR}"/${P}-out-of-tree-test.patch #567332 +} + src_configure() { use static && append-ldflags -static -- cgit v1.2.3-18-g5258