Skip to contentSkip to conversation

test-runner: exclude 'iwd-rtnl' from being enabled with --log

PATCH In review James Prestwood 2 participants 4 messages Jun 22, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 test-runner: exclude 'iwd-rtnl' from being enabled with --log

Enabling this ends up dumping so much logging and, at least with namespaces, seems to break the logger module and cause really weird behavior, worst of which is that all processes start dumping to stdout.

This can still be enabled explicitly with --verbose iwd-rtnl, but is turned off by default when --log is used.

---
 tools/utils.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/utils.py +2 -1
index fd51b6e8..e424231f 100644
@@ -142,13 +142,14 @@ class Process(subprocess.Popen):
 
 	@staticmethod
 	def is_verbose(process, log=True):
+		exclude = ['iwd-rtnl']
 		process = os.path.basename(process)
 
 		if Process.testargs is None:
 			return False
 
 		# every process is verbose when logging is enabled
-		if log and Process.testargs.log:
+		if log and Process.testargs.log and process not in exclude:
 			return True
 
 		if process in Process.testargs.verbose:
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 auto-t: rename testHiddenNetwork's test class

This was copy pasted from the autoconnect test, and depending on how the python module cache is ordered can incorrectly use the wrong test class. This should nothappen because we insert the paths to the head of the list but for consistency the class should be named something that reflects what the test is doing.

---
 autotests/testHiddenNetworks/exceptions_test.py   | 4 ++--
 autotests/testHiddenNetworks/open_network_test.py | 4 ++--
 autotests/testHiddenNetworks/validation.py        | 2 +-
 autotests/testHiddenNetworks/wpa_network_test.py  | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)
autotests/testHiddenNetworks/exceptions_test.py +2 -2
index 0c151fcb..1c4722a6 100644
@@ -6,7 +6,7 @@ import sys
 sys.path.append('../util')
 import iwd
 import validation
-from validation import TestConnectAutoConnect
+from validation import TestHiddenNetworks
 from iwd import IWD
 
 class TestWpaNetwork(unittest.TestCase):
@@ -23,7 +23,7 @@ class TestWpaNetwork(unittest.TestCase):
     '''
 
     def test_wpa(self):
-        tca = TestConnectAutoConnect()
+        tca = TestHiddenNetworks()
 
         tca.validate('UnExistingNetwork', False, iwd.NotFoundEx)
         tca.validate('ssidOverlap', False, iwd.ServiceSetOverlapEx)
autotests/testHiddenNetworks/open_network_test.py +2 -2
index 2cc0f75b..8645fdad 100644
@@ -6,7 +6,7 @@ import sys
 sys.path.append('../util')
 import iwd
 import validation
-from validation import TestConnectAutoConnect
+from validation import TestHiddenNetworks
 from iwd import IWD
 
 class TestOpenNetwork(unittest.TestCase):
@@ -20,7 +20,7 @@ class TestOpenNetwork(unittest.TestCase):
     True                              True          Connection succeeds
     '''
     def test_open(self):
-        tca = TestConnectAutoConnect()
+        tca = TestHiddenNetworks()
         tca.validate('ssidHiddenOpen', False)
         tca.validate('ssidHiddenOpen', True)
 
autotests/testHiddenNetworks/validation.py +1 -1
index 793b459f..2c005331 100644
@@ -9,7 +9,7 @@ from iwd import IWD
 from iwd import PSKAgent
 from iwd import NetworkType
 
-class TestConnectAutoConnect(unittest.TestCase):
+class TestHiddenNetworks(unittest.TestCase):
 
     def check_connect_hidden_network(self, wd, device, ssid, throws):
         if not throws is None:
autotests/testHiddenNetworks/wpa_network_test.py +2 -2
index d8166b1b..a65fe1af 100644
@@ -6,7 +6,7 @@ import sys
 sys.path.append('../util')
 import iwd
 import validation
-from validation import TestConnectAutoConnect
+from validation import TestHiddenNetworks
 from iwd import IWD
 
 class TestWpaNetwork(unittest.TestCase):
@@ -21,7 +21,7 @@ class TestWpaNetwork(unittest.TestCase):
     '''
 
     def test_wpa(self):
-        tca = TestConnectAutoConnect()
+        tca = TestHiddenNetworks()
         tca.validate('ssidHiddenWPA', False, None, True)
         tca.validate('ssidHiddenWPA', True, None, True)
 
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 auto-t: fix hardcoded 'wlan1' in testNetconfig

In reply to James Prestwood

This works, if testNetconfig is the only test. Otherwise it will always fail since the interface naming increments for each test.

---
 autotests/testNetconfig/connection_test.py | 2 +-
 autotests/testNetconfig/static_test.py     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
autotests/testNetconfig/connection_test.py +1 -1
index 4b05c745..e73ab335 100644
@@ -80,7 +80,7 @@ class Test(unittest.TestCase):
         rclog = open('/tmp/resolvconf.log', 'r')
         entries = rclog.readlines()
         rclog.close()
-        expected_rclog = ['-a wlan1.dns\n', 'nameserver 192.168.1.2\n', 'nameserver 3ffe:501:ffff:100::2\n']
+        expected_rclog = ['-a %s.dns\n' % ifname, 'nameserver 192.168.1.2\n', 'nameserver 3ffe:501:ffff:100::2\n']
         # Every real resolvconf -a run overwrites the previous settings.  Check the last three lines
         # of our log since we care about the end result here.
         self.assertEqual(expected_rclog, entries[-3:])
autotests/testNetconfig/static_test.py +1 -1
index ac525b28..d9f0b9cb 100644
@@ -75,7 +75,7 @@ class Test(unittest.TestCase):
         rclog = open('/tmp/resolvconf.log', 'r')
         entries = rclog.readlines()
         rclog.close()
-        expected_rclog = ['-a wlan1.dns\n', 'nameserver 192.168.1.4\n', 'nameserver 3ffe:501:ffff:200::4\n']
+        expected_rclog = ['-a %s.dns\n' % ifname, 'nameserver 192.168.1.4\n', 'nameserver 3ffe:501:ffff:200::4\n']
         # Every resolvconf -a run overwrites the previous settings.  Check the last three lines
         # of the log since we care about the end result here.
         self.assertEqual(expected_rclog, entries[-3:])
Signature · 1 line
2.34.1
#3 lore raw
In reply to James Prestwood

Hi James,

Quoted 9 lines · James Prestwood

Enabling this ends up dumping so much logging and, at least with namespaces, seems to break the logger module and cause really weird behavior, worst of which is that all processes start dumping to stdout.

This can still be enabled explicitly with --verbose iwd-rtnl, but is turned off by default when --log is used.

---
  tools/utils.py | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

All applied, thanks.

Regards,
-Denis