public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* [patch] libffi testsuite standalone vs. gcc
@ 2009-06-08 19:36 Andreas Tobler
  2009-06-08 19:51 ` Ralf Wildenhues
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Tobler @ 2009-06-08 19:36 UTC (permalink / raw)
  To: libffi-discuss, GCC Patches

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

Hi,

this is a try to keep the differences between the gcc-libffi testsuite 
and the libffi-standalone minimal.

Tested in both environments.

Thoughts?

Andreas

P.S, the diff is against gcc svn 148292.

2009-06-08  Andreas Tobler  <a.tobler@schweiz.org>

	* configure.ac: Introduce a STANDALONE variable to be able to run the
	testsuite accordingly.
	* configure: Regenerate.
	* testsuite/Makefile.am (AM_RUNTESTFLAGS): Pass the STANDALONE variable
	to the testsuite.
	* Makefile.in: Regenerate.
	* include/Makefile.in: Likewise.
	* testsuite/Makefile.in: Likewise.
	* testsuite/lib/libffi-dg.exp (load_gcc_lib): Use the STANDALONE
	variable.
	(libffi-init): Likewise.

[-- Attachment #2: standalone_libffi_tests.diff --]
[-- Type: text/plain, Size: 3122 bytes --]

Index: configure.ac
===================================================================
--- configure.ac	(revision 148292)
+++ configure.ac	(working copy)
@@ -39,6 +39,13 @@
 dnl The -no-testsuite modules omit the test subdir.
 AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
 
+# Merge attention!
+# If we build libffi standalone, set STANDALONE to "yes", if we build it inside
+# gcc set it to "no". This variable is needed for the testsuite.
+
+STANDALONE="no"
+AC_SUBST(STANDALONE)
+
 TARGETDIR="unknown"
 case "$host" in
   alpha*-*-*)
Index: testsuite/Makefile.am
===================================================================
--- testsuite/Makefile.am	(revision 148292)
+++ testsuite/Makefile.am	(working copy)
@@ -7,10 +7,10 @@
             echo $(top_builddir)/../expect/expect ; \
           else echo expect ; fi`
 
-RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
+RUNTEST = "`if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
 	       echo $(top_srcdir)/../dejagnu/runtest ; \
-	    else echo runtest; fi`
+	    else echo runtest; fi` $(AM_RUNTESTFLAGS)"
 
-AM_RUNTESTFLAGS =
+AM_RUNTESTFLAGS = STANDALONE=$(STANDALONE)
 
 CLEANFILES = *.exe core* *.log *.sum
Index: testsuite/lib/libffi-dg.exp
===================================================================
--- testsuite/lib/libffi-dg.exp	(revision 148292)
+++ testsuite/lib/libffi-dg.exp	(working copy)
@@ -16,7 +16,13 @@
 
 proc load_gcc_lib { filename } {
     global srcdir
-    load_file $srcdir/../../gcc/testsuite/lib/$filename
+    global STANDALONE
+    
+     if {$STANDALONE == "yes"} {
+	 load_file $srcdir/lib/$filename
+     } else {
+         load_file $srcdir/../../gcc/testsuite/lib/$filename
+     }
 }
 
 load_lib dg.exp
@@ -101,11 +107,17 @@
     global libffi_link_flags
     global tool_root_dir
     global ld_library_path
+    global STANDALONE
 
-    set blddirffi [lookfor_file [get_multilibs] libffi]
+    if {$STANDALONE == "yes"} {
+	set blddirffi [pwd]/..
+    } else {
+	set blddirffi [lookfor_file [get_multilibs] libffi]
+	set blddircxx [lookfor_file [get_multilibs] libstdc++-v3]
+	verbose "libstdc++ $blddircxx"
+    }
+
     verbose "libffi $blddirffi"
-    set blddircxx [lookfor_file [get_multilibs] libstdc++-v3]
-    verbose "libstdc++ $blddircxx"
 
     set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a]
     if {$gccdir != ""} {
@@ -132,8 +144,10 @@
     }
     # add the library path for libffi.
     append ld_library_path ":${blddirffi}/.libs"
-    # add the library path for libstdc++ as well.
-    append ld_library_path ":${blddircxx}/src/.libs"
+    if {$STANDALONE == "no"} {
+	# add the library path for libstdc++ as well.
+	append ld_library_path ":${blddircxx}/src/.libs"
+    }
 
     verbose "ld_library_path: $ld_library_path"
 
@@ -146,7 +160,9 @@
     if { $libffi_dir != "" } {
 	set libffi_dir [file dirname ${libffi_dir}]
 	set libffi_link_flags "-L${libffi_dir}/.libs"
-	lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+	if {$STANDALONE == "no"} {
+	    lappend libffi_link_flags "-L${blddircxx}/src/.libs"
+	}
     }
 
     set_ld_library_path_env_vars

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

* Re: [patch] libffi testsuite standalone vs. gcc
  2009-06-08 19:36 [patch] libffi testsuite standalone vs. gcc Andreas Tobler
@ 2009-06-08 19:51 ` Ralf Wildenhues
  2009-06-11  8:24   ` Andrew Haley
  0 siblings, 1 reply; 3+ messages in thread
From: Ralf Wildenhues @ 2009-06-08 19:51 UTC (permalink / raw)
  To: Andreas Tobler; +Cc: libffi-discuss, GCC Patches

Hello Andreas,

* Andreas Tobler wrote on Mon, Jun 08, 2009 at 09:36:25PM CEST:
> this is a try to keep the differences between the gcc-libffi testsuite  
> and the libffi-standalone minimal.

> Thoughts?

> 	* configure.ac: Introduce a STANDALONE variable to be able to run the
> 	testsuite accordingly.

Yes, unless standalone libffi routine uses a bootstrap script that sets
STANDALONE, you should default to the stand-alone version, and the
in-GCC version should key off some value passed from the toplevel
makefile.

However, I don't think you can easily postpone the decision of
stand-alone-ness until configure time for all differences so easily,
for autoconf-time differences you'd use a m4 macro not a shell variable.

Cheers,
Ralf

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

* Re: [patch] libffi testsuite standalone vs. gcc
  2009-06-08 19:51 ` Ralf Wildenhues
@ 2009-06-11  8:24   ` Andrew Haley
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Haley @ 2009-06-11  8:24 UTC (permalink / raw)
  To: Ralf Wildenhues, Andreas Tobler, libffi-discuss, GCC Patches

Ralf Wildenhues wrote:
> Hello Andreas,
> 
> * Andreas Tobler wrote on Mon, Jun 08, 2009 at 09:36:25PM CEST:
>> this is a try to keep the differences between the gcc-libffi testsuite  
>> and the libffi-standalone minimal.
> 
>> Thoughts?
> 
>> 	* configure.ac: Introduce a STANDALONE variable to be able to run the
>> 	testsuite accordingly.
> 
> Yes, unless standalone libffi routine uses a bootstrap script that sets
> STANDALONE, you should default to the stand-alone version, and the
> in-GCC version should key off some value passed from the toplevel
> makefile.
> 
> However, I don't think you can easily postpone the decision of
> stand-alone-ness until configure time for all differences so easily,
> for autoconf-time differences you'd use a m4 macro not a shell variable.

OK, so do you have a better solution?  Patches welcome.

Andrew.

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

end of thread, other threads:[~2009-06-11  8:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-08 19:36 [patch] libffi testsuite standalone vs. gcc Andreas Tobler
2009-06-08 19:51 ` Ralf Wildenhues
2009-06-11  8:24   ` Andrew Haley

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).