Skip to contentSkip to conversation

tools: add some required options to kernel config

PATCH In review James Prestwood 2 participants 8 messages Mar 30, 2022

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/7 tools: add some required options to kernel config

It looks like some architectures defconfig were adding these in automatically, but not others. Explicitly add these to make sure the kernel is built correctly.

---
 tools/test_runner_kernel_config | 11 +++++++++++
 1 file changed, 11 insertions(+)
tools/test_runner_kernel_config +11 -0
index 64674683..c3e65d34 100755
@@ -1,8 +1,12 @@
 #! /bin/sh
 
+scripts/config --enable CONFIG_CFG80211
+scripts/config --enable CONFIG_MAC80211
 scripts/config --enable CONFIG_MAC80211_HWSIM
 scripts/config --enable CONFIG_NLMON
 scripts/config --enable CONFIG_VLAN_8021Q
+scripts/config --enable CONFIG_RFKILL
+scripts/config --enable CONFIG_IPV6
 
 scripts/config --enable CONFIG_EXPERT
 scripts/config --enable CONFIG_CFG80211_CERTIFICATION_ONUS
@@ -16,14 +20,21 @@ scripts/config --enable CONFIG_CRYPTO_RSA
 scripts/config --enable CONFIG_CRYPTO_AES_X86_64
 scripts/config --enable CONFIG_CRYPTO_AES_NI_INTEL
 scripts/config --enable CONFIG_CRYPTO_MD4
+scripts/config --enable CONFIG_CRYPTO_MD5
+scripts/config --enable CONFIG_CRYPTO_SHA1
+scripts/config --enable CONFIG_CRYPTO_SHA256
+scripts/config --enable CONFIG_CRYPTO_SHA512
 scripts/config --enable CONFIG_CRYPTO_SHA1_SSSE3
 scripts/config --enable CONFIG_CRYPTO_SHA256_SSSE3
 scripts/config --enable CONFIG_CRYPTO_SHA512_SSSE3
 scripts/config --enable CONFIG_CRYPTO_ECB
+scripts/config --enable CONFIG_CRYPTO_CBC
 scripts/config --enable CONFIG_CRYPTO_CMAC
 scripts/config --enable CONFIG_CRYPTO_DES
 scripts/config --enable CONFIG_CRYPTO_DES3_EDE_X86_64
 scripts/config --enable CONFIG_CRYPTO_ARC4
+scripts/config --enable CONFIG_CRYPTO_HMAC
+scripts/config --enable CONFIG_KEYS
 scripts/config --enable CONFIG_KEY_DH_OPERATIONS
 scripts/config --enable CONFIG_ASYMMETRIC_KEY_TYPE
 scripts/config --enable CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/7 tools: add UML specific options to the kernel config

---
 tools/test_runner_kernel_config | 4 ++++
 1 file changed, 4 insertions(+)
tools/test_runner_kernel_config +4 -0
index c3e65d34..f29c1781 100755
@@ -46,3 +46,7 @@ scripts/config --enable CONFIG_HW_RANDOM_VIRTIO
 scripts/config --enable CONFIG_HW_RANDOM_INTEL
 #scripts/config --enable CONFIG_HW_RANDOM_AMD
 scripts/config --enable CONFIG_SECURITYFS
+
+# Options needed for UML
+scripts/config --enable CONFIG_BINFMT_ELF
+scripts/config --enable CONFIG_HOSTFS
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 3/7 auto-t: remove direct scan() call when possible

In reply to James Prestwood

All tests which could avoid calling scan() directly have been changed to use the 'full_scan' argument to get_ordered_network.

This was done because of unreliable scanning behavior on slower systems, like VMs. If we get unlucky with the scheduler some beacons are not received in time and in turn scan results are missing. Using full_scan=True works around this issue by repeatedly scanning until the SSID is found.

---
 autotests/testAP/connection_test.py           | 10 +------
 autotests/testAP/dhcp_config_test.py          |  8 ------
 autotests/testAP/dhcp_test.py                 |  8 ------
 autotests/testAP/failure_test.py              | 10 +------
 autotests/testBSSBlacklist/connection_test.py | 10 +------
 .../connect_command_test.py                   | 28 ++++++-------------
 .../disconnect_by_ap_test.py                  |  7 +----
 autotests/testFT-FILS/connection_test.py      | 13 +--------
 autotests/testHT-VHT/connection_test.py       | 15 ++--------
 autotests/testNetconfig/static_test.py        |  7 +----
 .../testOWE-transition/connection_test.py     | 10 -------
 autotests/testRSSIAgent/connection_test.py    | 13 +--------
 .../testSAE-AntiClogging/clogging_test.py     | 10 +------
 autotests/testSAE-roam/connection_test.py     | 13 ++-------
 14 files changed, 22 insertions(+), 140 deletions(-)
autotests/testAP/connection_test.py +1 -9
index 4c784014..02213947 100644
@@ -47,16 +47,8 @@ class Test(unittest.TestCase):
         dev1.start_ap('TestAP2', 'Password2')
 
         try:
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            dev2.scan()
-            condition = 'obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-
             networks = {}
-            networks['TestAP1'] = dev2.get_ordered_network('TestAP1')
+            networks['TestAP1'] = dev2.get_ordered_network('TestAP1', full_scan=True)
             networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
 
             self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
autotests/testAP/dhcp_config_test.py +0 -8
index afea5415..ac3a95ba 100644
@@ -29,14 +29,6 @@ class Test(unittest.TestCase):
         dev1.start_ap('APConfig')
 
         try:
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            dev2.scan()
-            condition = 'obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-
             networks = {}
             networks['APConfig'] = dev2.get_ordered_network('APConfig', full_scan=True)
 
autotests/testAP/dhcp_test.py +0 -8
index 0118b17d..a8f89eb0 100644
@@ -26,14 +26,6 @@ class Test(unittest.TestCase):
             dev4.start_ap('TestAP4', 'Password4')
 
         try:
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            dev2.scan()
-            condition = 'obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-
             networks = {}
             networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
 
autotests/testAP/failure_test.py +1 -9
index 05b5a7fb..4bd4a2aa 100644
@@ -48,16 +48,8 @@ class Test(unittest.TestCase):
         dev1.start_ap('TestAP2', 'Password2')
 
         try:
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            dev2.scan()
-            condition = 'obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-            condition = 'not obj.scanning'
-            wd.wait_for_object_condition(dev2, condition)
-
             networks = {}
-            networks['TestAP1'] = dev2.get_ordered_network('TestAP1')
+            networks['TestAP1'] = dev2.get_ordered_network('TestAP1', full_scan=True)
             networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
 
             self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
autotests/testBSSBlacklist/connection_test.py +1 -9
index df3bd507..1bc9e604 100644
@@ -244,15 +244,7 @@ class Test(unittest.TestCase):
 
         device.disconnect()
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network("TestBlacklist")
+        ordered_network = device.get_ordered_network("TestBlacklist", full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
autotests/testClientNonInteractive/connect_command_test.py +9 -19
index 8ca7ad42..c31b9b43 100644
@@ -11,13 +11,9 @@ import subprocess
 from config import ctx
 
 class Test(unittest.TestCase):
-
     def check_connection_success(self, ssid):
         device = self.wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        self.wd.wait_for_object_condition(device, condition)
-
         ordered_network = device.get_ordered_network(ssid)
 
         condition = 'obj.state == DeviceState.connected'
@@ -28,9 +24,14 @@ class Test(unittest.TestCase):
         condition = 'not obj.connected'
         self.wd.wait_for_object_condition(ordered_network.network_object, condition)
 
+    def establish_network(self, ssid):
+        device = self.wd.list_devices(1)[0]
+        device.get_ordered_network(ssid)
+
     def test_connection_with_passphrase(self):
         ssid = 'ssidPassphrase'
 
+        self.establish_network(ssid)
         device = self.wd.list_devices(1)[0]
 
         # Use --dontaks cmd-line option
@@ -45,6 +46,7 @@ class Test(unittest.TestCase):
     def test_connection_with_username_and_password(self):
         ssid = 'ssidUNameAndPWord'
 
+        self.establish_network(ssid)
         device = self.wd.list_devices(1)[0]
 
         ctx.start_process(['iwctl', '-u', 'user', '-p', 'password', 'station', \
@@ -54,6 +56,7 @@ class Test(unittest.TestCase):
     def test_connection_with_password(self):
         ssid = 'ssidPWord'
 
+        self.establish_network(ssid)
         device = self.wd.list_devices(1)[0]
 
         ctx.start_process(['iwctl', '-p', 'password', 'station', device.name, 'connect', ssid],
@@ -64,6 +67,7 @@ class Test(unittest.TestCase):
     def test_connection_failure(self):
         ssid = 'ssidPassphrase'
 
+        self.establish_network(ssid)
         device = self.wd.list_devices(1)[0]
 
         with self.assertRaises(subprocess.CalledProcessError):
@@ -73,14 +77,13 @@ class Test(unittest.TestCase):
     def test_invalid_command_line_option(self):
         ssid = 'ssidPassphrase'
 
+        self.establish_network(ssid)
         device = self.wd.list_devices(1)[0]
 
         with self.assertRaises(subprocess.CalledProcessError):
             ctx.start_process(['iwctl', '-z', 'station', device.name, 'connect', ssid], check=True)
 
     def test_invalid_command(self):
-        device = self.wd.list_devices(1)[0]
-
         with self.assertRaises(subprocess.CalledProcessError):
             ctx.start_process(['iwctl', 'inexistent', 'command'], check=True)
 
@@ -91,19 +94,6 @@ class Test(unittest.TestCase):
 
         cls.wd = IWD()
 
-        device = cls.wd.list_devices(1)[0]
-
-        condition = 'not obj.scanning'
-        cls.wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        cls.wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        cls.wd.wait_for_object_condition(device, condition)
-
     @classmethod
     def tearDownClass(cls):
         IWD.clear_storage()
autotests/testDisconnectByAP/disconnect_by_ap_test.py +1 -6
index f003ec0c..f3c71358 100644
@@ -21,12 +21,7 @@ class Test(unittest.TestCase):
 
         hostapd = HostapdCLI(config='ssidOpen.conf')
 
-        device.scan()
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('ssidOpen')
+        ordered_network = device.get_ordered_network('ssidOpen', full_scan=True)
 
         ordered_network.network_object.connect()
 
autotests/testFT-FILS/connection_test.py +1 -12
index 1fd4633b..4aef8db6 100644
@@ -13,21 +13,10 @@ class Test(unittest.TestCase):
     def validate_connection(self, wd):
         device = wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
         # Scanning is unavoidable in this case since both FILS-SHA256 and
         # FILS-SHA384 are tested. Without a new scan the cached scan results
         # would cause IWD to choose an incorrect AKM for the second test.
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestFT')
+        ordered_network = device.get_ordered_network('TestFT', full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.eap)
 
autotests/testHT-VHT/connection_test.py +2 -13
index 051822c2..0297cb9b 100644
@@ -14,22 +14,11 @@ from hostapd import HostapdCLI
 
 class Test(unittest.TestCase):
     def do_connect(self, wd, device, hostapd):
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
         #
         # Scanning must be explicitly done to get updated RSSI values. Therefore
-        # scan_if_needed is set false because of the previous scan.
+        # full_scan is set.
         #
-        ordered_network = device.get_ordered_network('testSSID', scan_if_needed=False)
+        ordered_network = device.get_ordered_network('testSSID', full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
autotests/testNetconfig/static_test.py +1 -6
index 4aae4a20..8e29d4eb 100644
@@ -47,12 +47,7 @@ class Test(unittest.TestCase):
 
         testutil.test_ip_address_match(dev1.name, '192.168.1.10')
 
-        dev2.scan()
-
-        condition = 'not obj.scanning'
-        wd_ns0.wait_for_object_condition(dev2, condition)
-
-        ordered_network = dev2.get_ordered_network('ssidTKIP', scan_if_needed=True)
+        ordered_network = dev2.get_ordered_network('ssidTKIP')
 
         condition = 'not obj.connected'
         wd_ns0.wait_for_object_condition(ordered_network.network_object, condition)
autotests/testOWE-transition/connection_test.py +0 -10
index ff5ea811..89f97338 100644
@@ -230,16 +230,6 @@ class Test(unittest.TestCase):
         self.rule0.signal = -4000
         self.rule0.enabled = True
 
-        devices = self.wd.list_devices(1)
-        device = devices[0]
-
-        device.scan()
-        condition = 'obj.scanning'
-        self.wd.wait_for_object_condition(device, condition)
-        condition = 'not obj.scanning'
-        self.wd.wait_for_object_condition(device, condition)
-
-
         self.validate(self.wd, self.hapd_owe)
 
     def setUp(self):
autotests/testRSSIAgent/connection_test.py +1 -12
index ded09f6c..160a17b3 100644
@@ -31,18 +31,7 @@ class Test(unittest.TestCase):
         agent.calls = 0
         device.register_signal_agent(agent, [-20, -40, -60, -80])
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestOpen')
+        ordered_network = device.get_ordered_network('TestOpen', full_scan=True)
 
         self.assertEqual(ordered_network.type, NetworkType.open)
         self.assertEqual(ordered_network.signal_strength, -4000)
autotests/testSAE-AntiClogging/clogging_test.py +1 -9
index ddd1c7ab..172dfecf 100644
@@ -21,16 +21,8 @@ class Test(unittest.TestCase):
         devices = wd.list_devices(4)
         self.assertIsNotNone(devices)
 
-        for d in devices:
-            d.disconnect()
-            d.scan()
-            wd.wait_for_object_condition(d, 'obj.scanning')
-
-        for d in devices:
-            wd.wait_for_object_condition(d, 'not obj.scanning')
-
         for i in range(len(devices)):
-            network = devices[i].get_ordered_network('ssidSAE-Clogging')
+            network = devices[i].get_ordered_network('ssidSAE-Clogging', full_scan=True)
             self.assertEqual(network.type, NetworkType.psk)
             networks.append(network)
 
autotests/testSAE-roam/connection_test.py +3 -10
index 4c49eaf8..a276232e 100644
@@ -16,16 +16,9 @@ class Test(unittest.TestCase):
     def validate_connection(self, wd, ft=True):
         device = wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
+        # This won't guarantee all BSS's are found, but at least ensures that
+        # at least one will be.
+        device.get_ordered_network('TestFT', full_scan=True)
 
         self.assertFalse(self.bss_hostapd[0].list_sta())
         self.assertFalse(self.bss_hostapd[1].list_sta())
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 4/7 auto-t: testutil: wait for operstate

In reply to James Prestwood

Depending on timing the operstate may not be set even when IWD shows as connected. Instead wait for the operstate to become set.

---
 autotests/util/testutil.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
autotests/util/testutil.py +11 -5
index 1fced6c4..01c42654 100644
@@ -134,10 +134,7 @@ SIOCGIFADDR = 0x8915
 IFF_UP = 1 << 0
 IFF_RUNNING = 1 << 6
 
-def test_iface_operstate(intf=None):
-    if not intf:
-        intf = iwd.IWD.get_instance().list_devices()[0].name
-
+def _test_operstate(intf):
     sock = socket.socket(socket.PF_PACKET, socket.SOCK_RAW)
 
     try:
@@ -146,10 +143,19 @@ def test_iface_operstate(intf=None):
 
         # IFF_LOWER_UP and IFF_DORMANT not returned by SIOCGIFFLAGS
         if flags & (IFF_UP | IFF_RUNNING) != IFF_UP | IFF_RUNNING:
-            raise Exception(intf + ' operstate wrong')
+            return False
+
+        return True
     finally:
         sock.close()
 
+def test_iface_operstate(intf=None):
+    if not intf:
+        intf = iwd.IWD.get_instance().list_devices()[0].name
+
+    ctx.non_block_wait(_test_operstate, 10, intf,
+                        exception=Exception(intf + ' operstate wrong'))
+
 def test_ip_address_match(intf, ip):
     try:
         s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 5/7 auto-t: testSAE-roam: wait for ip link down

In reply to James Prestwood

Before setting the address, wait for the interface to go down. This fixes somewhat rare cases where setting the address returns -EBUSY and ultimately breaks the neighbor reports.

---
 autotests/testSAE-roam/connection_test.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
autotests/testSAE-roam/connection_test.py +3 -3
index a276232e..2c8cd799 100644
@@ -120,13 +120,13 @@ class Test(unittest.TestCase):
                             HostapdCLI(config='ft-sae-2.conf'),
                             HostapdCLI(config='ft-psk-3.conf') ]
 
-        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, 'down'])
+        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, 'down']).wait()
         ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, \
                            'addr', '12:00:00:00:00:01', 'up']).wait()
-        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, 'down'])
+        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, 'down']).wait()
         ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, \
                            'addr', '12:00:00:00:00:02', 'up']).wait()
-        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, 'down'])
+        ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, 'down']).wait()
         ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, \
                            'addr', '12:00:00:00:00:03', 'up']).wait()
 
Signature · 1 line
2.34.1
author
#5 lore raw

PATCH 6/7 auto-t: fix up a few issues in testNetconfig

In reply to James Prestwood

- Setting the IP address was resulting in an error:

Error: any valid prefix is expected rather than "wln58".

This is fixed by reordering the arguments with the IP address first

- Remove the sleep, and use non_block_wait to wait for the IPv6 address to be set.

---
 autotests/testNetconfig/connection_test.py | 22 +++++++++++++++-------
 autotests/testNetconfig/static_test.py     |  3 ++-
 2 files changed, 17 insertions(+), 8 deletions(-)
autotests/testNetconfig/connection_test.py +15 -7
index 91c6eb6b..672efb72 100644
@@ -17,6 +17,15 @@ import subprocess
 class Test(unittest.TestCase):
 
     def test_connection_success(self):
+        def check_addr(device):
+            try:
+                subprocess.check_output('ip addr show ' + device.name + \
+                            ' | grep \'inet6 3ffe:501:ffff:100::\'', shell=True)
+            except:
+                return False
+
+            return True
+
         wd = IWD(True)
 
         psk_agent = PSKAgent("secret123")
@@ -40,9 +49,8 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate()
         testutil.test_ifaces_connected()
 
-        time.sleep(2)
-        subprocess.check_output('ip addr show ' + device.name + \
-                            ' | grep \'inet6 3ffe:501:ffff:100::\'', shell=True)
+        ctx.non_block_wait(check_addr, 10, device,
+                            exception=Exception("IPv6 address was not set"))
 
         device.disconnect()
 
@@ -70,15 +78,15 @@ class Test(unittest.TestCase):
         # TODO: This could be moved into test-runner itself if other tests ever
         #       require this functionality (p2p, FILS, etc.). Since its simple
         #       enough it can stay here for now.
-        ctx.start_process(['ip', 'addr','add','dev',  hapd.ifname,
-                           '192.168.1.1/255.255.255.0']).wait()
+        ctx.start_process(['ip', 'addr','add', '192.168.1.1/255.255.255.0',
+                            'dev', hapd.ifname,]).wait()
         ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
         cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
                                             '-lf', '/tmp/dhcpd.leases',
                                             hapd.ifname], cleanup=remove_lease4)
 
-        ctx.start_process(['ip', 'addr', 'add', 'dev', hapd.ifname,
-                           '3ffe:501:ffff:100::1/64']).wait()
+        ctx.start_process(['ip', 'addr', 'add', '3ffe:501:ffff:100::1/64',
+                            'dev', hapd.ifname]).wait()
         ctx.start_process(['touch', '/tmp/dhcpd6.leases']).wait()
         cls.dhcpd6_pid = ctx.start_process(['dhcpd', '-6', '-f', '-cf', '/tmp/dhcpd-v6.conf',
                                             '-lf', '/tmp/dhcpd6.leases',
autotests/testNetconfig/static_test.py +2 -1
index 8e29d4eb..bba2c644 100644
@@ -81,7 +81,8 @@ class Test(unittest.TestCase):
         # TODO: This could be moved into test-runner itself if other tests ever
         #       require this functionality (p2p, FILS, etc.). Since its simple
         #       enough it can stay here for now.
-        ctx.start_process(['ip', 'addr','add', hapd.ifname, '192.168.1.1/255.255.255.0']).wait()
+        ctx.start_process(['ip', 'addr','add', '192.168.1.1/255.255.255.0',
+                            'dev', hapd.ifname]).wait()
         ctx.start_process(['touch', '/tmp/dhcpd.leases']).wait()
         cls.dhcpd_pid = ctx.start_process(['dhcpd', '-f', '-cf', '/tmp/dhcpd.conf',
                                             '-lf', '/tmp/dhcpd.leases',
Signature · 1 line
2.34.1
author
#6 lore raw

PATCH 7/7 auto-t: test-wide replacement of assertTrue(list_sta())

In reply to James Prestwood

Any test using assertTrue(hostapd.list_sta()) improperly has been replaced with wait_for_event(). There were a few places where this was actually ok (i.e. IWD is already connected) but most needed to be changed since the check was just after IWD connected and hostapd's list_sta() API may not return a fully updated list.

---
 autotests/testAPRoam/connection_test.py        | 5 ++---
 autotests/testFT-8021x-roam/connection_test.py | 4 ++--
 autotests/testFT-FILS/connection_test.py       | 8 +++++---
 autotests/testOWE/connection_test.py           | 2 +-
 autotests/testPreauth-roam/connection_test.py  | 4 ++--
 5 files changed, 12 insertions(+), 11 deletions(-)
autotests/testAPRoam/connection_test.py +2 -3
index c7037231..41d70f3a 100644
@@ -36,7 +36,6 @@ class Test(unittest.TestCase):
 
         bss_hostapd[0].wait_for_event('AP-STA-CONNECTED')
 
-        self.assertTrue(bss_hostapd[0].list_sta())
         self.assertFalse(bss_hostapd[1].list_sta())
 
         bss_hostapd[0].send_bss_transition(device.address,
@@ -51,8 +50,8 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertEqual(device.state, iwd.DeviceState.connected)
-        self.assertTrue(bss_hostapd[1].list_sta())
+        bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
         device.disconnect()
 
         condition = 'not obj.connected'
autotests/testFT-8021x-roam/connection_test.py +2 -2
index 652677a9..6853bdb0 100644
@@ -27,7 +27,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertTrue(self.bss_hostapd[0].list_sta())
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
         self.assertFalse(self.bss_hostapd[1].list_sta())
 
         testutil.test_iface_operstate(device.name)
@@ -46,7 +46,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(self.bss_hostapd[1].list_sta())
+        self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
autotests/testFT-FILS/connection_test.py +5 -3
index 4aef8db6..c1deb77c 100644
@@ -28,7 +28,8 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertTrue(self.bss_hostapd[0].list_sta())
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
         self.assertFalse(self.bss_hostapd[1].list_sta())
 
         testutil.test_iface_operstate(device.name)
@@ -51,7 +52,8 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertTrue(self.bss_hostapd[0].list_sta())
+        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
+
         self.assertFalse(self.bss_hostapd[1].list_sta())
 
         testutil.test_iface_operstate(device.name)
@@ -77,7 +79,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(self.bss_hostapd[1].list_sta())
+        self.bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
autotests/testOWE/connection_test.py +1 -1
index baef4d49..391d8cf5 100644
@@ -60,7 +60,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(hapd1.list_sta())
+        hapd1.wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(hapd1.ifname, device.name)
autotests/testPreauth-roam/connection_test.py +2 -2
index 61f095d3..26475698 100644
@@ -49,7 +49,7 @@ class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
 
-        self.assertTrue(bss_hostapd[0].list_sta())
+        bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
         self.assertFalse(bss_hostapd[1].list_sta())
 
         testutil.test_iface_operstate(device.name)
@@ -70,7 +70,7 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        self.assertTrue(bss_hostapd[1].list_sta())
+        bss_hostapd[1].wait_for_event('AP-STA-CONNECTED %s' % device.address)
 
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(bss_hostapd[1].ifname, device.name)
Signature · 1 line
2.34.1
#7 lore raw
In reply to James Prestwood

Hi James,

Quoted 7 lines · James Prestwood

It looks like some architectures defconfig were adding these in automatically, but not others. Explicitly add these to make sure the kernel is built correctly.

---
  tools/test_runner_kernel_config | 11 +++++++++++
  1 file changed, 11 insertions(+)

All applied, thanks.

Regards,
-Denis