/[dejagnu]/dejagnu/config/sim.exp
ViewVC logotype

Diff of /dejagnu/config/sim.exp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by rsavoye, Fri Feb 21 06:51:53 2003 UTC revision 1.4 by bje, Thu Aug 7 03:42:43 2003 UTC
# Line 28  proc sim_spawn { dest cmdline args } { Line 28  proc sim_spawn { dest cmdline args } {
28          perror "no simulator defined for [board_info $dest name]"          perror "no simulator defined for [board_info $dest name]"
29          exit 1          exit 1
30      } else {      } else {
31          set sim [board_info $dest sim];          set sim [board_info $dest sim]
32      }      }
33    
34      if [board_info $dest exists sim,options] {      if [board_info $dest exists sim,options] {
# Line 40  proc sim_spawn { dest cmdline args } { Line 40  proc sim_spawn { dest cmdline args } {
40      if ![is_remote host] {      if ![is_remote host] {
41          if { [which $sim] == 0 } {          if { [which $sim] == 0 } {
42              verbose -log "Simulator $sim missing." 3              verbose -log "Simulator $sim missing." 3
43              return -1;              return -1
44          }          }
45      }      }
46    
# Line 49  proc sim_spawn { dest cmdline args } { Line 49  proc sim_spawn { dest cmdline args } {
49          # we're assuming the program is the first word in the command.          # we're assuming the program is the first word in the command.
50          # FIXME: "prog < infile" won't work until we download infile.          # FIXME: "prog < infile" won't work until we download infile.
51          set prog [lindex $cmdline 0]          set prog [lindex $cmdline 0]
52          set prog [remote_download host $prog a.out];          set prog [remote_download host $prog a.out]
53          set cmdline [lreplace $cmdline 0 0 $prog]          set cmdline [lreplace $cmdline 0 0 $prog]
54      }      }
55    
56      return [eval remote_spawn host \{ $sim $simflags $cmdline \} $args];      return [eval remote_spawn host \{ $sim $simflags $cmdline \} $args]
57  }  }
58    
59  proc sim_wait { dest timeout } {  proc sim_wait { dest timeout } {
60      return [remote_wait host $timeout];      return [remote_wait host $timeout]
61  }  }
62    
63  proc sim_load { dest prog args } {  proc sim_load { dest prog args } {
# Line 71  proc sim_load { dest prog args } { Line 71  proc sim_load { dest prog args } {
71      if ![file exists $prog] then {      if ![file exists $prog] then {
72          perror "sim.exp: $prog to be downloaded does not exist."          perror "sim.exp: $prog to be downloaded does not exist."
73          verbose -log "$prog to be downloaded does not exist." 3          verbose -log "$prog to be downloaded does not exist." 3
74          return [list "untested" ""];          return [list "untested" ""]
75      }      }
76    
77      if [board_info $dest exists sim_time_limit] {      if [board_info $dest exists sim_time_limit] {
78          set sim_time_limit [board_info $dest sim_time_limit];          set sim_time_limit [board_info $dest sim_time_limit]
79      } else {      } else {
80          set sim_time_limit 240          set sim_time_limit 240
81      }      }
82    
83      set output "";      set output ""
84    
85       if { [board_info target sim,protocol] == "sid" } {       if { [board_info target sim,protocol] == "sid" } {
86         set cmd "-e \"set cpu-loader file [list $prog]\""         set cmd "-e \"set cpu-loader file [list $prog]\""
# Line 94  proc sim_load { dest prog args } { Line 94  proc sim_load { dest prog args } {
94      # this isn't as nice as limiting the amount of CPU time, it      # this isn't as nice as limiting the amount of CPU time, it
95      # will have to do.      # will have to do.
96      if { $inpfile != "" } {      if { $inpfile != "" } {
97          set res [remote_spawn target "${cmd} < $inpfile" "readonly"];          set res [remote_spawn target "${cmd} < $inpfile" "readonly"]
98      } else {      } else {
99          set res [remote_spawn target "${cmd}"];          set res [remote_spawn target "${cmd}"]
100      }      }
101    
102      if { $res <= 0 } {      if { $res <= 0 } {
103          return [list "fail" "remote_spawn failed"];          return [list "fail" "remote_spawn failed"]
104      }      }
105    
106      set state [remote_wait target $sim_time_limit];      set state [remote_wait target $sim_time_limit]
107      set status [lindex $state 0];      set status [lindex $state 0]
108      set output [lindex $state 1];      set output [lindex $state 1]
109      verbose "Output is $output";      verbose "Output is $output"
110    
111      set status2 [check_for_board_status output];      set status2 [check_for_board_status output]
112      if { $status2 >= 0 } {      if { $status2 >= 0 } {
113          set status $status2          set status $status2
114      }      }
# Line 122  proc sim_load { dest prog args } { Line 122  proc sim_load { dest prog args } {
122      } else {      } else {
123          set result "fail"          set result "fail"
124      }      }
125      return [list $result $output];      return [list $result $output]
126  }  }
127    
128  set_board_info protocol  "sim";  set_board_info protocol  "sim"
129    
130  # By default, assume the simulator is slow.  This causes some tests  # By default, assume the simulator is slow.  This causes some tests
131  # to either be simplified or skipped completely.  # to either be simplified or skipped completely.

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26