sim/testsuite: Support "requires: simoption <--name-of-option>"
authorHans-Peter Nilsson <hp@axis.com>
Mon, 14 Feb 2022 22:50:48 +0000 (23:50 +0100)
committerHans-Peter Nilsson <hp@bitrange.com>
Mon, 14 Feb 2022 22:50:48 +0000 (23:50 +0100)
commit81064d7abc3c86cb93b12836eeaaf5a3fbce349e
tree794710802cf21bacedf2c94cb692a3d6752dde3d
parent46f238477f5e83cba9dc79d1e14c0f6acbeda37b
sim/testsuite: Support "requires: simoption <--name-of-option>"

Simulator features can be present or not, typically
depending on different-valued configure options, like
--enable-sim-hardware[=off|=on].  To avoid failures in
test-suite-runs when testing such configurations, a new
predicate is needed, as neither "target", "progos" nor
"mach" fits cleanly.

The immediate need was to check for presence of a simulator
option, but rather than a specialized "requires-simoption:"
predicate I thought I'd handle the general (parametrized)
need, so here's a generic predicate machinery and a (first)
predicate to use together with it; checking whether a
particular option is supported, by looking at "run --help"
output.  This was inspired by the check_effective_target_
machinery in the gcc test-suite.

Multiple "requires: <requirement> <parameter>" form a list of
predicates (with parameters), to be used as a conjunction.

sim/testsuite:
* lib/sim-defs.exp (sim_check_requires_simoption): New function.
(run_sim_test): Support "requires: <requirement> <parameter>".
sim/testsuite/lib/sim-defs.exp