From: Mike Frysinger Date: Sun, 21 Nov 2021 03:46:52 +0000 (-0500) Subject: sim: v850: fix cpu_option testsuite handling X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bbda248c504815990c07c8a9c411ae6c124d7c4b;p=binutils-gdb.git sim: v850: fix cpu_option testsuite handling The v850 testsuite code has been testing the $opt variable, but this was never actually set anywhere globally or v850-specific. Instead, this was a random variable leaking out of the sh testsuite code. As far as I can tell, it has always been this way. That means the code only ever tested the v850 cpu target (which is the default). This failure can be easily seen in practice by running the v850 code in isolation and seeing it crash: $ runtest v850/allinsns.exp ... Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using ../../../sim/testsuite/config/default.exp as tool-and-target-specific interface file. WARNING: Assuming target board is the local machine (which is probably wrong). You may need to set your DEJAGNU environment variable. Running ../../../sim/testsuite/v850/allinsns.exp ... ERROR: tcl error sourcing ../../../sim/testsuite/v850/allinsns.exp. ERROR: tcl error code TCL LOOKUP VARNAME opt ERROR: can't read "opt": no such variable while executing "switch -regexp -- $opt { Backing up a bit, the reason for this logic in the first place is because the common sim testsuite code makes an assumption about the assembler options with cpu_option -- the option and its value are always separated by an =. This is not the case with v850. So tweak the core sim logic a bit to support omitting the = so that we can switch v850 to the standard all_machs setting and avoid opt entirely. --- diff --git a/sim/testsuite/lib/sim-defs.exp b/sim/testsuite/lib/sim-defs.exp index 0ddc4d556ab..b3dff9e1a66 100644 --- a/sim/testsuite/lib/sim-defs.exp +++ b/sim/testsuite/lib/sim-defs.exp @@ -187,6 +187,7 @@ proc run_sim_test { name requested_machs } { global SIMFLAGS global opts global cpu_option + global cpu_option_sep global global_as_options global global_ld_options global global_cc_options @@ -323,7 +324,12 @@ proc run_sim_test { name requested_machs } { set as_options "$opts(as,$mach) -I$srcdir/$subdir" if [info exists cpu_option] { - set as_options "$as_options $cpu_option=$mach" + if ![info exists cpu_option_sep] { + set sep "=" + } { + set sep $cpu_option_sep + } + set as_options "$as_options $cpu_option$sep$mach" } regsub {(^ *| +)([^ ]+)} "$as_options $global_as_options" { -Wa,\2} c_as_options diff --git a/sim/testsuite/v850/allinsns.exp b/sim/testsuite/v850/allinsns.exp index 93dcffce2f3..2dc8d60bb9a 100644 --- a/sim/testsuite/v850/allinsns.exp +++ b/sim/testsuite/v850/allinsns.exp @@ -1,19 +1,14 @@ # v850 simulator testsuite. if [istarget v850*-*] { - global opt + # All machines. + # Should add more cpus if the testsuite adds coverage for their insns, but + # at the core level, there's no deviation beyond these two. + set all_machs "v850e v850" - # all machines - switch -regexp -- $opt { - .*v850e.* { - set all_machs "v850e" - } - default { - set all_machs "v850" - } - } # gas doesn't support any '=' option for v850. - #set cpu_option -m + set cpu_option_sep "" + set cpu_option -m # The .cgs suffix is for "cgen .s". foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.cgs]] { @@ -24,12 +19,6 @@ if [istarget v850*-*] { } run_sim_test $src $all_machs } -} -#foreach var [lsort [info globals]] { -# if [array exists ::$var] { -# puts [format "%-27s %s" $var Array:] -# continue -# } -# puts [format "%-30s %s" $var "[set ::$var]"] -#} + unset cpu_option cpu_option_sep +}