Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Dejagnu and parallel make tests of gcc
@ 2002-09-24  8:50 Richard Earnshaw
  2002-09-24  9:06 ` Andrew Cagney
  2002-09-25  8:17 ` Jim Wilson
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Earnshaw @ 2002-09-24  8:50 UTC (permalink / raw)
  To: gcc-patches, gdb-patches; +Cc: Richard.Earnshaw

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

Ok, first question.  Is the copy of dejagnu on sources.redhat.com (the one 
in gdb) the master copy these days, or is there some other mailing list 
for dejagnu framework patches?

I've finally worked out what the problems were with running parallel makes 
for testing gcc and with the patches below I can now run

	gnumake -k -j <some-big-number> check

from the top level and get all the testsuites to run in parallel on a 
cross build.

The problem was the pesky testglue.o file that is used to wrap executables 
that are run on the simulator, or other non-native targets.  This file is 
built by each of check-gcc check-g++ check-objc etc and then removed when 
that check is complete.

On a sequential make that isn't a problem because the next make simply 
rebuilds the file, but on a parallel make it means that the file gets 
removed before some of the tests have finished running.  Unfortunately 
because of the convoluted cross-build configurations that we need to 
support the fix involves changes to both gcc/testsuite/lib and 
dejagnu/lib.  Fortunately each patch can be applied independently without 
affecting or requiring the other.  However, for parallel checks of cross 
targets you do need both.

The first patch is to the gcc testsuite and ensures that if the gcc, g++ 
etc test packages all try to build testglue.c together then there will not 
be a race condition where they build the same object on top of each other. 
 The second patch is to the dejagnu framework itself and ensures that when 
we transfer the object to the (potentially remote) host we use a filename 
that will not conflict with any other -- in this case I've chosen 
${tool}_tg.o, which should be fairly safe.

gcc/testsuite:

<date>  Richard Earnshaw  <rearnsha@arm.com>

	* lib/gcc.exp (gcc_init): Use a filename for the testglue that is
	unique to the tool.
	* lib/g77.exp (g77_init): Likewise.
	* lib/g++.exp (g++_init): Likewise.
	* lib/objc.exp (objc_init): Likewise.

dejagnu:

<date>  Richard Earnshaw  <rearnsha@arm.com>

	* lib/libgloss.exp (build_wrapper): Use a tool-specific filename on
	the host for the testglue.



[-- Attachment #2: libgloss.patch --]
[-- Type: text/x-patch , Size: 1198 bytes --]

Index: libgloss.exp
===================================================================
RCS file: /cvs/src/src/dejagnu/lib/libgloss.exp,v
retrieving revision 1.8
diff -p -r1.8 libgloss.exp
*** libgloss.exp	21 Apr 2002 08:47:07 -0000	1.8
--- libgloss.exp	24 Sep 2002 15:47:35 -0000
*************** proc find_ld { } {
*** 812,817 ****
--- 812,818 ----
  
  proc build_wrapper { gluefile } {
      global libdir
+     global tool
  
      if [target_info exists wrap_m68k_aout] {
  	set flags "additional_flags=-DWRAP_M68K_AOUT";
*************** proc build_wrapper { gluefile } {
*** 832,838 ****
  	lappend flags "additional_flags=[target_info wrap_compile_flags]";
      }
      if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } {
! 	set gluefile [remote_download host ${gluefile} testglue.o];
  	return [list $gluefile $result];
      } else {
  	return ""
--- 833,839 ----
  	lappend flags "additional_flags=[target_info wrap_compile_flags]";
      }
      if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } {
!       set gluefile [remote_download host ${gluefile} ${tool}_tg.o];
  	return [list $gluefile $result];
      } else {
  	return ""

[-- Attachment #3: dejagnu.patch --]
[-- Type: text/x-patch , Size: 3310 bytes --]

Index: g++.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/g++.exp,v
retrieving revision 1.26
diff -p -r1.26 g++.exp
*** g++.exp	9 May 2002 21:01:53 -0000	1.26
--- g++.exp	24 Sep 2002 15:43:16 -0000
*************** proc g++_init { args } {
*** 239,245 ****
      }
  
      if { [target_info needs_status_wrapper] != "" } {
! 	set gluefile ${tmpdir}/testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
--- 239,245 ----
      }
  
      if { [target_info needs_status_wrapper] != "" } {
! 	set gluefile ${tmpdir}/g++-testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
Index: g77.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/g77.exp,v
retrieving revision 1.14
diff -p -r1.14 g77.exp
*** g77.exp	9 May 2002 21:01:53 -0000	1.14
--- g77.exp	24 Sep 2002 15:43:16 -0000
*************** proc g77_init { args } {
*** 168,174 ****
      }
  
      if { [target_info needs_status_wrapper] != "" } {
! 	set gluefile ${tmpdir}/testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
--- 168,174 ----
      }
  
      if { [target_info needs_status_wrapper] != "" } {
! 	set gluefile ${tmpdir}/g77-testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
Index: gcc.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/gcc.exp,v
retrieving revision 1.9
diff -p -r1.9 gcc.exp
*** gcc.exp	16 Jul 2002 02:16:47 -0000	1.9
--- gcc.exp	24 Sep 2002 15:43:16 -0000
*************** proc gcc_init { args } {
*** 109,115 ****
      if {[target_info needs_status_wrapper] != "" && \
  	    [target_info needs_status_wrapper] != "0" && \
  	    ![info exists gluefile]} {
! 	set gluefile ${tmpdir}/testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
--- 109,115 ----
      if {[target_info needs_status_wrapper] != "" && \
  	    [target_info needs_status_wrapper] != "0" && \
  	    ![info exists gluefile]} {
! 	set gluefile ${tmpdir}/gcc-testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
Index: objc.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/objc.exp,v
retrieving revision 1.15
diff -p -r1.15 objc.exp
*** objc.exp	16 Jul 2002 02:16:47 -0000	1.15
--- objc.exp	24 Sep 2002 15:43:16 -0000
*************** proc objc_init { args } {
*** 108,114 ****
  	set tmpdir /tmp
      }
      if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } {
! 	set gluefile ${tmpdir}/testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];
--- 108,114 ----
  	set tmpdir /tmp
      }
      if { [target_info needs_status_wrapper]!="" && ![info exists gluefile] } {
! 	set gluefile ${tmpdir}/objc-testglue.o;
  	set result [build_wrapper $gluefile];
  	if { $result != "" } {
  	    set gluefile [lindex $result 0];

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

* Re: Dejagnu and parallel make tests of gcc
  2002-09-24  8:50 Dejagnu and parallel make tests of gcc Richard Earnshaw
@ 2002-09-24  9:06 ` Andrew Cagney
  2002-09-25  8:17 ` Jim Wilson
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-09-24  9:06 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gcc-patches, gdb-patches

 From the top level MAINTAINERS file:

dejagnu/
         Send all patches to:
         http://www.gnu.org/software/dejagnu/
         mail:bug-dejagnu@gnu.org
         For changes to the local repostory, send them to
         gdb-patches@sources.redhat.com when generic; and sid@,
         binutils@, gcc@, etc. for sub-components.

It is close to the master.

Andrew


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

* Re: Dejagnu and parallel make tests of gcc
  2002-09-24  8:50 Dejagnu and parallel make tests of gcc Richard Earnshaw
  2002-09-24  9:06 ` Andrew Cagney
@ 2002-09-25  8:17 ` Jim Wilson
  2002-09-26 18:57   ` Andrew Cagney
  1 sibling, 1 reply; 4+ messages in thread
From: Jim Wilson @ 2002-09-25  8:17 UTC (permalink / raw)
  To: Richard.Earnshaw; +Cc: gcc-patches, gdb-patches

>The problem was the pesky testglue.o file that is used to wrap executables 
>that are run on the simulator, or other non-native targets.

By the way, the testglue.o file is only needed for broken simulators and
broken monitors that are unable to return the process exit code.  It would
be better to try to fix the broken simulators/monitors than to continue to
make this hack more complicated.  The hack was added originally because Cygnus
had no monitor sources, and thus fixing broken monitors was not an option.
Unfortunately, people then started using it to justify broken simulators,
and now we have a mess.

The way this is supposed to work is that the simulator should return the
simulated process exit code as its own exit code.  Then we can do testing on
simulators by doing "sh simulator testcase" instead of "sh testcase".
The testglue.o file is not needed in this case, and everything works better.

You can disable use of testglue.o in dejagnu by deleting the line that sets
needs_status_wrapper to 1.

Jim


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

* Re: Dejagnu and parallel make tests of gcc
  2002-09-25  8:17 ` Jim Wilson
@ 2002-09-26 18:57   ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-09-26 18:57 UTC (permalink / raw)
  To: Jim Wilson; +Cc: Richard.Earnshaw, gcc-patches, gdb-patches

>>The problem was the pesky testglue.o file that is used to wrap executables 
>>that are run on the simulator, or other non-native targets.
> 
> 
> By the way, the testglue.o file is only needed for broken simulators and
> broken monitors that are unable to return the process exit code.  It would
> be better to try to fix the broken simulators/monitors than to continue to
> make this hack more complicated.  The hack was added originally because Cygnus
> had no monitor sources, and thus fixing broken monitors was not an option.
> Unfortunately, people then started using it to justify broken simulators,
> and now we have a mess.

Yes.  The simulator just needs to return a correct value via:

/* Fetch the REASON why the program stopped.

    SIM_EXITED: The program has terminated. SIGRC indicates the target
    dependant exit status.

    SIM_STOPPED: The program has stopped.  SIGRC uses the host's signal
    numbering as a way of identifying the reaon: program interrupted by
    user via a sim_stop request (SIGINT); a breakpoint instruction
    (SIGTRAP); a completed single step (SIGTRAP); an internal error
    condition (SIGABRT); an illegal instruction (SIGILL); Access to an
    undefined memory region (SIGSEGV); Mis-aligned memory access
    (SIGBUS).  For some signals information in addition to the signal
    number may be retained by the simulator (e.g. offending address),
    that information is not directly accessable via this interface.

    SIM_SIGNALLED: The program has been terminated by a signal. The
    simulator has encountered target code that causes the the program
    to exit with signal SIGRC.

    SIM_RUNNING, SIM_POLLING: The return of one of these values
    indicates a problem internal to the simulator. */

enum sim_stop { sim_running, sim_polling, sim_exited, sim_stopped, 
sim_signalled
  };

void sim_stop_reason PARAMS ((SIM_DESC sd, enum sim_stop *reason, int 
*sigrc));

when it encounters a an ``exit()'' trap.  See include/gdb/remote-sim.h.

> The way this is supposed to work is that the simulator should return the
> simulated process exit code as its own exit code.  Then we can do testing on
> simulators by doing "sh simulator testcase" instead of "sh testcase".
> The testglue.o file is not needed in this case, and everything works better.
> 
> You can disable use of testglue.o in dejagnu by deleting the line that sets
> needs_status_wrapper to 1.


Andrew



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

end of thread, other threads:[~2002-09-27  1:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-24  8:50 Dejagnu and parallel make tests of gcc Richard Earnshaw
2002-09-24  9:06 ` Andrew Cagney
2002-09-25  8:17 ` Jim Wilson
2002-09-26 18:57   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox