Skip to contentSkip to conversation

tests/avocado: apply a band aid to aspeed-evb login

RFC PATCH In review Alex Bennée 3 participants 6 messages Aug 11, 2022 Arm/Aspeed machine support

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 tests/avocado: apply a band aid to aspeed-evb login

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>
---
 tests/avocado/machine_aspeed.py | 2 ++
 1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -0
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
         self.wait_for_console_pattern('Starting kernel ...')
         self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
         self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
         self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
         exec_command(self, 'root')
         time.sleep(0.1)
 
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alex Bennée

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>

May be you should also add the missing timeout setting ?

Anyhow,

Thanks,

C.

Quoted 18 lines
---
  tests/avocado/machine_aspeed.py | 2 ++
  1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -0
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
          self.wait_for_console_pattern('Starting kernel ...')
          self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
          self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
          self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
          exec_command(self, 'root')
          time.sleep(0.1)
 
#2 lore raw
Quoted 11 lines · Cédric Le Goater
Quoted 8 lines · Alex Bennée

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>
Quoted 1 line

May be you should also add the missing timeout setting ?

That's in another patch - I'll post the whole series now.

Quoted 27 lines

Anyhow,

Thanks,

C.

Quoted 18 lines
---
  tests/avocado/machine_aspeed.py | 2 ++
  1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -0
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
          self.wait_for_console_pattern('Starting kernel ...')
          self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
          self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
          self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
          exec_command(self, 'root')
          time.sleep(0.1)
 
Signature · 1 line
Alex Bennée
Acked-by on v1 1/1
#3 lore raw
In reply to Alex Bennée
Quoted 29 lines · Alex Bennée

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>
---
 tests/avocado/machine_aspeed.py | 2 ++
 1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -1
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
         self.wait_for_console_pattern('Starting kernel ...')
         self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
         self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
         self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
         exec_command(self, 'root')
         time.sleep(0.1)
 
--
Quoted 2 lines

2.30.2

Augh. Sorry my hunch was wrong. I wasn't aware of this problem.

Is ... this 0.1 second sleep really sufficient? I guess it's better than not having it, and I can't reasonably ask for something more thorough.

#4 lore raw
Quoted 35 lines · John Snow
Quoted 29 lines · Alex Bennée

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>
---
  tests/avocado/machine_aspeed.py | 2 ++
  1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -1
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
          self.wait_for_console_pattern('Starting kernel ...')
          self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
          self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
          self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
          exec_command(self, 'root')
          time.sleep(0.1)
 
--
Quoted 2 lines

2.30.2

Augh. Sorry my hunch was wrong. I wasn't aware of this problem.

Quoted 3 lines

Is ... this 0.1 second sleep really sufficient? I guess it's better than not having it, and I can't reasonably ask for something more thorough.

tests/avocado/machine_aarch64_virt.py has a few of these for the same reason I guess.

C.

#5 lore raw
In reply to John Snow
Quoted 35 lines · John Snow
Quoted 29 lines · Alex Bennée

This is really a limitation of the underlying console code which doesn't allow us to detect the login: and following "#" prompts because it reads input line wise. By adding a small delay we ensure that the login prompt has appeared so we don't accidentally spaff the shell commands to a confused getty in the guest.

Cc Cédric Le Goater <[email protected]>
Cc John Snow <[email protected]>
---
 tests/avocado/machine_aspeed.py | 2 ++
 1 file changed, 2 insertions(+)
tests/avocado/machine_aspeed.py +2 -1
index c54da0fd8f..65d38f4efa 100644
@@ -101,7 +101,9 @@ def do_test_arm_aspeed_buidroot_start(self, image, cpu_id):
         self.wait_for_console_pattern('Starting kernel ...')
         self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
         self.wait_for_console_pattern('lease of 10.0.2.15')
+        # the line before login:
         self.wait_for_console_pattern('Aspeed EVB')
+        time.sleep(0.1)
         exec_command(self, 'root')
         time.sleep(0.1)
 
--
Quoted 2 lines

2.30.2

Augh. Sorry my hunch was wrong. I wasn't aware of this problem.

Quoted 3 lines

Is ... this 0.1 second sleep really sufficient? I guess it's better than not having it, and I can't reasonably ask for something more thorough.

We could still do with fixing _console_interaction() so we can handle waiting for prompts without newlines in them. I had a go but it just got messy.

Quoted 2 lines
Signature · 1 line
Alex Bennée