Skip to contentSkip to conversation

test-runner: catch exception on test file removal

PATCH In review James Prestwood 2 participants 3 messages Dec 23, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 test-runner: catch exception on test file removal

Without catching this can result in a fatal error, ending the test run.

---
 tools/test-runner | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/test-runner +4 -1
index 7fa8b840..b5c4f777 100755
@@ -1380,7 +1380,10 @@ def post_test(ctx, to_copy):
 	allowed = ['phonesim.conf', 'certs', 'secrets', 'iwd']
 	for f in [f for f in os.listdir('/tmp') if f not in allowed]:
 		dbg("File %s was not cleaned up!" % f)
-		os.remove('/tmp/' + f)
+		try:
+			os.remove('/tmp/' + f)
+		except:
+			pass
 
 def print_results(results):
 	table = PrettyTable(['Test', colored('Passed', 'green'), colored('Failed', 'red'), \
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/2 auto-t: iwd.py: fix namespaces on StationDebug

Passing the full argument list to StationDebug was removed because any existing properties (for Device) were being included and causing incorrect behavior.

This neglected to handle namespaces which should also be passed to StationDebug. Unfortunately the arguments are not named when Device() is initialized so they cannot easily be sorted. Instead just define Device() arguments to match the DBus abstraction and pass only the path and namespace to StationDebug

---
 autotests/util/iwd.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
autotests/util/iwd.py +6 -3
index 185a31fe..e95bd96d 100755
@@ -280,14 +280,17 @@ class Device(IWDDBusAbstract):
     '''
     _iface_name = IWD_DEVICE_INTERFACE
 
-    def __init__(self, *args, **kwargs):
+    def __init__(self, object_path = None, properties = None,
+                    service=IWD_SERVICE, namespace=ctx):
         self._wps_manager_if = None
         self._station_if = None
         self._station_props = None
 
-        IWDDBusAbstract.__init__(self, *args, **kwargs)
+        IWDDBusAbstract.__init__(self, object_path, properties, service,
+                                    namespace)
 
-        self._station_debug = StationDebug(args[0])
+        self._station_debug = StationDebug(object_path=object_path,
+                                            namespace=namespace)
 
     @property
     def _wps_manager(self):
Signature · 1 line
2.31.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 6 lines · James Prestwood

Without catching this can result in a fatal error, ending the test run.

---
  tools/test-runner | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

Both applied, thanks.

Regards,
-Denis