Skip to contentSkip to conversation

auto-t: fix failed_roam_test to pass when run on its own

PATCH In review James Prestwood 2 participants 3 messages Feb 14, 2024 – Feb 22, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 auto-t: fix failed_roam_test to pass when run on its own

When running this test with others the hostapd neighbors are already grouped which lets the test pass. On its own this does not happen and it fails.

---
 autotests/testPSK-roam/failed_roam_test.py | 2 ++
 1 file changed, 2 insertions(+)
autotests/testPSK-roam/failed_roam_test.py +2 -0
index 12e439f6..8cce8bb5 100644
@@ -221,6 +221,8 @@ class Test(unittest.TestCase):
         cls.rule_bss2 = hwsim.rules.create()
         cls.rule_bss2.source = hwsim.get_radio('rad2').addresses[0]
 
+        HostapdCLI.group_neighbors(*cls.bss_hostapd)
+
     @classmethod
     def tearDownClass(cls):
         IWD.clear_storage()
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 auto-t: timestamp log files in test-runner

The log files become much more useful when there are timestamps associated with each log.

---
 tools/utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/utils.py +6 -1
index 8219542e..5984fc69 100644
@@ -6,6 +6,7 @@ import traceback
 import shutil
 import dbus
 
+from datetime import datetime
 from gi.repository import GLib
 from weakref import WeakValueDictionary
 from re import fullmatch
@@ -125,7 +126,11 @@ class Process(subprocess.Popen):
 	@staticmethod
 	def _write_io(instance, data, stdout=True):
 		for f in instance.write_fds:
-			f.write(data)
+			for c in data:
+				f.write(c)
+				if c == '\n':
+					stamp = datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S.%f")
+					f.write(stamp + ': ')
 
 			# Write out a separator so multiple process calls per
 			# test are easer to read.
Signature · 1 line
2.34.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 7 lines · James Prestwood

When running this test with others the hostapd neighbors are already grouped which lets the test pass. On its own this does not happen and it fails.

---
  autotests/testPSK-roam/failed_roam_test.py | 2 ++
  1 file changed, 2 insertions(+)

Both applied, thanks.

Regards,
-Denis