auto-t: iwd.py: add wait argument to scan()
James Prestwood
PATCH 1/2 auto-t: iwd.py: add wait argument to scan()
Lets the test continue without waiting for the method return
--- autotests/util/iwd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
autotests/util/iwd.py +3 -2
@@ -450,7 +450,7 @@ class Device(IWDDBusAbstract): self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE, 'AutoConnect', value) - def scan(self): + def scan(self, wait=True): '''Schedule a network scan. Possible exception: BusyEx
@@ -460,7 +460,8 @@ class Device(IWDDBusAbstract): reply_handler=self._success, error_handler=self._failure) - self._wait_for_async_op() + if wait: + self._wait_for_async_op() def disconnect(self): '''Disconnect from the network
Signature · 1 line
2.31.1
James Prestwood
PATCH 2/2 auto-t: add test for fixed scanning crash
This simulates the conditions that trigger a free-after-use which was fixed with:
2c355db7 ("scan: remove periodic scans from queue on abort")
This behavior can be reproduced reliably using this test with the above patch reverted.
--- autotests/testScan/remove_iface_test.py | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 autotests/testScan/remove_iface_test.py
autotests/testScan/remove_iface_test.py new file +32 -0
@@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +import unittest +import sys +import os + +sys.path.append('../util') +from iwd import IWD +from config import ctx + +class Test(unittest.TestCase): + def test_connection_success(self): + wd = IWD(True) + + devices = wd.list_devices(1) + device = devices[0] + + device.autoconnect = True + device.scan(wait=False) + + os.system('ifconfig %s down' % device.name) + + @classmethod + def setUpClass(cls): + pass + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True)
Signature · 1 line
2.31.1
Denis Kenzior
Hi James,
Quoted 5 lines · James Prestwood
Lets the test continue without waiting for the method return
--- autotests/util/iwd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Both applied, thanks.
Regards,
-Denis