210 |
global target_triplet |
global target_triplet |
211 |
global target_alias |
global target_alias |
212 |
global host_triplet |
global host_triplet |
213 |
global board; |
global board |
214 |
|
|
215 |
if [string match $target_triplet $host_triplet] { |
if [string match $target_triplet $host_triplet] { |
216 |
return $name |
return $name |
226 |
} else { |
} else { |
227 |
if [info exists board] { |
if [info exists board] { |
228 |
if [board_info $board exists target_install] { |
if [board_info $board exists target_install] { |
229 |
set target_install [board_info $board target_install]; |
set target_install [board_info $board target_install] |
230 |
} |
} |
231 |
} |
} |
232 |
if [target_info exists target_install] { |
if [target_info exists target_install] { |
233 |
set target_install [target_info target_install]; |
set target_install [target_info target_install] |
234 |
} |
} |
235 |
if [info exists target_alias] { |
if [info exists target_alias] { |
236 |
set tmp ${target_alias}-${name}; |
set tmp ${target_alias}-${name} |
237 |
} elseif [info exists target_install] { |
} elseif [info exists target_install] { |
238 |
if { [lsearch -exact $target_install $target_alias] >= 0 } { |
if { [lsearch -exact $target_install $target_alias] >= 0 } { |
239 |
set tmp ${target_alias}-${name}; |
set tmp ${target_alias}-${name} |
240 |
} else { |
} else { |
241 |
set tmp "[lindex $target_install 0]-${name}"; |
set tmp "[lindex $target_install 0]-${name}" |
242 |
} |
} |
243 |
} |
} |
244 |
verbose "Transforming $name to $tmp"; |
verbose "Transforming $name to $tmp" |
245 |
return $tmp; |
return $tmp |
246 |
} |
} |
247 |
} |
} |
248 |
|
|
335 |
# TYPE is used when displaying error and progress messages. |
# TYPE is used when displaying error and progress messages. |
336 |
# |
# |
337 |
proc search_and_load_file { type filelist dirlist } { |
proc search_and_load_file { type filelist dirlist } { |
338 |
set found 0; |
set found 0 |
339 |
|
|
340 |
foreach dir $dirlist { |
foreach dir $dirlist { |
341 |
foreach initfile $filelist { |
foreach initfile $filelist { |
363 |
break |
break |
364 |
} |
} |
365 |
} |
} |
366 |
return $found; |
return $found |
367 |
} |
} |
368 |
|
|
369 |
# |
# |
370 |
# Give a usage statement. |
# Give a usage statement. |
371 |
# |
# |
372 |
proc usage { } { |
proc usage { } { |
373 |
global tool; |
global tool |
374 |
|
|
375 |
send_user "USAGE: runtest \[options...\]\n" |
send_user "USAGE: runtest \[options...\]\n" |
376 |
send_user "\t--all (-a)\t\tPrint all test output to screen\n" |
send_user "\t--all (-a)\t\tPrint all test output to screen\n" |
400 |
send_user "\tscript.exp\[=arg(s)\]\tRun these tests only\n" |
send_user "\tscript.exp\[=arg(s)\]\tRun these tests only\n" |
401 |
if { [info exists tool] } { |
if { [info exists tool] } { |
402 |
if { [info proc ${tool}_option_help] != "" } { |
if { [info proc ${tool}_option_help] != "" } { |
403 |
${tool}_option_help; |
${tool}_option_help |
404 |
} |
} |
405 |
} |
} |
406 |
} |
} |
482 |
} |
} |
483 |
|
|
484 |
"--target_bo*" { |
"--target_bo*" { |
485 |
set target_list $optarg; |
set target_list $optarg |
486 |
continue; |
continue |
487 |
} |
} |
488 |
|
|
489 |
"--ta*" { # (--target) the target configuration |
"--ta*" { # (--target) the target configuration |
503 |
|
|
504 |
"--tool_ro*" { |
"--tool_ro*" { |
505 |
set tool_root_dir $optarg |
set tool_root_dir $optarg |
506 |
continue; |
continue |
507 |
} |
} |
508 |
|
|
509 |
"--to*" { # (--tool) specify tool name |
"--to*" { # (--tool) specify tool name |
510 |
set tool $optarg |
set tool $optarg |
511 |
set comm_line_tool $optarg; |
set comm_line_tool $optarg |
512 |
continue |
continue |
513 |
} |
} |
514 |
|
|
574 |
foreach x ".. ../.. ../../.. ../../../.." { |
foreach x ".. ../.. ../../.. ../../../.." { |
575 |
verbose "$dir/$name" 2 |
verbose "$dir/$name" 2 |
576 |
if [file exists $dir/$name] { |
if [file exists $dir/$name] { |
577 |
return $dir/$name; |
return $dir/$name |
578 |
} |
} |
579 |
set dir [remote_file build dirname $dir]; |
set dir [remote_file build dirname $dir] |
580 |
} |
} |
581 |
return "" |
return "" |
582 |
} |
} |
593 |
global loaded_libs |
global loaded_libs |
594 |
|
|
595 |
if [info exists loaded_libs($file)] { |
if [info exists loaded_libs($file)] { |
596 |
return; |
return |
597 |
} |
} |
598 |
|
|
599 |
set loaded_libs($file) ""; |
set loaded_libs($file) "" |
600 |
|
|
601 |
if { [search_and_load_file "library file" $file [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]] == 0 } { |
if { [search_and_load_file "library file" $file [list ../lib $libdir $libdir/lib [file dirname [file dirname $srcdir]]/dejagnu/lib $srcdir/lib $execpath/lib . [file dirname [file dirname [file dirname $srcdir]]]/dejagnu/lib]] == 0 } { |
602 |
send_error "ERROR: Couldn't find library file $file.\n" |
send_error "ERROR: Couldn't find library file $file.\n" |
637 |
|
|
638 |
# Well, this just demonstrates the real problem... |
# Well, this just demonstrates the real problem... |
639 |
if ![info exists tool_root_dir] { |
if ![info exists tool_root_dir] { |
640 |
set tool_root_dir [file dirname $objdir]; |
set tool_root_dir [file dirname $objdir] |
641 |
if [file exists "$tool_root_dir/testsuite"] { |
if [file exists "$tool_root_dir/testsuite"] { |
642 |
set tool_root_dir [file dirname $tool_root_dir]; |
set tool_root_dir [file dirname $tool_root_dir] |
643 |
} |
} |
644 |
} |
} |
645 |
|
|
734 |
if [catch "info hostname" hb] { |
if [catch "info hostname" hb] { |
735 |
set hb "" |
set hb "" |
736 |
} else { |
} else { |
737 |
regsub "\\..*$" $hb "" hb; |
regsub "\\..*$" $hb "" hb |
738 |
} |
} |
739 |
verbose "hostname=$hb" 3; |
verbose "hostname=$hb" 3 |
740 |
return $hb; |
return $hb |
741 |
} |
} |
742 |
|
|
743 |
# |
# |
749 |
# variable $board set to the name of the current target being defined. |
# variable $board set to the name of the current target being defined. |
750 |
# |
# |
751 |
proc setup_target_hook { whole_name name } { |
proc setup_target_hook { whole_name name } { |
752 |
global board; |
global board |
753 |
global host_board; |
global host_board |
754 |
|
|
755 |
if [info exists host_board] { |
if [info exists host_board] { |
756 |
set hb $host_board; |
set hb $host_board |
757 |
} else { |
} else { |
758 |
set hb [get_local_hostname]; |
set hb [get_local_hostname] |
759 |
} |
} |
760 |
|
|
761 |
set board $whole_name; |
set board $whole_name |
762 |
|
|
763 |
global board_type; |
global board_type |
764 |
set board_type "target"; |
set board_type "target" |
765 |
|
|
766 |
load_config base-config.exp; |
load_config base-config.exp |
767 |
if ![load_board_description ${name} ${whole_name} ${hb}] { |
if ![load_board_description ${name} ${whole_name} ${hb}] { |
768 |
if { $name != "unix" } { |
if { $name != "unix" } { |
769 |
perror "couldn't load description file for ${name}"; |
perror "couldn't load description file for ${name}" |
770 |
exit 1; |
exit 1 |
771 |
} else { |
} else { |
772 |
load_generic_config "unix" |
load_generic_config "unix" |
773 |
} |
} |
774 |
} |
} |
775 |
|
|
776 |
if [board_info $board exists generic_name] { |
if [board_info $board exists generic_name] { |
777 |
load_tool_target_config [board_info $board generic_name]; |
load_tool_target_config [board_info $board generic_name] |
778 |
} |
} |
779 |
|
|
780 |
unset board; |
unset board |
781 |
unset board_type; |
unset board_type |
782 |
|
|
783 |
push_target $whole_name; |
push_target $whole_name |
784 |
|
|
785 |
if { [info procs ${whole_name}_init] != "" } { |
if { [info procs ${whole_name}_init] != "" } { |
786 |
${whole_name}_init $whole_name; |
${whole_name}_init $whole_name |
787 |
} |
} |
788 |
|
|
789 |
if { ![isnative] && ![is_remote target] } { |
if { ![isnative] && ![is_remote target] } { |
798 |
# Clean things up afterwards. |
# Clean things up afterwards. |
799 |
# |
# |
800 |
proc cleanup_target_hook { name } { |
proc cleanup_target_hook { name } { |
801 |
global tool; |
global tool |
802 |
# Clean up the target board. |
# Clean up the target board. |
803 |
if { [info procs "${name}_exit"] != "" } { |
if { [info procs "${name}_exit"] != "" } { |
804 |
${name}_exit; |
${name}_exit |
805 |
} |
} |
806 |
# We also call the tool exit routine here. |
# We also call the tool exit routine here. |
807 |
if [info exists tool] { |
if [info exists tool] { |
808 |
if { [info procs "${tool}_exit"] != "" } { |
if { [info procs "${tool}_exit"] != "" } { |
809 |
${tool}_exit; |
${tool}_exit |
810 |
} |
} |
811 |
} |
} |
812 |
remote_close target; |
remote_close target |
813 |
pop_target; |
pop_target |
814 |
} |
} |
815 |
|
|
816 |
proc setup_host_hook { name } { |
proc setup_host_hook { name } { |
817 |
global board; |
global board |
818 |
global board_info; |
global board_info |
819 |
global board_type; |
global board_type |
820 |
|
|
821 |
set board $name; |
set board $name |
822 |
set board_type "host"; |
set board_type "host" |
823 |
|
|
824 |
load_board_description $name; |
load_board_description $name |
825 |
unset board; |
unset board |
826 |
unset board_type; |
unset board_type |
827 |
push_host $name; |
push_host $name |
828 |
if { [info proc ${name}_init] != "" } { |
if { [info proc ${name}_init] != "" } { |
829 |
${name}_init $name; |
${name}_init $name |
830 |
} |
} |
831 |
} |
} |
832 |
|
|
833 |
proc setup_build_hook { name } { |
proc setup_build_hook { name } { |
834 |
global board; |
global board |
835 |
global board_info; |
global board_info |
836 |
global board_type; |
global board_type |
837 |
|
|
838 |
set board $name; |
set board $name |
839 |
set board_type "build"; |
set board_type "build" |
840 |
|
|
841 |
load_board_description $name; |
load_board_description $name |
842 |
unset board; |
unset board |
843 |
unset board_type; |
unset board_type |
844 |
push_build $name; |
push_build $name |
845 |
if { [info proc ${name}_init] != "" } { |
if { [info proc ${name}_init] != "" } { |
846 |
${name}_init $name; |
${name}_init $name |
847 |
} |
} |
848 |
} |
} |
849 |
|
|
871 |
send_error "WARNING: global config file $env(DEJAGNU) not found.\n" |
send_error "WARNING: global config file $env(DEJAGNU) not found.\n" |
872 |
} |
} |
873 |
if ![info exists boards_dir] { |
if ![info exists boards_dir] { |
874 |
set boards_dir "[file dirname $env(DEJAGNU)]/boards"; |
set boards_dir "[file dirname $env(DEJAGNU)]/boards" |
875 |
} |
} |
876 |
} |
} |
877 |
|
|
928 |
global loaded_libs |
global loaded_libs |
929 |
|
|
930 |
if [info exists loaded_libs($file)] { |
if [info exists loaded_libs($file)] { |
931 |
return; |
return |
932 |
} |
} |
933 |
|
|
934 |
set loaded_libs($file) ""; |
set loaded_libs($file) "" |
935 |
|
|
936 |
if [file exists ${srcdir}/lib/$file] { |
if [file exists ${srcdir}/lib/$file] { |
937 |
verbose "Loading library file ${srcdir}/lib/$file" |
verbose "Loading library file ${srcdir}/lib/$file" |
960 |
load_lib libgloss.exp |
load_lib libgloss.exp |
961 |
|
|
962 |
# Initialize the test counters and reset them to 0. |
# Initialize the test counters and reset them to 0. |
963 |
init_testcounts; |
init_testcounts |
964 |
reset_vars; |
reset_vars |
965 |
|
|
966 |
# |
# |
967 |
# Parse the command line arguments. |
# Parse the command line arguments. |
970 |
# Load the tool initialization file. Allow the --tool option to override |
# Load the tool initialization file. Allow the --tool option to override |
971 |
# what's set in the site.exp file. |
# what's set in the site.exp file. |
972 |
if [info exists comm_line_tool] { |
if [info exists comm_line_tool] { |
973 |
set tool $comm_line_tool; |
set tool $comm_line_tool |
974 |
} |
} |
975 |
|
|
976 |
if [info exists tool] { |
if [info exists tool] { |
977 |
load_tool_init ${tool}.exp; |
load_tool_init ${tool}.exp |
978 |
} |
} |
979 |
|
|
980 |
set argc [ llength $argv ] |
set argc [ llength $argv ] |
1038 |
|
|
1039 |
"--target_bo*" { |
"--target_bo*" { |
1040 |
# Set it again, father knows best. |
# Set it again, father knows best. |
1041 |
set target_list $optarg; |
set target_list $optarg |
1042 |
continue; |
continue |
1043 |
} |
} |
1044 |
|
|
1045 |
"--ta*" { # (--target) the target configuration |
"--ta*" { # (--target) the target configuration |
1157 |
|
|
1158 |
"--tool_ro*" { |
"--tool_ro*" { |
1159 |
set tool_root_dir $optarg |
set tool_root_dir $optarg |
1160 |
continue; |
continue |
1161 |
} |
} |
1162 |
|
|
1163 |
"--to*" { # (--tool) specify tool name |
"--to*" { # (--tool) specify tool name |
1173 |
} |
} |
1174 |
|
|
1175 |
"--he*" { # (--help) help text |
"--he*" { # (--help) help text |
1176 |
usage; |
usage |
1177 |
exit 0 |
exit 0 |
1178 |
} |
} |
1179 |
|
|
1185 |
if [info exists tool] { |
if [info exists tool] { |
1186 |
if { [info proc ${tool}_option_proc] != "" } { |
if { [info proc ${tool}_option_proc] != "" } { |
1187 |
if [${tool}_option_proc $option] { |
if [${tool}_option_proc $option] { |
1188 |
continue; |
continue |
1189 |
} |
} |
1190 |
} |
} |
1191 |
} |
} |
1246 |
# |
# |
1247 |
|
|
1248 |
proc load_generic_config { name } { |
proc load_generic_config { name } { |
1249 |
global srcdir; |
global srcdir |
1250 |
global configfile; |
global configfile |
1251 |
global libdir; |
global libdir |
1252 |
global env; |
global env |
1253 |
global board; |
global board |
1254 |
global board_info; |
global board_info |
1255 |
global boards_dir; |
global boards_dir |
1256 |
global board_type; |
global board_type |
1257 |
|
|
1258 |
if [info exists board] { |
if [info exists board] { |
1259 |
if ![info exists board_info($board,generic_name)] { |
if ![info exists board_info($board,generic_name)] { |
1260 |
set board_info($board,generic_name) $name; |
set board_info($board,generic_name) $name |
1261 |
} |
} |
1262 |
} |
} |
1263 |
|
|
1264 |
if [info exists board_type] { |
if [info exists board_type] { |
1265 |
set type "for $board_type"; |
set type "for $board_type" |
1266 |
} else { |
} else { |
1267 |
set type "" |
set type "" |
1268 |
} |
} |
1269 |
|
|
1270 |
set dirlist [concat ${libdir}/config [file dirname $libdir]/config $boards_dir]; |
set dirlist [concat ${libdir}/config [file dirname $libdir]/config $boards_dir] |
1271 |
set result [search_and_load_file "generic interface file $type" ${name}.exp $dirlist]; |
set result [search_and_load_file "generic interface file $type" ${name}.exp $dirlist] |
1272 |
|
|
1273 |
return $result; |
return $result |
1274 |
} |
} |
1275 |
|
|
1276 |
# |
# |
1277 |
# Load the tool-specific target description. |
# Load the tool-specific target description. |
1278 |
# |
# |
1279 |
proc load_config { args } { |
proc load_config { args } { |
1280 |
global srcdir; |
global srcdir |
1281 |
global board_type; |
global board_type |
1282 |
|
|
1283 |
set found 0; |
set found 0 |
1284 |
|
|
1285 |
return [search_and_load_file "tool-and-target-specific interface file" $args [list ${srcdir}/config ${srcdir}/../config ${srcdir}/../../config ${srcdir}/../../../config]]; |
return [search_and_load_file "tool-and-target-specific interface file" $args [list ${srcdir}/config ${srcdir}/../config ${srcdir}/../../config ${srcdir}/../../../config]] |
1286 |
} |
} |
1287 |
|
|
1288 |
# |
# |
1304 |
proc load_tool_target_config { name } { |
proc load_tool_target_config { name } { |
1305 |
global target_os libdir srcdir |
global target_os libdir srcdir |
1306 |
|
|
1307 |
set found [load_config "${name}.exp" "${target_os}.exp" "default.exp" "unknown.exp"]; |
set found [load_config "${name}.exp" "${target_os}.exp" "default.exp" "unknown.exp"] |
1308 |
|
|
1309 |
if { $found == 0 } { |
if { $found == 0 } { |
1310 |
send_error "WARNING: Couldn't find tool config file for $name, using default.\n" |
send_error "WARNING: Couldn't find tool config file for $name, using default.\n" |
1322 |
# |
# |
1323 |
|
|
1324 |
proc load_board_description { board_name args } { |
proc load_board_description { board_name args } { |
1325 |
global srcdir; |
global srcdir |
1326 |
global configfile; |
global configfile |
1327 |
global libdir; |
global libdir |
1328 |
global env; |
global env |
1329 |
global board; |
global board |
1330 |
global board_info |
global board_info |
1331 |
global boards_dir; |
global boards_dir |
1332 |
global board_type; |
global board_type |
1333 |
|
|
1334 |
set dejagnu "" |
set dejagnu "" |
1335 |
|
|
1336 |
if { [llength $args] > 0 } { |
if { [llength $args] > 0 } { |
1337 |
set whole_name [lindex $args 0]; |
set whole_name [lindex $args 0] |
1338 |
} else { |
} else { |
1339 |
set whole_name $board_name; |
set whole_name $board_name |
1340 |
} |
} |
1341 |
|
|
1342 |
set board_info($whole_name,name) $whole_name; |
set board_info($whole_name,name) $whole_name |
1343 |
if ![info exists board] { |
if ![info exists board] { |
1344 |
set board $whole_name; |
set board $whole_name |
1345 |
set board_set 1; |
set board_set 1 |
1346 |
} else { |
} else { |
1347 |
set board_set 0; |
set board_set 0 |
1348 |
} |
} |
1349 |
|
|
1350 |
set dirlist {}; |
set dirlist {} |
1351 |
if { [llength $args] > 1 } { |
if { [llength $args] > 1 } { |
1352 |
set suffix [lindex $args 1]; |
set suffix [lindex $args 1] |
1353 |
if { ${suffix} != "" } { |
if { ${suffix} != "" } { |
1354 |
foreach x ${boards_dir} { |
foreach x ${boards_dir} { |
1355 |
lappend dirlist ${x}/${suffix} |
lappend dirlist ${x}/${suffix} |
1356 |
} |
} |
1357 |
lappend dirlist ${libdir}/baseboards/${suffix}; |
lappend dirlist ${libdir}/baseboards/${suffix} |
1358 |
} |
} |
1359 |
} |
} |
1360 |
set dirlist [concat $dirlist $boards_dir]; |
set dirlist [concat $dirlist $boards_dir] |
1361 |
lappend dirlist ${libdir}/baseboards; |
lappend dirlist ${libdir}/baseboards |
1362 |
verbose "dirlist is $dirlist" |
verbose "dirlist is $dirlist" |
1363 |
if [info exists board_type] { |
if [info exists board_type] { |
1364 |
set type "for $board_type"; |
set type "for $board_type" |
1365 |
} else { |
} else { |
1366 |
set type ""; |
set type "" |
1367 |
} |
} |
1368 |
if ![info exists board_info($whole_name,isremote)] { |
if ![info exists board_info($whole_name,isremote)] { |
1369 |
set board_info($whole_name,isremote) 1; |
set board_info($whole_name,isremote) 1 |
1370 |
if [info exists board_type] { |
if [info exists board_type] { |
1371 |
if { $board_type == "build" } { |
if { $board_type == "build" } { |
1372 |
set board_info($whole_name,isremote) 0; |
set board_info($whole_name,isremote) 0 |
1373 |
} |
} |
1374 |
} |
} |
1375 |
if { ${board_name} == [get_local_hostname] } { |
if { ${board_name} == [get_local_hostname] } { |
1376 |
set board_info($whole_name,isremote) 0; |
set board_info($whole_name,isremote) 0 |
1377 |
} |
} |
1378 |
} |
} |
1379 |
search_and_load_file "standard board description file $type" standard.exp $dirlist; |
search_and_load_file "standard board description file $type" standard.exp $dirlist |
1380 |
set found [search_and_load_file "board description file $type" ${board_name}.exp $dirlist]; |
set found [search_and_load_file "board description file $type" ${board_name}.exp $dirlist] |
1381 |
if { $board_set != 0 } { |
if { $board_set != 0 } { |
1382 |
unset board; |
unset board |
1383 |
} |
} |
1384 |
|
|
1385 |
return $found; |
return $found |
1386 |
} |
} |
1387 |
|
|
1388 |
# |
# |
1391 |
# |
# |
1392 |
|
|
1393 |
proc load_base_board_description { board_name } { |
proc load_base_board_description { board_name } { |
1394 |
global srcdir; |
global srcdir |
1395 |
global configfile; |
global configfile |
1396 |
global libdir; |
global libdir |
1397 |
global env; |
global env |
1398 |
global board; |
global board |
1399 |
global board_info |
global board_info |
1400 |
global board_type; |
global board_type |
1401 |
|
|
1402 |
set board_set 0; |
set board_set 0 |
1403 |
set board_info($board_name,name) $board_name; |
set board_info($board_name,name) $board_name |
1404 |
if ![info exists board] { |
if ![info exists board] { |
1405 |
set board $board_name; |
set board $board_name |
1406 |
set board_set 1; |
set board_set 1 |
1407 |
} |
} |
1408 |
if [info exists board_type] { |
if [info exists board_type] { |
1409 |
set type "for $board_type"; |
set type "for $board_type" |
1410 |
} else { |
} else { |
1411 |
set type "" |
set type "" |
1412 |
}; |
} |
1413 |
if ![info exists board_info($board_name,isremote)] { |
if ![info exists board_info($board_name,isremote)] { |
1414 |
set board_info($board_name,isremote) 1; |
set board_info($board_name,isremote) 1 |
1415 |
if [info exists board_type] { |
if [info exists board_type] { |
1416 |
if { $board_type == "build" } { |
if { $board_type == "build" } { |
1417 |
set board_info($board_name,isremote) 0; |
set board_info($board_name,isremote) 0 |
1418 |
} |
} |
1419 |
} |
} |
1420 |
} |
} |
1421 |
|
|
1422 |
if { ${board_name} == [get_local_hostname] } { |
if { ${board_name} == [get_local_hostname] } { |
1423 |
set board_info($board_name,isremote) 0; |
set board_info($board_name,isremote) 0 |
1424 |
} |
} |
1425 |
set found [search_and_load_file "board description file $type" ${board_name}.exp ${libdir}/baseboards]; |
set found [search_and_load_file "board description file $type" ${board_name}.exp ${libdir}/baseboards] |
1426 |
if { $board_set != 0 } { |
if { $board_set != 0 } { |
1427 |
unset board; |
unset board |
1428 |
} |
} |
1429 |
|
|
1430 |
return $found; |
return $found |
1431 |
} |
} |
1432 |
|
|
1433 |
# |
# |
1448 |
set test_result "" |
set test_result "" |
1449 |
|
|
1450 |
if [file exists $test_file_name] { |
if [file exists $test_file_name] { |
1451 |
set timestart [timestamp]; |
set timestart [timestamp] |
1452 |
|
|
1453 |
if [info exists tool] { |
if [info exists tool] { |
1454 |
if { [info procs "${tool}_init"] != "" } { |
if { [info procs "${tool}_init"] != "" } { |
1455 |
${tool}_init $test_file_name; |
${tool}_init $test_file_name |
1456 |
} |
} |
1457 |
} |
} |
1458 |
|
|
1477 |
|
|
1478 |
if [info exists tool] { |
if [info exists tool] { |
1479 |
if { [info procs "${tool}_finish"] != "" } { |
if { [info procs "${tool}_finish"] != "" } { |
1480 |
${tool}_finish; |
${tool}_finish |
1481 |
} |
} |
1482 |
} |
} |
1483 |
set timeend [timestamp]; |
set timeend [timestamp] |
1484 |
set timediff [expr $timeend - $timestart]; |
set timediff [expr $timeend - $timestart] |
1485 |
verbose -log "testcase $test_file_name completed in $timediff seconds" 4 |
verbose -log "testcase $test_file_name completed in $timediff seconds" 4 |
1486 |
} else { |
} else { |
1487 |
# This should never happen, but maybe if the file got removed |
# This should never happen, but maybe if the file got removed |
1505 |
{SIGINT {interrupted by user}} \ |
{SIGINT {interrupted by user}} \ |
1506 |
{SIGQUIT {interrupted by user}} \ |
{SIGQUIT {interrupted by user}} \ |
1507 |
{SIGSEGV {segmentation violation}}" { |
{SIGSEGV {segmentation violation}}" { |
1508 |
set signal [lindex $sig 0]; |
set signal [lindex $sig 0] |
1509 |
set str [lindex $sig 1]; |
set str [lindex $sig 1] |
1510 |
trap "send_error \"got a \[trap -name\] signal, $str \\n\"; log_and_exit;" $signal; |
trap "send_error \"got a \[trap -name\] signal, $str \\n\"; log_and_exit;" $signal |
1511 |
verbose "setting trap for $signal to $str" 1 |
verbose "setting trap for $signal to $str" 1 |
1512 |
} |
} |
1513 |
unset signal str sig; |
unset signal str sig |
1514 |
} |
} |
1515 |
|
|
1516 |
# |
# |
1517 |
# Given a list of targets, process any iterative lists. |
# Given a list of targets, process any iterative lists. |
1518 |
# |
# |
1519 |
proc process_target_variants { target_list } { |
proc process_target_variants { target_list } { |
1520 |
set result {}; |
set result {} |
1521 |
foreach x $target_list { |
foreach x $target_list { |
1522 |
if [regexp "\\(" $x] { |
if [regexp "\\(" $x] { |
1523 |
regsub "^.*\\((\[^()\]*)\\)$" "$x" "\\1" variant_list; |
regsub "^.*\\((\[^()\]*)\\)$" "$x" "\\1" variant_list |
1524 |
regsub "\\(\[^(\]*$" "$x" "" x; |
regsub "\\(\[^(\]*$" "$x" "" x |
1525 |
set list [process_target_variants $x]; |
set list [process_target_variants $x] |
1526 |
set result {} |
set result {} |
1527 |
foreach x $list { |
foreach x $list { |
1528 |
set result [concat $result [iterate_target_variants $x [split $variant_list ","]]]; |
set result [concat $result [iterate_target_variants $x [split $variant_list ","]]] |
1529 |
} |
} |
1530 |
} elseif [regexp "\{" $x] { |
} elseif [regexp "\{" $x] { |
1531 |
regsub "^.*\{(\[^\{\}\]*)\}$" "$x" "\\1" variant_list; |
regsub "^.*\{(\[^\{\}\]*)\}$" "$x" "\\1" variant_list |
1532 |
regsub "\{\[^\{\]*$" "$x" "" x; |
regsub "\{\[^\{\]*$" "$x" "" x |
1533 |
set list [process_target_variants $x]; |
set list [process_target_variants $x] |
1534 |
foreach x $list { |
foreach x $list { |
1535 |
foreach i [split $variant_list ","] { |
foreach i [split $variant_list ","] { |
1536 |
set name $x; |
set name $x |
1537 |
if { $i != "" } { |
if { $i != "" } { |
1538 |
append name "/" $i; |
append name "/" $i |
1539 |
} |
} |
1540 |
lappend result $name; |
lappend result $name |
1541 |
} |
} |
1542 |
} |
} |
1543 |
} else { |
} else { |
1544 |
lappend result "$x"; |
lappend result "$x" |
1545 |
} |
} |
1546 |
} |
} |
1547 |
return $result; |
return $result |
1548 |
} |
} |
1549 |
|
|
1550 |
proc iterate_target_variants { target variants } { |
proc iterate_target_variants { target variants } { |
1551 |
return [iterate_target_variants_two $target $target $variants]; |
return [iterate_target_variants_two $target $target $variants] |
1552 |
} |
} |
1553 |
|
|
1554 |
# |
# |
1557 |
proc iterate_target_variants_two { orig_target target variants } { |
proc iterate_target_variants_two { orig_target target variants } { |
1558 |
|
|
1559 |
if { [llength $variants] == 0 } { |
if { [llength $variants] == 0 } { |
1560 |
return [list $target]; |
return [list $target] |
1561 |
} else { |
} else { |
1562 |
if { [llength $variants] > 1 } { |
if { [llength $variants] > 1 } { |
1563 |
set result [iterate_target_variants_two $orig_target $target [lrange $variants 1 end]]; |
set result [iterate_target_variants_two $orig_target $target [lrange $variants 1 end]] |
1564 |
} else { |
} else { |
1565 |
if { $target != $orig_target } { |
if { $target != $orig_target } { |
1566 |
set result [list $target]; |
set result [list $target] |
1567 |
} else { |
} else { |
1568 |
set result {}; |
set result {} |
1569 |
} |
} |
1570 |
} |
} |
1571 |
if { [lindex $variants 0] != "" } { |
if { [lindex $variants 0] != "" } { |
1572 |
append target "/" [lindex $variants 0]; |
append target "/" [lindex $variants 0] |
1573 |
return [concat $result [iterate_target_variants_two $orig_target $target [lrange $variants 1 end]]]; |
return [concat $result [iterate_target_variants_two $orig_target $target [lrange $variants 1 end]]] |
1574 |
} else { |
} else { |
1575 |
return [concat $result $target]; |
return [concat $result $target] |
1576 |
} |
} |
1577 |
} |
} |
1578 |
} |
} |
1579 |
|
|
1580 |
setup_build_hook [get_local_hostname]; |
setup_build_hook [get_local_hostname] |
1581 |
|
|
1582 |
if [info exists host_board] { |
if [info exists host_board] { |
1583 |
setup_host_hook $host_board; |
setup_host_hook $host_board |
1584 |
} else { |
} else { |
1585 |
set hb [get_local_hostname]; |
set hb [get_local_hostname] |
1586 |
if { $hb != "" } { |
if { $hb != "" } { |
1587 |
setup_host_hook $hb; |
setup_host_hook $hb |
1588 |
} |
} |
1589 |
} |
} |
1590 |
|
|
1609 |
# |
# |
1610 |
# Iterate through the list of targets. |
# Iterate through the list of targets. |
1611 |
# |
# |
1612 |
global current_target; |
global current_target |
1613 |
|
|
1614 |
set target_list [process_target_variants $target_list]; |
set target_list [process_target_variants $target_list] |
1615 |
|
|
1616 |
set target_count [llength $target_list] |
set target_count [llength $target_list] |
1617 |
|
|
1623 |
|
|
1624 |
|
|
1625 |
foreach current_target $target_list { |
foreach current_target $target_list { |
1626 |
verbose "target is $current_target"; |
verbose "target is $current_target" |
1627 |
set current_target_name $current_target; |
set current_target_name $current_target |
1628 |
set tlist [split $current_target /]; |
set tlist [split $current_target /] |
1629 |
set current_target [lindex $tlist 0]; |
set current_target [lindex $tlist 0] |
1630 |
set board_variant_list [lrange $tlist 1 end]; |
set board_variant_list [lrange $tlist 1 end] |
1631 |
|
|
1632 |
# Set the counts for this target to 0. |
# Set the counts for this target to 0. |
1633 |
reset_vars; |
reset_vars |
1634 |
clone_output "Running target $current_target_name" |
clone_output "Running target $current_target_name" |
1635 |
|
|
1636 |
setup_target_hook $current_target_name $current_target; |
setup_target_hook $current_target_name $current_target |
1637 |
|
|
1638 |
# If multiple passes requested, set them up. Otherwise prepare just one. |
# If multiple passes requested, set them up. Otherwise prepare just one. |
1639 |
# The format of `MULTIPASS' is a list of elements containing |
# The format of `MULTIPASS' is a list of elements containing |
1665 |
set multipass_name [lindex $multipass_elem 0] |
set multipass_name [lindex $multipass_elem 0] |
1666 |
if {$p == $multipass_name} { |
if {$p == $multipass_name} { |
1667 |
lappend passes $multipass_elem |
lappend passes $multipass_elem |
1668 |
break; |
break |
1669 |
} |
} |
1670 |
} |
} |
1671 |
} |
} |
1709 |
# DejaGNU's notion of test tree and test files is very |
# DejaGNU's notion of test tree and test files is very |
1710 |
# general: |
# general: |
1711 |
# given ${srcdir} and ${tool}, any subdirectory (at any |
# given ${srcdir} and ${tool}, any subdirectory (at any |
1712 |
# level deep) with the "${tool}" prefix starts a test tree; |
# level deep) with the "${tool}" prefix starts a test tree |
1713 |
# given a test tree, any *.exp file underneath (at any |
# given a test tree, any *.exp file underneath (at any |
1714 |
# level deep) is a test file. |
# level deep) is a test file. |
1715 |
# |
# |
1749 |
set test_top_dirs ${temp_top_dirs} |
set test_top_dirs ${temp_top_dirs} |
1750 |
} |
} |
1751 |
verbose "Top level testsuite dirs are ${test_top_dirs}" 2 |
verbose "Top level testsuite dirs are ${test_top_dirs}" 2 |
1752 |
set testlist ""; |
set testlist "" |
1753 |
if [info exists all_runtests] { |
if [info exists all_runtests] { |
1754 |
foreach x [array names all_runtests] { |
foreach x [array names all_runtests] { |
1755 |
verbose "trying to glob ${srcdir}/${x}" 2 |
verbose "trying to glob ${srcdir}/${x}" 2 |
1756 |
set s [glob -nocomplain ${srcdir}/$x]; |
set s [glob -nocomplain ${srcdir}/$x] |
1757 |
if { $s != "" } { |
if { $s != "" } { |
1758 |
set testlist [concat $testlist $s]; |
set testlist [concat $testlist $s] |
1759 |
} |
} |
1760 |
} |
} |
1761 |
} |
} |
1779 |
incr p -1 |
incr p -1 |
1780 |
} |
} |
1781 |
if {[string range $subdir 0 $p] == $srcdir} { |
if {[string range $subdir 0 $p] == $srcdir} { |
1782 |
set subdir [string range $subdir [expr $p+1] end]; |
set subdir [string range $subdir [expr $p+1] end] |
1783 |
regsub "^/" $subdir "" subdir |
regsub "^/" $subdir "" subdir |
1784 |
} |
} |
1785 |
|
|
1786 |
# XXX not the right thing to do. |
# XXX not the right thing to do. |
1787 |
set runtests [list [file tail $test_name] ""] |
set runtests [list [file tail $test_name] ""] |
1788 |
|
|
1789 |
runtest $test_name; |
runtest $test_name |
1790 |
} |
} |
1791 |
} else { |
} else { |
1792 |
# |
# |
1866 |
# characters? We lose. Instead... |
# characters? We lose. Instead... |
1867 |
set first [string first $srcdir $subdir] |
set first [string first $srcdir $subdir] |
1868 |
if { $first >= 0 } { |
if { $first >= 0 } { |
1869 |
set first [expr $first + [string length $srcdir]]; |
set first [expr $first + [string length $srcdir]] |
1870 |
set subdir [string range $subdir $first end]; |
set subdir [string range $subdir $first end] |
1871 |
regsub "^/" "$subdir" "" subdir; |
regsub "^/" "$subdir" "" subdir |
1872 |
} |
} |
1873 |
if { "$srcdir" == "$subdir" || "$srcdir" == "$subdir/" } { |
if { "$srcdir" == "$subdir" || "$srcdir" == "$subdir/" } { |
1874 |
set subdir "" |
set subdir "" |
1887 |
} else { |
} else { |
1888 |
set runtests [list [file tail $test_name] ""] |
set runtests [list [file tail $test_name] ""] |
1889 |
} |
} |
1890 |
runtest $test_name; |
runtest $test_name |
1891 |
} |
} |
1892 |
} |
} |
1893 |
} |
} |
1894 |
# Restore the variables set by this pass. |
# Restore the variables set by this pass. |
1895 |
foreach varval $restore { |
foreach varval $restore { |
1896 |
if { [llength $varval] > 1 } { |
if { [llength $varval] > 1 } { |
1897 |
verbose "Restoring [lindex $varval 0] to [lindex $varval 1]" 4; |
verbose "Restoring [lindex $varval 0] to [lindex $varval 1]" 4 |
1898 |
set [lindex $varval 0] [lindex $varval 1]; |
set [lindex $varval 0] [lindex $varval 1] |
1899 |
} else { |
} else { |
1900 |
verbose "Restoring [lindex $varval 0] to `unset'" 4; |
verbose "Restoring [lindex $varval 0] to `unset'" 4 |
1901 |
unset [lindex $varval 0]; |
unset [lindex $varval 0] |
1902 |
} |
} |
1903 |
} |
} |
1904 |
} |
} |
1905 |
} |
} |
1906 |
cleanup_target_hook $current_target; |
cleanup_target_hook $current_target |
1907 |
if { $target_count > 1 } { |
if { $target_count > 1 } { |
1908 |
log_summary; |
log_summary |
1909 |
} |
} |
1910 |
} |
} |
1911 |
|
|
1912 |
log_and_exit; |
log_and_exit |