Skip to contentSkip to conversation

auto-t: fix set_neighbor SSID escaping

PATCH In review James Prestwood 2 participants 4 messages Sep 11, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 auto-t: fix set_neighbor SSID escaping

Before the re-write there was interesting escapes being used for set_neighbor. Curiously now hostapd fails to set the neighbor due to these escapes so they have been removed.

---
 autotests/util/hostapd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
autotests/util/hostapd.py +1 -1
index 3f0edd9e..7c0d8385 100644
@@ -152,7 +152,7 @@ class HostapdCLI:
         return [line for line in lines.split('\n') if line]
 
     def set_neighbor(self, addr, ssid, nr):
-        cmd = self.cmdline + ['set_neighbor', addr, 'ssid=\\""%s"\\"' % ssid, 'nr=%s' % nr]
+        cmd = self.cmdline + ['set_neighbor', addr, 'ssid="%s"' % ssid, 'nr=%s' % nr]
         ctx.start_process(cmd, wait=True)
 
     def send_bss_transition(self, device, nr_list):
Signature · 1 line
2.26.2
#1 lore raw

PATCH 2/3 auto-t: remove hwsim rules on __del__

This prevents previous tests rules from carrying over into future tests.

---
 autotests/util/hwsim.py | 7 +++++++
 1 file changed, 7 insertions(+)
autotests/util/hwsim.py +7 -0
index a0ddedcd..cf1ab536 100755
@@ -240,6 +240,9 @@ class RadioList(collections.Mapping):
     def __delitem__(self, key):
         self._dict.pop(key).remove()
 
+    def values(self):
+        return self._dict.values()
+
     def _interfaces_added_handler(self, path, interfaces):
         self._dict[path] = Radio(interfaces[HWSIM_RADIO_INTERFACE])
 
@@ -271,6 +274,10 @@ class Hwsim(iwd.AsyncOpAbstract):
         self._rules = RuleSet(self, objects)
         self._radios = RadioList(self, objects)
 
+    def __del__(self):
+        for rule in self._rules.values():
+            rule.remove()
+
     @property
     def rules(self):
         return self._rules
Signature · 1 line
2.26.2
#2 lore raw

PATCH 3/3 test-runner: print results even if test run is canceled

In reply to James Prestwood
---
 tools/test-runner | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
tools/test-runner +3 -2
index d7f831ac..a71b9ef6 100755
@@ -58,6 +58,9 @@ def exit_vm():
 		for p in config.ctx.processes:
 			print("Process %s still running!" % p.name)
 
+	if config.ctx and config.ctx.results:
+		print_results(config.ctx.results)
+
 	os.sync()
 
 	RB_AUTOBOOT = 0x01234567
@@ -985,8 +988,6 @@ def run_auto_tests(ctx, args):
 	if ctx.args.log:
 		Process(["dmesg"], ctx=ctx, wait=True)
 
-	print_results(ctx.results)
-
 def run_unit_tests(ctx, args):
 	os.chdir(args.testhome + '/unit')
 	units = build_unit_list(args)
Signature · 1 line
2.26.2
#3 lore raw
In reply to James Prestwood

Hi James,

Quoted 7 lines · James Prestwood

Before the re-write there was interesting escapes being used for set_neighbor. Curiously now hostapd fails to set the neighbor due to these escapes so they have been removed.

---
  autotests/util/hostapd.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

All applied, thanks.

Regards,
-Denis