Skip to contentSkip to conversation

tests/functional: Remove sleep workarounds from sh4 test

PATCH In review Cédric Le Goater 2 participants 2 messages Nov 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 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.

Test always passes now. Remove skipUnless test on QEMU_TEST_FLAKY_TESTS.

---
 tests/functional/test_sh4_tuxrun.py | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
tests/functional/test_sh4_tuxrun.py +3 -7
index 352cb360ef74..b33533fc7e7b 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):
@@ -27,8 +27,6 @@ class TuxRunSh4Test(TuxRunBaselineTest):
         'https://storage.tuxboot.com/20230331/sh4/rootfs.ext4.zst',
         '3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd')
 
-    # Note: some segfaults caused by unaligned userspace access
-    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable')
     def test_sh4(self):
         self.set_machine('r2d')
         self.cpu='sh7785'
@@ -46,10 +44,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
Reviewed-by on v2 1/1
#1 lore raw
Quoted 36 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.

Test always passes now. Remove skipUnless test on QEMU_TEST_FLAKY_TESTS.

---
  tests/functional/test_sh4_tuxrun.py | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)
tests/functional/test_sh4_tuxrun.py +1 -3
index 352cb360ef74..b33533fc7e7b 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):
@@ -27,8 +27,6 @@ class TuxRunSh4Test(TuxRunBaselineTest):
          'https://storage.tuxboot.com/20230331/sh4/rootfs.ext4.zst',
          '3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd')
 
-    # Note: some segfaults caused by unaligned userspace access
-    @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable')
      def test_sh4(self):
          self.set_machine('r2d')
          self.cpu='sh7785'
@@ -46,10 +44,8 @@ def test_sh4(self):
                           console_index=1)
          self.vm.launch()

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

Quoted 10 lines
tests/functional/test_sh4_tuxrun.py +2 -4
 
-        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")
 

Thanks for taking care of it!