feat(hftest): test conditional execution
The structure 'hftest_test' defines the entry for the
test table that is built with the help of the "TEST_*"
macros.
This patch adds a new field "precondition". It is a
pointer to a function that returns a boolean.
If a test is configured with a precondition function,
this precondition must be executed to determine if
test must be skipped or not, in the running
setup.
The "json" command in the PVM, dumps a structure
with the information of the tests linked in the image.
This patch changed the "json" command to include
a "skip_test" field, which is used by "hftest.py"
to determine if test should be skipped or not.
This is a useful functionality, as we are adding more
and more testing configurations, whilst attempting
to reuse the test code as much as possible.
The precondition function might look into aspects
such as:
- Security state of test services.
- Exception level of test services.
- Support to given features.
- etc
... before deciding if the test must be skipped
for its running test setup.
As the hafnium CI seems to take long to execute, and tests
using FVP are particularly slow, being able to skip tests
given certain conditions might be useful to save execution
time in hafnium CI runs.
Change-Id: I741aa484b08f224aff3394f949aa1096dcdfce4e
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index 22eb5f9..d95c0b1 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -780,7 +780,7 @@
test_xml.set("name", test["name"])
test_xml.set("classname", suite["name"])
- if self.skip_long_running_tests and test["is_long_running"]:
+ if (self.skip_long_running_tests and test["is_long_running"]) or test["skip_test"]:
print(" SKIP", test["name"])
test_xml.set("status", "notrun")
skipped_xml = ET.SubElement(test_xml, "skipped")