Hello,
in order to keep all users informed, it's possible to match an end of line with "\r\n" as explained in https://pexpect.readthedocs.io/en/stable/overview.html#find-the-end-of-line-...
See an example at https://staging.validation.linaro.org/scheduler/job/219794/definition#deflin...
Regards
2018-05-15 10:25 GMT+02:00 Chase Qi chase.qi@linaro.org:
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/ques tions/14689531/how-to-match-a-new-line-character-in-python-raw-string . Then I tried manually in python shell. '(?P<result>(PASS|FAIL))\s-\s(?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=========== ========================================================\nstarting test - test_poll_wait\nPASS - test_poll_wait\n============== =====================================================\nstarting 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