Skip to contentSkip to conversation

auto-t: remove ifconfig call from testScan

PATCH In review James Prestwood 2 participants 3 messages Jun 3, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 auto-t: remove ifconfig call from testScan

ifconfig isn't available by default in several linux distros so instead use 'ip' which seems to be much more widespread.

---
 autotests/testScan/remove_iface_test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
autotests/testScan/remove_iface_test.py +1 -1
index af36c1e8..4f9eef93 100644
@@ -18,7 +18,7 @@ class Test(unittest.TestCase):
         device.autoconnect = True
         device.scan(wait=False)
 
-        os.system('ifconfig %s down' % device.name)
+        os.system('ip link set dev %s down' % device.name)
 
     @classmethod
     def setUpClass(cls):
Signature · 1 line
2.34.1
#1 lore raw

Hi James,

Quoted 6 lines · James Prestwood

ifconfig isn't available by default in several linux distros so instead use 'ip' which seems to be much more widespread.

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

Both applied, thanks.

Regards,
-Denis

author
#2 lore raw

PATCH 2/2 test-runner: only remove /tmp files if they exist

In reply to James Prestwood

This bit of code was throwing exceptions if a test cleaned up files that test-runner was expecting to clean up. Specifically testHotspot swaps out main.conf and PSK files many times. This led to the exception being thrown, caught, and ignored but further on test-runner would print:

"File _X_ not cleaned up!"

Now the files will be checked if they exist before trying to remove it.

---
 tools/run-tests | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/run-tests +1 -1
index f65daf67..56f865e0 100755
@@ -861,7 +861,7 @@ def post_test(ctx, to_copy):
 		for f in to_copy:
 			if os.path.isdir('/tmp/' + f):
 				shutil.rmtree('/tmp/' + f)
-			else:
+			elif os.path.exists('/tmp/' + f):
 				os.remove('/tmp/' + f)
 
 		Process(['ip', 'link', 'set', 'lo', 'down']).wait()
Signature · 1 line
2.34.1