Skip to contentSkip to conversation

tests/functional: Remove sleep workarounds from sh4 test

PATCH Superseded Cédric Le Goater 2 participants 4 messages Nov 22, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/functional: Remove sleep workarounds from sh4 test

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 instead.

---
 tests/functional/test_sh4_tuxrun.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tests/functional/test_sh4_tuxrun.py +3 -5
index 352cb360ef74..dcb49f28b9aa 100755
@@ -15,7 +15,7 @@
 import time
 
 from unittest import skipUnless
-from qemu_test import Asset, exec_command_and_wait_for_pattern, exec_command
+from qemu_test import Asset, exec_command_and_wait_for_pattern
 from qemu_test.tuxruntest import TuxRunBaselineTest
 
 class TuxRunSh4Test(TuxRunBaselineTest):
@@ -46,10 +46,8 @@ def test_sh4(self):
                          console_index=1)
         self.vm.launch()
 
-        self.wait_for_console_pattern("Welcome to TuxTest")
-        time.sleep(0.1)
-        exec_command(self, 'root')
-        time.sleep(0.1)
+        self.wait_for_console_pattern("tuxtest login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#')
         exec_command_and_wait_for_pattern(self, 'halt',
                                           "reboot: System halted")
 
Signature · 1 line
2.47.0
#1 lore raw
Quoted 24 lines · Cédric Le Goater

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 instead.

---
  tests/functional/test_sh4_tuxrun.py | 8 +++-----
  1 file changed, 3 insertions(+), 5 deletions(-)
tests/functional/test_sh4_tuxrun.py +1 -1
index 352cb360ef74..dcb49f28b9aa 100755
@@ -15,7 +15,7 @@
  import time
 
  from unittest import skipUnless
-from qemu_test import Asset, exec_command_and_wait_for_pattern, exec_command
+from qemu_test import Asset, exec_command_and_wait_for_pattern
  from qemu_test.tuxruntest import TuxRunBaselineTest
 
  class TuxRunSh4Test(TuxRunBaselineTest):
@@ -46,10 +46,8 @@ def test_sh4(self):
                           console_index=1)

tests/functional/test_sh4_tuxrun.py def test_sh4(self): · line 52

Quoted 10 lines
tests/functional/test_sh4_tuxrun.py +2 -4
          self.vm.launch()
 
-        self.wait_for_console_pattern("Welcome to TuxTest")
-        time.sleep(0.1)
-        exec_command(self, 'root')
-        time.sleep(0.1)
+        self.wait_for_console_pattern("tuxtest login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#')
          exec_command_and_wait_for_pattern(self, 'halt',
                                            "reboot: System halted")

Could we also remove the @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS')...) now?

Thomas

#2 lore raw
Quoted 35 lines · Thomas Huth
Quoted 21 lines · Cédric Le Goater

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 instead.

---
  tests/functional/test_sh4_tuxrun.py | 8 +++-----

  1 file changed, 3 insertions(+), 5 deletions(-)
tests/functional/test_sh4_tuxrun.py +0 -0
index 352cb360ef74..dcb49f28b9aa 100755
@@ -15,7 +15,7 @@

  import time
  from unittest import skipUnless

tests/functional/test_sh4_tuxrun.py +1 -1
-from qemu_test import Asset, exec_command_and_wait_for_pattern, exec_command
+from qemu_test import Asset, exec_command_and_wait_for_pattern

  from qemu_test.tuxruntest import TuxRunBaselineTest class TuxRunSh4Test(TuxRunBaselineTest):

tests/functional/test_sh4_tuxrun.py def test_sh4(self): · line 51

Quoted 10 lines
tests/functional/test_sh4_tuxrun.py +2 -4
@@ -46,10 +46,8 @@ def test_sh4(self):
                            console_index=1)
           self.vm.launch()
-        self.wait_for_console_pattern("Welcome to TuxTest")
-        time.sleep(0.1)
-        exec_command(self, 'root')
-        time.sleep(0.1)
+        self.wait_for_console_pattern("tuxtest login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#')
           exec_command_and_wait_for_pattern(self, 'halt',
                                             "reboot: System halted")

Could we also remove the  @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS')...) now?

Quoted 2 lines

 Thomas

I didn't because of this comment :

# Note: some segfaults caused by unaligned userspace access

It does not reproduce on my systems though.

C.

#3 lore raw
Quoted 38 lines · Cédric Le Goater
Quoted 37 lines · Thomas Huth
Quoted 22 lines · Cédric Le Goater

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 instead.

---
  tests/functional/test_sh4_tuxrun.py | 8 +++-----

  1 file changed, 3 insertions(+), 5 deletions(-)
tests/functional/test_sh4_tuxrun.py +0 -0
index 352cb360ef74..dcb49f28b9aa 100755
@@ -15,7 +15,7 @@

  import time
  from unittest import skipUnless
-from qemu_test import Asset, exec_command_and_wait_for_pattern, exec_command
+from qemu_test import Asset, exec_command_and_wait_for_pattern from qemu_test.tuxruntest import TuxRunBaselineTest class TuxRunSh4Test(TuxRunBaselineTest):

tests/functional/test_sh4_tuxrun.py def test_sh4(self): · line 51

Quoted 10 lines
tests/functional/test_sh4_tuxrun.py +2 -4
@@ -46,10 +46,8 @@ def test_sh4(self):
                            console_index=1)
           self.vm.launch()
-        self.wait_for_console_pattern("Welcome to TuxTest")
-        time.sleep(0.1)
-        exec_command(self, 'root')
-        time.sleep(0.1)
+        self.wait_for_console_pattern("tuxtest login:")
+        exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#')
           exec_command_and_wait_for_pattern(self, 'halt',
                                             "reboot: System halted")

Could we also remove the @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS')...) now?

Quoted 8 lines
Quoted 2 lines

  Thomas

I didn't because of this comment :

    # Note: some segfaults caused by unaligned userspace access

It does not reproduce on my systems though.

I also cannot reproduce the problem anymore here ... so maybe we should give it a try and remove the skipUnless now?

Thomas