OSDN Git Service

2000-11-01 Dave Brolley <brolley@cygnus.com>
authorbrolley <brolley>
Wed, 1 Nov 2000 15:40:17 +0000 (15:40 +0000)
committerbrolley <brolley>
Wed, 1 Nov 2000 15:40:17 +0000 (15:40 +0000)
* 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. Use "$cpu_option"  to identify the machine to the
assembler, if specified.

sim/testsuite/lib/sim-defs.exp

index 16a742f..e00b99c 100644 (file)
@@ -143,23 +143,28 @@ proc sim_run { prog sim_opts prog_opts redir options } {
 # Run testcase NAME.
 # NAME is either a fully specified file name, or just the file name in which
 # case $srcdir/$subdir will be prepended.
-# ALL_MACHS is a list of machs to use if "mach: all" is specified in the file.
-# The file can contain options in the form "# option(mach list): value"
+# REQUESTED_MACHS is a list of machines to run the testcase on.  If NAME isn't
+# for the specified machine(s), it is ignored.
+# Typically REQUESTED_MACHS contains just one element, it is up to the caller
+# to iterate over the desired machine variants.
+#
+# The file can contain options in the form "# option(mach list): value".
 # Possibilities:
 # mach: [all | machine names]
 # 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
+# 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 all_machs } {
+proc run_sim_test { name requested_machs } {
     global subdir srcdir
-    global AS ASFLAGS LD LDFLAGS SIMFLAGS
+    global SIMFLAGS
     global opts
+    global cpu_option
 
     if [string match "*/*" $name] {
        set file $name
@@ -173,14 +178,28 @@ proc run_sim_test { name all_machs } {
        unresolved $subdir/$name
        return
     }
-    set opts(as) {}
-    set opts(ld) {}
-    set opts(sim) {}
-    set opts(output) {}
-    set opts(mach) {}
-    set opts(timeout) {}
+    # 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]
@@ -210,14 +229,28 @@ proc run_sim_test { name all_machs } {
     # Change \n sequences to newline chars.
     regsub -all "\\\\n" $opts(output) "\n" opts(output)
 
-    foreach mach $opts(mach) {
-       verbose "Testing $name on $mach."
+    set testcase_machs $opts(mach)
+    if { "$testcase_machs" == "all" } {
+       set testcase_machs $requested_machs
+    }
+
+    foreach mach $testcase_machs {
+       if { [lsearch $requested_machs $mach] < 0 } {
+           verbose -log "Skipping $mach version of $name, not requested."
+           continue
+       }
+
+       verbose -log "Testing $name on machine $mach."
 
        if ![info exists opts(as,$mach)] {
            set opts(as,$mach) $opts(as)
        }
-       send_log "$AS $ASFLAGS $opts(as,$mach) -I$srcdir/$subdir -o ${name}.o $sourcefile\n"
-       catch "exec $AS $ASFLAGS $opts(as,$mach) -I$srcdir/$subdir -o ${name}.o $sourcefile" comp_output
+
+       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
@@ -228,8 +261,8 @@ proc run_sim_test { name all_machs } {
        if ![info exists opts(ld,$mach)] {
            set opts(ld,$mach) $opts(ld)
        }
-       send_log "$LD $LDFLAGS $opts(ld,$mach) -o ${name}.x ${name}.o\n"
-       catch "exec $LD $LDFLAGS $opts(ld,$mach) -o ${name}.x ${name}.o" comp_output
+
+       set comp_output [target_link ${name}.o ${name}.x "$opts(ld,$mach)"]
 
        if ![string match "" $comp_output] {
            verbose -log "$comp_output" 3