Tests: 'extract_hftest_lines' cope with boot logs
SPMC can boot other SPs that are deployed to provide test services,
before the partition controlling execution of tests.
The method 'extract_hftest_lines' from hftest.py was extracting logs
based on string 'VM <id>', and would fail if a partition that booted
first printed logs before the partition controlling the execution of
tests. This changes copes with such situation, by limiting log
extraction to logs between "[hftest_ctrl:get_command_line]" and
"[hftest_ctrl:finished]".
Change-Id: I264a5ea636594d960d636f8b57639a6d365e3502
Signed-off-by: J-Alves <joao.alves@arm.com>
diff --git a/test/hftest/hftest.py b/test/hftest/hftest.py
index c63c2d1..fde1bd8 100755
--- a/test/hftest/hftest.py
+++ b/test/hftest/hftest.py
@@ -605,7 +605,21 @@
"""Extract hftest-specific lines from a raw output from an invocation
of the test platform."""
lines = []
- for line in raw.splitlines():
+ lines_to_process = raw.splitlines()
+
+ try:
+ # If logs have logs of more than one VM, the loop below to extract
+ # lines won't work. Thus, extracting between starting and ending
+ # logs: HFTEST_CTRL_GET_COMMAND_LINE and HFTEST_CTRL_FINISHED.
+ hftest_start = lines_to_process.index(HFTEST_CTRL_GET_COMMAND_LINE) + 1
+ hftest_end = lines_to_process.index(HFTEST_CTRL_FINISHED)
+ except ValueError:
+ hftest_start = 0
+ hftest_end = len(lines_to_process)
+
+ lines_to_process = lines_to_process[hftest_start : hftest_end]
+
+ for line in lines_to_process:
match = re.search(f"^VM \d+: ", line)
if match is not None:
line = line[match.end():]