Hi,
To match the result lines in the following log from zephyr sanity test:
— output —
***** Booting Zephyr OS v1.11.0-1194-g4b0b65c1b *****
Running test suite poll_api
============================================================ =======
starting test - test_poll_no_wait
PASS - test_poll_no_wait
============================================================ =======
starting test - test_poll_wait
PASS - test_poll_wait
============================================================ =======
starting test - test_poll_multi
PASS - test_poll_multi
============================================================ =======
============================================================ =======
— output ends —
I started with this pattern: '(?P<result>(PASS|FAIL))\s-\s(?P<test_case_id>\w+)', but the test_case_ids it matched are incomplete, shown as below. Refer to https://validation.linaro.org/ scheduler/job/1807112
test_po
test_poll_
test_poll_mu
I also tried the following patterns, but no lucky.
'(?P<result>(PASS|FAIL))\s-\s(?P<test_case_id>\w+)$’ matched sth similar as above, but the not the same. Refer to https://validation.linaro.org/ scheduler/job/1807117
'(?P<result>(PASS|FAIL))\s-\s(?P<test_case_id>\w+)\n’ didn’t match anything.
A search online hit https://stackoverflow.com/questions/14689531/how-to-match-a- . Then I tried manually in python shell. '(?P<result>(PASS|FAIL))\s-\s(new-line-character-in-python- raw-string ?P<test_case_id>\w+)’ works, '(?P<result>(PASS|FAIL))\s-\s( ?P<test_case_id>\w+)$’ works only when re.M enabled.
— debug —
>>> s
"\nTrying ::1...\nConnected to localhost.\nEscape character is '^]'.\nFRDM-KW41Z-01 7113 [115200 N81]\n***** Booting Zephyr OS v1.11.0-1194-g4b0b65c1b *****\nRunning test suite poll_api\n================================================== =================\nstarting test - test_poll_no_wait\nPASS - test_poll_no_wait\n=========== ============================== ==========================\nst arting test - test_poll_wait\nPASS - test_poll_wait\n============== ============================== =======================\nstart ing test - test_poll_multi\nPASS - test_poll_multi\n============= ============================== ========================\n==== ============================== ============================== ===\n"
>>> p.search(s).group()
'PASS - test_poll_no_wait'
>>> p = re.compile(r'(?P<result>(PASS|FAIL))\s-\s(?P<test_case_id>\w +)$')
>>> p.search(s).group()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
>>> p = re.compile(r'(?P<result>(PASS|FAIL))\s-\s(?P<test_case_id>\w +)$', re.M)
>>> p.search(s).group()
'PASS - test_poll_no_wait’
— ends —
Could you please advise me how to handle the parsing with the monitor action?
Thanks,
Chase
_______________________________________________
Lava-users mailing list
Lava-users@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lava-users