From 9966533e6a5321a56aa2b709fd146842af1f945f Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 8 Feb 2022 09:35:39 -0800 Subject: [PATCH] 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 diff --git a/autotests/testScan/remove_iface_test.py b/autotests/testScan/remove_iface_test.py new file mode 100644 index 00000000..af36c1e8 --- /dev/null +++ b/autotests/testScan/remove_iface_test.py @@ -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)