On Fri, 11 Nov 2022 at 14:58, Alex Bennée <[email protected]> wrote:
>
> This attempts to deal with the problem of login prompts not being
> guaranteed to be terminated with a newline. The solution to this is to
> peek at the incoming data looking to see if we see an up-coming match
> before we fall back to the old readline() logic. The reason to mostly
> rely on readline is because I am occasionally seeing the peek stalling
> despite data being there.
>
> This seems kinda hacky and gross so I'm open to alternative approaches
> and cleaner python code.
>
> Signed-off-by: Alex Bennée <[email protected]>
> Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
With this patch, the evb_sdk test fails:
Fetching asset from
./build/arm-clang/tests/avocado/machine_aspeed.py:AST2x00MachineSDK.test_arm_ast2500_evb_sdk
JOB ID : 542e050c4f7e1ddd6d5cdd350e4c26e1bdfcdee4
JOB LOG :
/home/petmay01/avocado/job-results/job-2022-11-14T16.21-542e050/job.log
(1/1)
./build/arm-clang/tests/avocado/machine_aspeed.py:AST2x00MachineSDK.test_arm_ast2500_evb_sdk:
ERROR: log() missing 1 required positional argument: 'msg' (82.57 s)
RESULTS : PASS 0 | ERROR 1 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0
| CANCEL 0
JOB TIME : 84.09 s
The avocado log reports a traceback where Python has thrown a
UnicodeDecodeError, and then subsequently an attempted debug
message in the error-handling path has a syntax error
("log() missing 1 required positional argument"):
2022-11-14 16:22:47,952 __init__ L0240 DEBUG| Stopping Host
logger for ttyVUART0...
2022-11-14 16:22:48,240 __init__ L0240 DEBUG| Starting Wait
for /xyz/ope…control/host0/boot/one_time...
2022-11-14 16:22:48,570 stacktrace L0039 ERROR|
2022-11-14 16:22:48,570 stacktrace L0041 ERROR| Reproduced
traceback from: /mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm
-clang/tests/venv/lib/python3.8/site-packages/avocado/core/test.py:770
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| Traceback (most
recent call last):
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/avocado_qemu/__init__.py", line 149, in _peek_ahead
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| peek_ahead =
console.peek(min_match).decode()
2022-11-14 16:22:48,572 stacktrace L0045 ERROR|
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position
44-45: unexpec
ted end of data
2022-11-14 16:22:48,572 stacktrace L0045 ERROR|
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| During handling
of the above exception, another exception occurred:
2022-11-14 16:22:48,572 stacktrace L0045 ERROR|
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| Traceback (most
recent call last):
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/venv/l
ib/python3.8/site-packages/avocado/core/decorators.py", line 90, in wrapper
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| return
function(obj, *args, **kwargs)
2022-11-14 16:22:48,572 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/machine_aspeed.py", line 225, in test_arm_ast2500_evb_sdk
2022-11-14 16:22:48,572 stacktrace L0045 ERROR|
self.wait_for_console_pattern('ast2500-default login:')
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/machine_aspeed.py", line 193, in wait_for_console_pattern
2022-11-14 16:22:48,573 stacktrace L0045 ERROR|
wait_for_console_pattern(self, success_message,
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/avocado_qemu/__init__.py", line 286, in wait_for_console_pattern
2022-11-14 16:22:48,573 stacktrace L0045 ERROR|
_console_interaction(test, success_message, failure_message, None,
vm=vm)
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/avocado_qemu/__init__.py", line 226, in _console_interaction
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| msg =
_peek_ahead(console, min_match, success_message)
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| File
"/mnt/nvmedisk/linaro/qemu-from-laptop/qemu/build/arm-clang/tests/avocad
o/avocado_qemu/__init__.py", line 180, in _peek_ahead
2022-11-14 16:22:48,573 stacktrace L0045 ERROR|
console_logger.log("error in decode of peek")
2022-11-14 16:22:48,573 stacktrace L0045 ERROR| TypeError: log()
missing 1 required positional argument: 'msg'
2022-11-14 16:22:48,573 stacktrace L0046 ERROR|
2022-11-14 16:22:48,573 test L0775 DEBUG| Local variables:
2022-11-14 16:22:48,605 test L0778 DEBUG| -> obj <class
'machine_aspeed.AST2x00MachineSDK'>:
1-./build/arm-clang/tests/avocado/machine_aspeed.py:AST2x00MachineSDK.test_arm_ast2500_evb_sdk
2022-11-14 16:22:48,605 test L0778 DEBUG| -> args <class
'tuple'>: ()
2022-11-14 16:22:48,605 test L0778 DEBUG| -> kwargs
<class 'dict'>: {}
2022-11-14 16:22:48,605 test L0778 DEBUG| -> condition
<class 'NoneType'>: None
2022-11-14 16:22:48,605 test L0778 DEBUG| -> function
<class 'function'>: <function
AST2x00MachineSDK.test_arm_ast2500_evb_sdk at 0x7f05ee0678b0>
2022-11-14 16:22:48,606 test L0778 DEBUG| -> message
<class 'str'>: Running on GitLab
2022-11-14 16:22:48,606 test L0778 DEBUG| -> negate
<class 'bool'>: False
thanks
-- PMM