tf_fuzz: refactor expected value storage and simulation flow
Refactor the storage of expected values (expected_info), and add a
simulate function to psa_call, allowing expected value modelling and
call simulation code to be eventually combined into a single method.
* expected_info currently uses a set of mutually-exclusive boolean flags
to model the different possible return codes. As the flags are checked
in different orders across the code-base, failing to unset the right
flags could cause different areas of the code to use different
expected values.
In this commit, an enum is used instead. This allows expected result
checking to be performed by a single switch statement. This also makes
checking to see if the value needs to be simulated much clearer --
currently, this is denoted by both pf_nothing and pf_pass being false.
* Remove expected_info fields with no use.
* There is no one place where call simulation and expected error code
modelling occurs. Expected return code modelling currently occur in
fill_in_command and calc_result_code, and call simulation in
copy_call_to_asset.
The new psa_call::simulate() method is intended as the singular home
for all call simulation code. Combining the simulation of a call's
actions and its expected result should make modelling easier. This
also makes expected value modelling happen in the simulation step
only instead of in both the simulation and code-generation steps
(fill_in_command and calc_result_code are code generation methods).
Due to upcoming changes to the crypto simulation, moving call
simulation code to simulate() has been left for future commits.
Change-Id: I1173164f07a3615c157845ed3abfebefde675c89
Signed-off-by: Nik Dewally <Nik.Dewally@arm.com>
11 files changed