public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [build] Support multilib testing in libgo
@ 2011-04-04 18:19 Rainer Orth
  2011-04-10  7:46 ` Ralf Wildenhues
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2011-04-04 18:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Lance Taylor, Ralf Wildenhues

make check in libgo currently tests the default multilib only, among
others because automake has no support for multilib testing.  It would
have to be especially careful here since for a DejaGnu testsuite, this
is handled internally to dg, while for other testsuites, one needs to
run make check in all multilibs and eventually collect the results if
one wants to provide dg-style <tool>.sum and <tool>.log files.

The following patch provides this, and handles another problem at the
same time: the use of -Wl,-R in CHECK isn't portable (e.g. IRIX and
Tru64 UNIX use -rpath instead).  While one could use libtool for the
linking, this doesn't solve another related issue: on systems that don't
have libgcc_s.so.1 in the default search path of the runtime linker,
that file isn't found even if the correct -R equivalent were used to
link libgo.so.  What's worse, even before this patch, make
check-target-libgo from the toplevel works since the toplevel Makefile
sets LD_LIBRARY_PATH for the default libgcc_s.so.1 multilib, but doesn't
do this for non-default ones (cf. PR other/43445).  If running make
check inside libgo, LD_LIBRARY_PATH isn't set and the tests fail.

To avoid this mess, I'm instead setting LD_LIBRARY_PATH in CHECK.  While
this isn't exactly portable (some platforms, especially Darwin and
HP-UX, use different variables), it's at least more widespread than -R.

There's one related issue: the http/cgi test currently fails on Solaris:

ld.so.1: a.out: fatal: libgo.so.0: open failed: No such file or directory
--- FAIL: cgi.TestHostingOurselves (0.00 seconds)
	for key "env-SCRIPT_NAME" got ""; expected "/test.go"
	for key "env-SCRIPT_FILENAME" got ""; expected "./a.out"
	for key "env-REMOTE_ADDR" got ""; expected "1.2.3.4"
	for key "env-SERVER_NAME" got ""; expected "example.com"
	for key "env-REQUEST_URI" got ""; expected "/test.go?foo=bar&a=b"
	for key "env-REQUEST_METHOD" got ""; expected "GET"
	for key "env-REMOTE_HOST" got ""; expected "1.2.3.4"
	for key "param-a" got ""; expected "b"
	for key "test" got ""; expected "Hello CGI-in-CGI"
	for key "env-SERVER_PORT" got ""; expected "80"
	for key "env-QUERY_STRING" got ""; expected "foo=bar&a=b"
	for key "param-foo" got ""; expected "bar"
	for key "env-HTTP_HOST" got ""; expected "example.com"
	for key "env-SERVER_SOFTWARE" got ""; expected "go"
	for key "env-GATEWAY_INTERFACE" got ""; expected "CGI/1.1"
	got a Content-Type of ""; expected "text/html; charset=utf-8"
	got a X-Test-Header of ""; expected "X-Test-Value"
FAIL
FAIL: http/cgi

cgi.TestHostingOurselves is the only failing subtest here.  As one can
see with truss -e, the rest of the environment is cleared:

28130:  execve("a.out", 0xDE20ED80, 0xDE21AA80)  argc = 2
28130:   argv: ./a.out -test.run=TestBeChildCGIProcess
28130:   envp: SERVER_SOFTWARE=go SERVER_NAME=example.com
28130:    HTTP_HOST=example.com GATEWAY_INTERFACE=CGI/1.1
28130:    REQUEST_METHOD=GET QUERY_STRING=foo=bar&a=b
28130:    REQUEST_URI=/test.go?foo=bar&a=b PATH_INFO=
28130:    SCRIPT_NAME=/test.go SCRIPT_FILENAME=./a.out
28130:    REMOTE_ADDR=1.2.3.4 REMOTE_HOST=1.2.3.4 SERVER_PORT=80

so LD_LIBRARY_PATH is lost.

Apart from running make check-am in the default and non-default multilib
dirs and collecting/summarizing the results afterwards, this patch
changes the capitalization of Summary in the === libgo Summary.* ===
lines to make mail-report.log properly handles them.

I now ignore the exit code from $(MAKE) -k $(TEST_PACKAGES) in check-am;
otherwise once a multilib test fails the check-tail target isn't run
anymore.

Tested with a Go-only bootstrap on i386-pc-solaris2.10 after
incorporating the latest changes, and a full bootstrap on
i386-pc-solaris2.11.

	Rainer


2011-02-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.am (CHECK): Add GOCFLAGS to $GC.
	Remove -Wl,-R from $GC.
	Add LD_LIBRARY_PATH.
	(check): Depend on check-multi, check-tail.
	(check-recursive): Depend on check-head.
	(check-am): Move header, footer generation ...
	(check-head, check-tail): ... here.
	New targets.
	(check-multi): New target.
	(MOSTLYCLEAN_FILES): Replace libgo.tail by libgo.head, add
	libgo.sum.sep, libgo.log.sep.
	* Makefile.in: Regenerate.

diff --git a/libgo/Makefile.am b/libgo/Makefile.am
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1547,12 +1547,15 @@ GOTESTFLAGS =
 
 # Check a package.
 CHECK = \
-	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs -Wl,-R,`${PWD_COMMAND}`/.libs"; \
+	GC="$(GOC) $(GOCFLAGS) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
 	MAKE="$(MAKE)"; \
 	export MAKE; \
+	libgcc=`${GOC} ${GOCFLAGS} -print-libgcc-file-name`; \
+	LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:`dirname $${libgcc}`:${LD_LIBRARY_PATH}"; \
+	export LD_LIBRARY_PATH; \
 	rm -f $@-testsum $@-testlog; \
 	prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
 	test "$${prefix}" != "." || prefix="$(@D)"; \
@@ -3067,27 +3070,82 @@ TEST_PACKAGES = \
 	testing/quick/check \
 	testing/script/check
 
+check: check-tail
+check-recursive: check-head
+
+check-head:
+	@echo "Test Run By $${USER} on `date`" > libgo.head
+	@echo "Native configuration is $(host_triplet)" >> libgo.head
+	@echo >> libgo.head
+	@echo "		=== libgo tests ===" >> libgo.head
+	@echo >> libgo.head
+
+check-tail: check-recursive check-multi
+	@lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
+	for dir in . $(MULTIDIRS); do \
+	  mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
+	  mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
+	done; \
+	mv libgo.head libgo.sum; \
+	cp libgo.sum libgo.log; \
+	echo "Schedule of variations:" >> libgo.sum; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "    $${multivar}" >> libgo.sum; \
+	done; \
+	echo >> libgo.sum; \
+	pass=0; fail=0; untested=0; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "Running target $${multivar}" >> libgo.sum; \
+	  echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
+	  cat $${multidir}/libgo.sum.sep >> libgo.sum; \
+	  cat $${multidir}/libgo.log.sep >> libgo.log; \
+	  echo "		=== libgo Summary for $${multivar} ===" >> libgo.sum; \
+	  echo >> libgo.sum; \
+	  p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
+	  if test "$$p" != "0"; then \
+	    echo "# of expected passes		$$p" >> libgo.sum; \
+	  fi; \
+	  pass=`expr $$pass + $$p`; \
+	  p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
+	  if test "$$p" != "0"; then \
+	    echo "# of unexpected failures	$$p" >> libgo.sum; \
+	  fi; \
+	  fail=`expr $$fail + $$p`; \
+	  p=`grep -c UNTESTED libgo.sum`; \
+	  if test "$$p" != "0"; then \
+	    echo "# of untested testcases	$$p" >> libgo.tail; \
+	  fi; \
+	  untested=`expr $$untested + $$p`; \
+	done; \
+	echo >> libgo.sum; \
+	echo "		=== libgo Summary  ===" >> libgo.sum; \
+	echo >> libgo.sum; \
+	if test "$$pass" != "0"; then \
+	  echo "# of expected passes		$$pass" >> libgo.sum; \
+	fi; \
+	if test "$$fail" != "0"; then \
+	  echo "# of unexpected failures	$$fail" >> libgo.sum; \
+	fi; \
+	if test "$$untested" != "0"; then \
+	  echo "# of untested testcases		$$untested" >> libgo.sum; \
+	fi; \
+	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
+	echo >> libgo.log; \
+	echo "runtest completed at `date`" >> libgo.log
+
 check-am:
 	@rm -f libgo.sum libgo.log libgo.tail
-	@echo "Test Run By $${USER} on `date`" > libgo.sum
-	@echo "Native configuration is $(host_triplet)" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "		=== libgo tests ===" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Schedule of variations:" >> libgo.sum
-	@echo "    unix" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Running target unix" >> libgo.sum
-	@echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum
-	@cp libgo.sum libgo.log
-	@echo > libgo.tail
-	@echo "		=== libgo summary ===" >> libgo.tail
-	@echo >> libgo.tail
+	@multivar="unix"; \
+	[ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
+	echo "$${multivar}" > libgo.var
 	@for f in $(TEST_PACKAGES); do \
 	   rm -f $$f-testsum $$f-testlog; \
 	 done
-	@$(MAKE) -k $(TEST_PACKAGES); \
-	status=$$?; \
+	-@$(MAKE) -k $(TEST_PACKAGES)
 	for f in $(TEST_PACKAGES); do \
 	  if test -f $$f-testsum; then \
 	    cat $$f-testsum >> libgo.sum; \
@@ -3095,27 +3153,12 @@ check-am:
 	  if test -f $$f-testlog; then \
 	    cat $$f-testlog >> libgo.log; \
 	  fi; \
-	done; \
-	p=`grep -c PASS libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of expected passes		$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c FAIL libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of unexpected failures	$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c UNTESTED libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of untested testcases		$$p" >> libgo.tail; \
-	fi; \
-	cat libgo.tail >> libgo.sum; \
-	cat libgo.tail >> libgo.log; \
-	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
-	echo >> libgo.log; \
-	echo "runtest completed at `date`" >> libgo.log; \
-	exit $$status
-
-MOSTLYCLEAN_FILES = libgo.tail
+	done
+
+check-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
+
+MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
 
 mostlyclean-local:
 	find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [build] Support multilib testing in libgo
  2011-04-04 18:19 [build] Support multilib testing in libgo Rainer Orth
@ 2011-04-10  7:46 ` Ralf Wildenhues
  2011-04-19 18:19   ` Rainer Orth
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Wildenhues @ 2011-04-10  7:46 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Ian Lance Taylor

* Rainer Orth wrote on Mon, Apr 04, 2011 at 08:19:19PM CEST:
> To avoid this mess, I'm instead setting LD_LIBRARY_PATH in CHECK.  While
> this isn't exactly portable (some platforms, especially Darwin and
> HP-UX, use different variables), it's at least more widespread than -R.

Toplevel configure computes RPATH_ENVVAR for the host, and toplevel
Makefile passes that.  If you need it for the target, it should be
easy to repeat those five lines of code somewhere.

> +check-tail: check-recursive check-multi
> +	@lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
> +	for dir in . $(MULTIDIRS); do \
> +	  mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
> +	  mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
> +	done; \
> +	mv libgo.head libgo.sum; \
> +	cp libgo.sum libgo.log; \
> +	echo "Schedule of variations:" >> libgo.sum; \
> +	for dir in . $(MULTIDIRS); do \
> +	  multidir=../$${dir}/$${lib}; \
> +	  multivar=`cat $${multidir}/libgo.var`; \
> +	  echo "    $${multivar}" >> libgo.sum; \
> +	done; \
> +	echo >> libgo.sum; \
> +	pass=0; fail=0; untested=0; \
> +	for dir in . $(MULTIDIRS); do \
> +	  multidir=../$${dir}/$${lib}; \
> +	  multivar=`cat $${multidir}/libgo.var`; \
> +	  echo "Running target $${multivar}" >> libgo.sum; \
> +	  echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
> +	  cat $${multidir}/libgo.sum.sep >> libgo.sum; \
> +	  cat $${multidir}/libgo.log.sep >> libgo.log; \
> +	  echo "		=== libgo Summary for $${multivar} ===" >> libgo.sum; \
> +	  echo >> libgo.sum; \
> +	  p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
> +	  if test "$$p" != "0"; then \

I'd use -ne instead of != here and below.

> +	    echo "# of expected passes		$$p" >> libgo.sum; \
> +	  fi; \
> +	  pass=`expr $$pass + $$p`; \
> +	  p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
> +	  if test "$$p" != "0"; then \
> +	    echo "# of unexpected failures	$$p" >> libgo.sum; \
> +	  fi; \
> +	  fail=`expr $$fail + $$p`; \
> +	  p=`grep -c UNTESTED libgo.sum`; \
> +	  if test "$$p" != "0"; then \
> +	    echo "# of untested testcases	$$p" >> libgo.tail; \
> +	  fi; \
> +	  untested=`expr $$untested + $$p`; \
> +	done; \
> +	echo >> libgo.sum; \
> +	echo "		=== libgo Summary  ===" >> libgo.sum; \
> +	echo >> libgo.sum; \
> +	if test "$$pass" != "0"; then \
> +	  echo "# of expected passes		$$pass" >> libgo.sum; \
> +	fi; \
> +	if test "$$fail" != "0"; then \
> +	  echo "# of unexpected failures	$$fail" >> libgo.sum; \
> +	fi; \
> +	if test "$$untested" != "0"; then \
> +	  echo "# of untested testcases		$$untested" >> libgo.sum; \
> +	fi; \
> +	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \

This line:
        echo `echo $(GOC) | sed -e 's/ .*//'` ...

is equivalent to:
        echo $(GOC) ...

as the shell squashes unquoted multiple adjacent white space.

> +	echo >> libgo.log; \
> +	echo "runtest completed at `date`" >> libgo.log
> +
>  check-am:
>  	@rm -f libgo.sum libgo.log libgo.tail
> -	@echo "Test Run By $${USER} on `date`" > libgo.sum
> -	@echo "Native configuration is $(host_triplet)" >> libgo.sum
> -	@echo >> libgo.sum
> -	@echo "		=== libgo tests ===" >> libgo.sum
> -	@echo >> libgo.sum
> -	@echo "Schedule of variations:" >> libgo.sum
> -	@echo "    unix" >> libgo.sum
> -	@echo >> libgo.sum
> -	@echo "Running target unix" >> libgo.sum
> -	@echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum
> -	@cp libgo.sum libgo.log
> -	@echo > libgo.tail
> -	@echo "		=== libgo summary ===" >> libgo.tail
> -	@echo >> libgo.tail
> +	@multivar="unix"; \
> +	[ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
> +	echo "$${multivar}" > libgo.var
>  	@for f in $(TEST_PACKAGES); do \
>  	   rm -f $$f-testsum $$f-testlog; \
>  	 done
> -	@$(MAKE) -k $(TEST_PACKAGES); \
> -	status=$$?; \
> +	-@$(MAKE) -k $(TEST_PACKAGES)
>  	for f in $(TEST_PACKAGES); do \
>  	  if test -f $$f-testsum; then \
>  	    cat $$f-testsum >> libgo.sum; \
> @@ -3095,27 +3153,12 @@ check-am:
>  	  if test -f $$f-testlog; then \
>  	    cat $$f-testlog >> libgo.log; \
>  	  fi; \
> -	done; \
> -	p=`grep -c PASS libgo.sum`; \
> -	if test "$$p" != "0"; then \
> -	  echo "# of expected passes		$$p" >> libgo.tail; \
> -	fi; \
> -	p=`grep -c FAIL libgo.sum`; \
> -	if test "$$p" != "0"; then \
> -	  echo "# of unexpected failures	$$p" >> libgo.tail; \
> -	fi; \
> -	p=`grep -c UNTESTED libgo.sum`; \
> -	if test "$$p" != "0"; then \
> -	  echo "# of untested testcases		$$p" >> libgo.tail; \
> -	fi; \
> -	cat libgo.tail >> libgo.sum; \
> -	cat libgo.tail >> libgo.log; \
> -	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
> -	echo >> libgo.log; \
> -	echo "runtest completed at `date`" >> libgo.log; \
> -	exit $$status
> -
> -MOSTLYCLEAN_FILES = libgo.tail
> +	done
> +
> +check-multi:
> +	$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
> +
> +MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
>  
>  mostlyclean-local:
>  	find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f

Cheers,
Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [build] Support multilib testing in libgo
  2011-04-10  7:46 ` Ralf Wildenhues
@ 2011-04-19 18:19   ` Rainer Orth
  2011-04-22 19:06     ` Ian Lance Taylor
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2011-04-19 18:19 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: gcc-patches, Ian Lance Taylor

Hi Ralf,

> * Rainer Orth wrote on Mon, Apr 04, 2011 at 08:19:19PM CEST:
>> To avoid this mess, I'm instead setting LD_LIBRARY_PATH in CHECK.  While
>> this isn't exactly portable (some platforms, especially Darwin and
>> HP-UX, use different variables), it's at least more widespread than -R.
>
> Toplevel configure computes RPATH_ENVVAR for the host, and toplevel
> Makefile passes that.  If you need it for the target, it should be
> easy to repeat those five lines of code somewhere.

probably, though this is going to be a mess since you have to do it for
all possible multilib variants, cf. gcc/testsuite/lib/target-libpath.exp
and PR other/43445.

>> +	  p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
>> +	  if test "$$p" != "0"; then \
>
> I'd use -ne instead of != here and below.

Ok.  The != test was there before, but I've updated my patch.

>> +	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
>
> This line:
>         echo `echo $(GOC) | sed -e 's/ .*//'` ...
>
> is equivalent to:
>         echo $(GOC) ...
>
> as the shell squashes unquoted multiple adjacent white space.

Unfortunately, it's not: GOC contains not only the compiler command, but
a whole bunch of -B etc. options that need to be stripped.  OTOH, one
might argue that the version info only belongs with the compiler tests
in gcc/testsuite.  So for, none of the runtime libraries emit version
info in they .sum files, and many won't even have a separate version.

That said, I noticed another problem with the patch: for non-multilibbed
targets, it produced two separate summary lines, which is wrong and
doesn't match what DejaGnu does.

Here's the updated patch.  It also omits $GOCFLAGS because I noticed
that it is both unnecessary (the multilib flags that prompted me to
include it are already included in $GOC) and harmful: a couple of
testcases start failing when they are compiled with -g -O2 instead of
without optimization, cf. e.g. PR go/48122.

	Rainer


2011-02-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.am (CHECK): Remove -Wl,-R from $GC.
	Add LD_LIBRARY_PATH.
	(check): Depend on check-multi, check-tail.
	(check-recursive): Depend on check-head.
	(check-am): Move header, footer generation ...
	(check-head, check-tail): ... here.
	New targets.
	(check-multi): New target.
	(MOSTLYCLEAN_FILES): Replace libgo.tail by libgo.head, add
	libgo.sum.sep, libgo.log.sep.
	* Makefile.in: Regenerate.

diff --git a/libgo/Makefile.am b/libgo/Makefile.am
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1544,12 +1544,15 @@ GOTESTFLAGS =
 
 # Check a package.
 CHECK = \
-	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs -Wl,-R,`${PWD_COMMAND}`/.libs"; \
+	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
 	MAKE="$(MAKE)"; \
 	export MAKE; \
+	libgcc=`${GOC} -print-libgcc-file-name`; \
+	LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:`dirname $${libgcc}`:${LD_LIBRARY_PATH}"; \
+	export LD_LIBRARY_PATH; \
 	rm -f $@-testsum $@-testlog; \
 	prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
 	test "$${prefix}" != "." || prefix="$(@D)"; \
@@ -3065,27 +3068,84 @@ TEST_PACKAGES = \
 	testing/quick/check \
 	testing/script/check
 
+check: check-tail
+check-recursive: check-head
+
+check-head:
+	@echo "Test Run By $${USER} on `date`" > libgo.head
+	@echo "Native configuration is $(host_triplet)" >> libgo.head
+	@echo >> libgo.head
+	@echo "		=== libgo tests ===" >> libgo.head
+	@echo >> libgo.head
+
+check-tail: check-recursive check-multi
+	@lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
+	for dir in . $(MULTIDIRS); do \
+	  mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
+	  mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
+	done; \
+	mv libgo.head libgo.sum; \
+	cp libgo.sum libgo.log; \
+	echo "Schedule of variations:" >> libgo.sum; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "    $${multivar}" >> libgo.sum; \
+	done; \
+	echo >> libgo.sum; \
+	pass=0; fail=0; untested=0; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "Running target $${multivar}" >> libgo.sum; \
+	  echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
+	  cat $${multidir}/libgo.sum.sep >> libgo.sum; \
+	  cat $${multidir}/libgo.log.sep >> libgo.log; \
+	  if test -n "${MULTIDIRS}"; then \
+	    echo "		=== libgo Summary for $${multivar} ===" >> libgo.sum; \
+	    echo >> libgo.sum; \
+	  fi; \
+	  p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
+	  pass=`expr $$pass + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of expected passes		$$p" >> libgo.sum; \
+	  fi; \
+	  p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
+	  fail=`expr $$fail + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of unexpected failures	$$p" >> libgo.sum; \
+	  fi; \
+	  p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
+	  untested=`expr $$untested + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of untested testcases		$$p" >> libgo.sum; \
+	  fi; \
+	done; \
+	echo >> libgo.sum; \
+	echo "		=== libgo Summary ===" >> libgo.sum; \
+	echo >> libgo.sum; \
+	if test "$$pass" -ne "0"; then \
+	  echo "# of expected passes		$$pass" >> libgo.sum; \
+	fi; \
+	if test "$$fail" -ne "0"; then \
+	  echo "# of unexpected failures	$$fail" >> libgo.sum; \
+	fi; \
+	if test "$$untested" -ne "0"; then \
+	  echo "# of untested testcases		$$untested" >> libgo.sum; \
+	fi; \
+	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
+	echo >> libgo.log; \
+	echo "runtest completed at `date`" >> libgo.log
+
 check-am:
 	@rm -f libgo.sum libgo.log libgo.tail
-	@echo "Test Run By $${USER} on `date`" > libgo.sum
-	@echo "Native configuration is $(host_triplet)" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "		=== libgo tests ===" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Schedule of variations:" >> libgo.sum
-	@echo "    unix" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Running target unix" >> libgo.sum
-	@echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum
-	@cp libgo.sum libgo.log
-	@echo > libgo.tail
-	@echo "		=== libgo summary ===" >> libgo.tail
-	@echo >> libgo.tail
+	@multivar="unix"; \
+	[ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
+	echo "$${multivar}" > libgo.var
 	@for f in $(TEST_PACKAGES); do \
 	   rm -f $$f-testsum $$f-testlog; \
 	 done
-	@$(MAKE) -k $(TEST_PACKAGES); \
-	status=$$?; \
+	-@$(MAKE) -k $(TEST_PACKAGES)
 	for f in $(TEST_PACKAGES); do \
 	  if test -f $$f-testsum; then \
 	    cat $$f-testsum >> libgo.sum; \
@@ -3093,27 +3153,12 @@ check-am:
 	  if test -f $$f-testlog; then \
 	    cat $$f-testlog >> libgo.log; \
 	  fi; \
-	done; \
-	p=`grep -c PASS libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of expected passes		$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c FAIL libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of unexpected failures	$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c UNTESTED libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of untested testcases		$$p" >> libgo.tail; \
-	fi; \
-	cat libgo.tail >> libgo.sum; \
-	cat libgo.tail >> libgo.log; \
-	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
-	echo >> libgo.log; \
-	echo "runtest completed at `date`" >> libgo.log; \
-	exit $$status
-
-MOSTLYCLEAN_FILES = libgo.tail
+	done
+
+check-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
+
+MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
 
 mostlyclean-local:
 	find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [build] Support multilib testing in libgo
  2011-04-19 18:19   ` Rainer Orth
@ 2011-04-22 19:06     ` Ian Lance Taylor
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Lance Taylor @ 2011-04-22 19:06 UTC (permalink / raw)
  To: Rainer Orth; +Cc: Ralf Wildenhues, gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 669 bytes --]

Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> 2011-02-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>
> 	* Makefile.am (CHECK): Remove -Wl,-R from $GC.
> 	Add LD_LIBRARY_PATH.
> 	(check): Depend on check-multi, check-tail.
> 	(check-recursive): Depend on check-head.
> 	(check-am): Move header, footer generation ...
> 	(check-head, check-tail): ... here.
> 	New targets.
> 	(check-multi): New target.
> 	(MOSTLYCLEAN_FILES): Replace libgo.tail by libgo.head, add
> 	libgo.sum.sep, libgo.log.sep.
> 	* Makefile.in: Regenerate.

Thanks a lot for writing this.  I tweaked it a bit, and committed it as
follows.  Let me know if my tweaks caused any problem.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 5763 bytes --]

diff -r fd5c88df5eb8 libgo/Makefile.am
--- a/libgo/Makefile.am	Fri Apr 22 11:14:30 2011 -0700
+++ b/libgo/Makefile.am	Fri Apr 22 11:25:39 2011 -0700
@@ -1544,12 +1544,16 @@
 
 # Check a package.
 CHECK = \
-	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs -Wl,-R,`${PWD_COMMAND}`/.libs"; \
+	GC="$(GOC) -L `${PWD_COMMAND}` -L `${PWD_COMMAND}`/.libs"; \
 	export GC; \
 	RUNTESTFLAGS="$(RUNTESTFLAGS)"; \
 	export RUNTESTFLAGS; \
 	MAKE="$(MAKE)"; \
 	export MAKE; \
+	libgccdir=`${GOC} -print-libgcc-file-name | sed -e 's|/[^/]*$$||'`; \
+	LD_LIBRARY_PATH="`${PWD_COMMAND}`/.libs:$${libgccdir}:${LD_LIBRARY_PATH}"; \
+	LD_LIBRARY_PATH=`echo $${LD_LIBRARY_PATH} | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; \
+	export LD_LIBRARY_PATH; \
 	rm -f $@-testsum $@-testlog; \
 	prefix=`if test "$(@D)" = "regexp"; then echo regexp-test; else dirname $(@D); fi`; \
 	test "$${prefix}" != "." || prefix="$(@D)"; \
@@ -3065,55 +3069,103 @@
 	testing/quick/check \
 	testing/script/check
 
+check: check-tail
+check-recursive: check-head
+
+check-head:
+	@echo "Test Run By $${USER} on `date`" > libgo.head
+	@echo "Native configuration is $(host_triplet)" >> libgo.head
+	@echo >> libgo.head
+	@echo "		=== libgo tests ===" >> libgo.head
+	@echo >> libgo.head
+
+check-tail: check-recursive check-multi
+	@lib=`${PWD_COMMAND} | sed -e 's,^.*/\([^/][^/]*\)$$,\1,'`; \
+	for dir in . $(MULTIDIRS); do \
+	  mv ../$${dir}/$${lib}/libgo.sum ../$${dir}/$${lib}/libgo.sum.sep; \
+	  mv ../$${dir}/$${lib}/libgo.log ../$${dir}/$${lib}/libgo.log.sep; \
+	done; \
+	mv libgo.head libgo.sum; \
+	cp libgo.sum libgo.log; \
+	echo "Schedule of variations:" >> libgo.sum; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "    $${multivar}" >> libgo.sum; \
+	done; \
+	echo >> libgo.sum; \
+	pass=0; fail=0; untested=0; \
+	for dir in . $(MULTIDIRS); do \
+	  multidir=../$${dir}/$${lib}; \
+	  multivar=`cat $${multidir}/libgo.var`; \
+	  echo "Running target $${multivar}" >> libgo.sum; \
+	  echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum; \
+	  cat $${multidir}/libgo.sum.sep >> libgo.sum; \
+	  cat $${multidir}/libgo.log.sep >> libgo.log; \
+	  if test -n "${MULTIDIRS}"; then \
+	    echo "		=== libgo Summary for $${multivar} ===" >> libgo.sum; \
+	    echo >> libgo.sum; \
+	  fi; \
+	  p=`grep -c PASS $${multidir}/libgo.sum.sep`; \
+	  pass=`expr $$pass + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of expected passes		$$p" >> libgo.sum; \
+	  fi; \
+	  p=`grep -c FAIL $${multidir}/libgo.sum.sep`; \
+	  fail=`expr $$fail + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of unexpected failures	$$p" >> libgo.sum; \
+	  fi; \
+	  p=`grep -c UNTESTED $${multidir}/libgo.sum.sep`; \
+	  untested=`expr $$untested + $$p`; \
+	  if test "$$p" -ne "0" && test -n "${MULTIDIRS}"; then \
+	    echo "# of untested testcases		$$p" >> libgo.sum; \
+	  fi; \
+	done; \
+	echo >> libgo.sum; \
+	echo "		=== libgo Summary ===" >> libgo.sum; \
+	echo >> libgo.sum; \
+	if test "$$pass" -ne "0"; then \
+	  echo "# of expected passes		$$pass" >> libgo.sum; \
+	fi; \
+	if test "$$fail" -ne "0"; then \
+	  echo "# of unexpected failures	$$fail" >> libgo.sum; \
+	fi; \
+	if test "$$untested" -ne "0"; then \
+	  echo "# of untested testcases		$$untested" >> libgo.sum; \
+	fi; \
+	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
+	echo >> libgo.log; \
+	echo "runtest completed at `date`" >> libgo.log; \
+	if test "$$fail" -ne "0"; then \
+	  status=1; \
+	else \
+	  status=0; \
+	fi; \
+	exit $$status
+
 check-am:
 	@rm -f libgo.sum libgo.log libgo.tail
-	@echo "Test Run By $${USER} on `date`" > libgo.sum
-	@echo "Native configuration is $(host_triplet)" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "		=== libgo tests ===" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Schedule of variations:" >> libgo.sum
-	@echo "    unix" >> libgo.sum
-	@echo >> libgo.sum
-	@echo "Running target unix" >> libgo.sum
-	@echo "Running $(srcdir)/libgo.exp ..." >> libgo.sum
-	@cp libgo.sum libgo.log
-	@echo > libgo.tail
-	@echo "		=== libgo summary ===" >> libgo.tail
-	@echo >> libgo.tail
+	@multivar="unix"; \
+	[ -z "$(MULTIFLAGS)" ] || multivar="$${multivar}/$(MULTIFLAGS)"; \
+	echo "$${multivar}" > libgo.var
 	@for f in $(TEST_PACKAGES); do \
 	   rm -f $$f-testsum $$f-testlog; \
 	 done
-	@$(MAKE) -k $(TEST_PACKAGES); \
-	status=$$?; \
-	for f in $(TEST_PACKAGES); do \
+	-@$(MAKE) -k $(TEST_PACKAGES)
+	@for f in $(TEST_PACKAGES); do \
 	  if test -f $$f-testsum; then \
 	    cat $$f-testsum >> libgo.sum; \
 	  fi; \
 	  if test -f $$f-testlog; then \
 	    cat $$f-testlog >> libgo.log; \
 	  fi; \
-	done; \
-	p=`grep -c PASS libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of expected passes		$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c FAIL libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of unexpected failures	$$p" >> libgo.tail; \
-	fi; \
-	p=`grep -c UNTESTED libgo.sum`; \
-	if test "$$p" != "0"; then \
-	  echo "# of untested testcases		$$p" >> libgo.tail; \
-	fi; \
-	cat libgo.tail >> libgo.sum; \
-	cat libgo.tail >> libgo.log; \
-	echo `echo $(GOC) | sed -e 's/ .*//'`  `$(GOC) -v 2>&1 | grep " version" | sed -n -e 's/.* \(version.*$$\)/\1/p'` >> libgo.sum; \
-	echo >> libgo.log; \
-	echo "runtest completed at `date`" >> libgo.log; \
-	exit $$status
-
-MOSTLYCLEAN_FILES = libgo.tail
+	done
+
+check-multi:
+	$(MULTIDO) $(AM_MAKEFLAGS) DO=check-am multi-do # $(MAKE)
+
+MOSTLYCLEAN_FILES = libgo.head libgo.sum.sep libgo.log.sep
 
 mostlyclean-local:
 	find . -name '*.lo' -print | xargs $(LIBTOOL) --mode=clean rm -f

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-22 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-04 18:19 [build] Support multilib testing in libgo Rainer Orth
2011-04-10  7:46 ` Ralf Wildenhues
2011-04-19 18:19   ` Rainer Orth
2011-04-22 19:06     ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).