This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch:RFA:sim testsuite: Options Embedded in Test Cases


Hi,

The attached patch addresses two issues:

1) Yet another attempt at passing the correct cpu to the assembler
when more than one machine is being tested. This time I've defined a
global variable 'cpu_option' which the caller can set to indicate the
name of the option which specifies the cpu.

2) Resetting options between test cases. Currently options from
previous test cases are not cleared and sometimes they leak into
subsequent tests. Specifically unsetting them seems to be the only way
to make the "if [info exists <option>]" tests work properly.

Tested against m32r (which does not specify 'cpu_option', but has more
than one machine) and two internal ports (one of which uses
'cpu_option' and has mutiple machines to test).

OK to commit?

Dave
2000-10-30  Dave Brolley  <brolley@cygnus.com>

	* lib/sim-defs.exp (run_sm_test): Correct comment. "output" and
	"xerror" options do not use a list of machines. Clear options from
	previous test case.

Index: sim-defs.exp
===================================================================
RCS file: /cvs/src/src/sim/testsuite/lib/sim-defs.exp,v
retrieving revision 1.1.1.2
diff -c -p -r1.1.1.2 sim-defs.exp
*** sim-defs.exp	1999/08/31 01:14:27	1.1.1.2
--- sim-defs.exp	2000/10/30 21:08:17
*************** proc sim_run { prog sim_opts prog_opts r
*** 154,161 ****
  # as[(mach-list)]: <assembler options>
  # ld[(mach-list)]: <linker options>
  # sim[(mach-list)]: <simulator options>
! # output[(mach-list)]: program output pattern to match with string-match
! # xerror[(mach-list)]: program is expected to return with a "failure" exit code
  # If `output' is not specified, the program must output "pass" if !xerror or
  # "fail" if xerror.
  # The parens in "optname()" are optional if the specification is for all machs.
--- 154,161 ----
  # as[(mach-list)]: <assembler options>
  # ld[(mach-list)]: <linker options>
  # sim[(mach-list)]: <simulator options>
! # output: program output pattern to match with string-match
! # xerror: program is expected to return with a "failure" exit code
  # If `output' is not specified, the program must output "pass" if !xerror or
  # "fail" if xerror.
  # The parens in "optname()" are optional if the specification is for all machs.
*************** proc run_sim_test { name requested_machs
*** 164,169 ****
--- 164,170 ----
      global subdir srcdir
      global SIMFLAGS
      global opts
+     global cpu_option
  
      if [string match "*/*" $name] {
  	set file $name
*************** proc run_sim_test { name requested_machs
*** 177,190 ****
  	unresolved $subdir/$name
  	return
      }
!     set opts(as) {}
!     set opts(ld) {}
!     set opts(sim) {}
!     set opts(output) {}
!     set opts(mach) {}
!     set opts(timeout) {}
      set opts(xerror) "no"
  
      foreach i $opt_array {
  	set opt_name [lindex $i 0]
  	set opt_machs [lindex $i 1]
--- 178,205 ----
  	unresolved $subdir/$name
  	return
      }
!     # Clear default options
!     set opts(as) ""
!     set opts(ld) ""
!     set opts(sim) ""
!     set opts(output) ""
!     set opts(mach) ""
!     set opts(timeout) ""
      set opts(xerror) "no"
  
+     # Clear any machine specific options specified in a previous test case
+     foreach m $requested_machs {
+ 	if [info exists opts(as,$m)] {
+ 	    unset opts(as,$m)
+ 	}
+ 	if [info exists opts(ld,$m)] {
+ 	    unset opts(ld,$m)
+ 	}
+ 	if [info exists opts(sim,$m)] {
+ 	    unset opts(sim,$m)
+ 	}
+     }
+ 
      foreach i $opt_array {
  	set opt_name [lindex $i 0]
  	set opt_machs [lindex $i 1]
*************** proc run_sim_test { name requested_machs
*** 231,237 ****
  	    set opts(as,$mach) $opts(as)
  	}
  
! 	set comp_output [target_assemble $sourcefile ${name}.o "$opts(as,$mach) -I$srcdir/$subdir"]
  
  	if ![string match "" $comp_output] {
  	    verbose -log "$comp_output" 3
--- 246,256 ----
  	    set opts(as,$mach) $opts(as)
  	}
  
! 	set as_options "$opts(as,$mach) -I$srcdir/$subdir"
! 	if [info exists cpu_option] {
! 	    set as_options "$as_options $cpu_option=$mach"
! 	}
! 	set comp_output [target_assemble $sourcefile ${name}.o "$as_options"]
  
  	if ![string match "" $comp_output] {
  	    verbose -log "$comp_output" 3

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]