These were introduced in the avocado tests to workaround read issues
when interacting with console. They are no longer necessary and we can
use the expected "login:" string now.
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
tests/functional/test_arm_aspeed.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
index 7644ecbae750..2c9009f686fd 100755
--- a/tests/functional/test_arm_aspeed.py
+++ b/tests/functional/test_arm_aspeed.py
@@ -136,10 +136,8 @@ def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern='Aspeed EVB'
self.wait_for_console_pattern('lease of 10.0.2.15')
# the line before login:
self.wait_for_console_pattern(pattern)
- time.sleep(0.1)
- exec_command(self, 'root')
- time.sleep(0.1)
- exec_command(self, "passw0rd")
+ exec_command_and_wait_for_pattern(self, 'root', 'Password:')
+ exec_command_and_wait_for_pattern(self, 'passw0rd', '#')
def do_test_arm_aspeed_buildroot_poweroff(self):
exec_command_and_wait_for_pattern(self, 'poweroff',
@@ -158,7 +156,7 @@ def test_arm_ast2500_evb_buildroot(self):
self.vm.add_args('-device',
'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
- 'Aspeed AST2500 EVB')
+ 'ast2500-evb login:')
exec_command_and_wait_for_pattern(self,
'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
@@ -188,7 +186,8 @@ def test_arm_ast2600_evb_buildroot(self):
'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
self.vm.add_args('-device',
'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
- self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00', 'Aspeed AST2600 EVB')
+ self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00',
+ 'ast2600-evb login:')
exec_command_and_wait_for_pattern(self,
'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
@@ -210,7 +209,6 @@ def test_arm_ast2600_evb_buildroot(self):
'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
- time.sleep(0.1)
exec_command_and_wait_for_pattern(self,
'hexdump /sys/bus/i2c/devices/3-1064/slave-eeprom',
'0000000 ffaa ffff ffff ffff ffff ffff ffff ffff');
--
2.47.0
On 12/11/2024 14.02, Cédric Le Goater wrote:
> These were introduced in the avocado tests to workaround read issues
> when interacting with console. They are no longer necessary and we can
> use the expected "login:" string now.
>
> Signed-off-by: Cédric Le Goater <clg@redhat.com>
> ---
> tests/functional/test_arm_aspeed.py | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
> index 7644ecbae750..2c9009f686fd 100755
> --- a/tests/functional/test_arm_aspeed.py
> +++ b/tests/functional/test_arm_aspeed.py
> @@ -136,10 +136,8 @@ def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern='Aspeed EVB'
> self.wait_for_console_pattern('lease of 10.0.2.15')
> # the line before login:
> self.wait_for_console_pattern(pattern)
> - time.sleep(0.1)
> - exec_command(self, 'root')
> - time.sleep(0.1)
> - exec_command(self, "passw0rd")
> + exec_command_and_wait_for_pattern(self, 'root', 'Password:')
> + exec_command_and_wait_for_pattern(self, 'passw0rd', '#')
>
> def do_test_arm_aspeed_buildroot_poweroff(self):
> exec_command_and_wait_for_pattern(self, 'poweroff',
> @@ -158,7 +156,7 @@ def test_arm_ast2500_evb_buildroot(self):
> self.vm.add_args('-device',
> 'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
> self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
> - 'Aspeed AST2500 EVB')
> + 'ast2500-evb login:')
>
> exec_command_and_wait_for_pattern(self,
> 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
> @@ -188,7 +186,8 @@ def test_arm_ast2600_evb_buildroot(self):
> 'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
> self.vm.add_args('-device',
> 'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
> - self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00', 'Aspeed AST2600 EVB')
> + self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00',
> + 'ast2600-evb login:')
>
> exec_command_and_wait_for_pattern(self,
> 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
> @@ -210,7 +209,6 @@ def test_arm_ast2600_evb_buildroot(self):
> 'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
> 'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
> exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
Could we please wait for the shell prompt here now? i.e.:
exec_command_and_wait_for_pattern(self,
'i2cset -y 3 0x42 0x64 0x00 0xaa i', '#')
or something similar?
With such a fix included:
Reviewed-by: Thomas Huth <thuth@redhat.com>
> - time.sleep(0.1)
> exec_command_and_wait_for_pattern(self,
> 'hexdump /sys/bus/i2c/devices/3-1064/slave-eeprom',
> '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff');
On 11/12/24 14:36, Thomas Huth wrote:
> On 12/11/2024 14.02, Cédric Le Goater wrote:
>> These were introduced in the avocado tests to workaround read issues
>> when interacting with console. They are no longer necessary and we can
>> use the expected "login:" string now.
>>
>> Signed-off-by: Cédric Le Goater <clg@redhat.com>
>> ---
>> tests/functional/test_arm_aspeed.py | 12 +++++-------
>> 1 file changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/tests/functional/test_arm_aspeed.py b/tests/functional/test_arm_aspeed.py
>> index 7644ecbae750..2c9009f686fd 100755
>> --- a/tests/functional/test_arm_aspeed.py
>> +++ b/tests/functional/test_arm_aspeed.py
>> @@ -136,10 +136,8 @@ def do_test_arm_aspeed_buildroot_start(self, image, cpu_id, pattern='Aspeed EVB'
>> self.wait_for_console_pattern('lease of 10.0.2.15')
>> # the line before login:
>> self.wait_for_console_pattern(pattern)
>> - time.sleep(0.1)
>> - exec_command(self, 'root')
>> - time.sleep(0.1)
>> - exec_command(self, "passw0rd")
>> + exec_command_and_wait_for_pattern(self, 'root', 'Password:')
>> + exec_command_and_wait_for_pattern(self, 'passw0rd', '#')
>> def do_test_arm_aspeed_buildroot_poweroff(self):
>> exec_command_and_wait_for_pattern(self, 'poweroff',
>> @@ -158,7 +156,7 @@ def test_arm_ast2500_evb_buildroot(self):
>> self.vm.add_args('-device',
>> 'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
>> self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
>> - 'Aspeed AST2500 EVB')
>> + 'ast2500-evb login:')
>> exec_command_and_wait_for_pattern(self,
>> 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
>> @@ -188,7 +186,8 @@ def test_arm_ast2600_evb_buildroot(self):
>> 'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
>> self.vm.add_args('-device',
>> 'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
>> - self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00', 'Aspeed AST2600 EVB')
>> + self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00',
>> + 'ast2600-evb login:')
>> exec_command_and_wait_for_pattern(self,
>> 'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
>> @@ -210,7 +209,6 @@ def test_arm_ast2600_evb_buildroot(self):
>> 'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
>> 'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
>> exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
>
> Could we please wait for the shell prompt here now? i.e.:
>
> exec_command_and_wait_for_pattern(self,
> 'i2cset -y 3 0x42 0x64 0x00 0xaa i', '#')
>
> or something similar?
Done and that's the last use of exec_command() in this file.
> With such a fix included:
> Reviewed-by: Thomas Huth <thuth@redhat.com>
Thanks,
C.
© 2016 - 2026 Red Hat, Inc.