binutils-gdb/sim/testsuite/lib
Hans-Peter Nilsson 3e6dc39ed7 sim/testsuite: Set global_cc_os also when no compiler is found
If we don't set this variable, it doesn't exist, and using "#progos:"
in an assembler-file will cause an error rather than just skipping the
test, viz:

Running /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp ...
ERROR: tcl error sourcing /src/sim/testsuite/cris/hw/rv-n-cris/rvc.exp.
ERROR: can't read "global_cc_os": no such variable
    while executing
"if { $opts(progos) != "" && $opts(progos) != $global_cc_os } {
	untested $subdir/$name
	return
    }"
    (procedure "run_sim_test" line 102)

Neither the commit introducing progos, nor the top comment
in run_sim_test, mentions progos as intended only for C
tests, or that its use must be gated on $global_cc_works !=
0, so (not) setting it in the no-working-compiler path seems
just overlooked.

Allowing it to be used for assembler tests makes it usable
for e.g. an always-false predicate and in expressions in
.exp files without gating on $global_cc_works != 0.

With this patch, global_cc_os is set to "", just as for "unknown OS".

    sim/testsuite:
	* lib/sim-defs.exp (sim_init_toolchain): Set global_cc_os also when
	no working target C compiler is found.
2022-02-14 23:50:29 +01:00
..
compilercheck.c sim: testsuite: unify basic C compiler checks 2021-11-26 19:51:15 -05:00
linuxcheck.c sim: testsuite: initial support for OS-specific tests 2021-11-26 20:06:55 -05:00
newlibcheck.c sim: testsuite: initial support for OS-specific tests 2021-11-26 20:06:55 -05:00
sim-defs.exp sim/testsuite: Set global_cc_os also when no compiler is found 2022-02-14 23:50:29 +01:00