libxslt test run outside of srcdir (possible patch)

Petr Sumbera <[email protected]> Fri, 12 Oct 2012 11:18:49 +0200
Newsgroups gmane.comp.gnome.lib.xslt
Message-ID <[email protected]>
Hi,

When I configure/build libxslt outside of sources and then run libxslt 
tests there are some false positives related to using absolute path 
instead of relative.

Please see attached patch which tries to fix it. Well, some of these are 
not very nice but finally I have clean test run... :-)

Any comments?

Thanks,

Petr

_______________________________________________
xslt mailing list, project page http://xmlsoft.org/XSLT/
[email protected]
https://mail.gnome.org/mailman/listinfo/xslt
srcdir-tests.patch (text/plain, 3.5 KB)
--- libxslt-1.1.27/tests/plugins/Makefile.am	Tue Sep  4 07:26:23 2012
+++ libxslt-1.1.27/tests/plugins/Makefile.am	Thu Oct 11 06:25:06 2012
@@ -29,8 +29,8 @@
 test tests: $(top_builddir)/xsltproc/xsltproc test-logall $(noinst_LTLIBRARIES)
 	@LD_LIBRARY_PATH=$(plugindir):$(top_builddir)/libxslt/.libs:$(LD_LIBRARY_PATH) \
 	 LIBXSLT_PLUGINS_PATH=$(plugindir) \
-	 $(top_builddir)/xsltproc/xsltproc plugin.xsl plugin.xml > plugin.res
-	@diff plugin.out plugin.res
+	 $(top_builddir)/xsltproc/xsltproc $(srcdir)/plugin.xsl $(srcdir)/plugin.xml > plugin.res
+	@diff $(srcdir)/plugin.out plugin.res
 	@rm plugin.res
 
 else
--- libxslt-1.1.27/tests/documents/Makefile.am	Tue Sep  4 07:26:23 2012
+++ libxslt-1.1.27/tests/documents/Makefile.am	Thu Oct 11 06:54:44 2012
@@ -27,6 +27,7 @@
 	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
 	rm -f result)
 	@($(CHECKER) $(top_builddir)/xsltproc/xsltproc $(srcdir)/test.xsl $(srcdir)/test_bad.xml > result 2>err ; \
+	sed 's|$(srcdir)/||' err > err.tmp; mv err.tmp err; \
 	diff $(srcdir)/test_bad.result result; \
 	diff $(srcdir)/test_bad.err err; \
 	grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
--- libxslt-1.1.27/tests/general/Makefile.am	Fri Sep  7 00:49:41 2012
+++ libxslt-1.1.27/tests/general/Makefile.am	Thu Oct 11 07:56:41 2012
@@ -210,7 +210,7 @@
 	  out=$(srcdir)/"$$name".out; \
 	  err=$(srcdir)/"$$name".err; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc $$j $$i \
-	  	> result.$$name 2>err.$$name; \
+	  	2>&1 > result.$$name | sed 's|$(srcdir)|.|' >err.$$name; \
 	  if [ ! -f $$out ] ; then \
 	  	cp result.$$name $$out ; \
 		if [ -s err.$$name ] ; then \
@@ -217,6 +217,10 @@
 			cp err.$$name $$err ; \
 		fi ; \
 	  else \
+		grep '../docs/' $$out >/dev/null && \
+		  sed 's|/docs|/general|' result.$$name | \
+		  sed 's|$(srcdir)|../docs|' > result.$$name.tmp && \
+		  mv result.$$name.tmp result.$$name; \
 	  	diff $$out result.$$name; \
 		if [ -s $$err ] ; then \
 	  		diff $$err err.$$name; \
@@ -242,7 +246,7 @@
 	  out=$(srcdir)/"$$name".out; \
 	  err=$(srcdir)/"$$name".err; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nodict $$j $$i \
-	  	> result.$$name 2>err.$$name; \
+	  	2>&1 > result.$$name | sed 's|$(srcdir)|.|' >err.$$name; \
 	  if [ ! -f $$out ] ; then \
 	  	cp result.$$name $$out ; \
 		if [ -s err.$$name ] ; then \
@@ -249,6 +253,10 @@
 			cp err.$$name $$err ; \
 		fi ; \
 	  else \
+		grep '../docs/' $$out >/dev/null && \
+		  sed 's|/docs|/general|' result.$$name | \
+		  sed 's|$(srcdir)|../docs|' > result.$$name.tmp && \
+		  mv result.$$name.tmp result.$$name; \
 	  	diff $$out result.$$name; \
 		if [ -s $$err ] ; then \
 	  		diff $$err err.$$name; \
--- libxslt-1.1.27/tests/REC/Makefile.am	Fri Sep  7 00:49:41 2012
+++ libxslt-1.1.27/tests/REC/Makefile.am	Thu Oct 11 08:04:48 2012
@@ -96,7 +96,7 @@
 	  fi ; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
 	  	$(srcdir)/$$name.xsl $(srcdir)/$$name.xml \
-	  	> $$name.res 2>$$name.bad ; \
+	  	2>&1 > $$name.res | sed 's|$(srcdir)|.|' >$$name.bad ; \
 	  if [ ! -f $(srcdir)/$$name.out ] ; then \
 	  	cp $$name.res $(srcdir)/$$name.out ; \
 		if [ -s $$name.bad ] ; then \
@@ -158,7 +158,7 @@
 	  fi ; \
 	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nodict \
 	  	$(srcdir)/$$name.xsl $(srcdir)/$$name.xml \
-	  	> $$name.res 2>$$name.bad ; \
+	  	2>&1 > $$name.res | sed 's|$(srcdir)|.|' >$$name.bad ; \
 	  if [ ! -f $(srcdir)/$$name.out ] ; then \
 	  	cp $$name.res $(srcdir)/$$name.out ; \
 		if [ -s $$name.bad ] ; then \