From 6a4f24c9207a88a3e56384be89131068ab70a84a Mon Sep 17 00:00:00 2001 From: Rahul Rahul Date: Mon, 25 Jul 2016 15:13:38 -0700 Subject: [PATCH] autotests: test1AP: fix hw.conf for test-runner --- autotests/test1AP/APShutdownTest.py | 8 +++++--- autotests/test1AP/IntelWIFI_CCMP.conf | 3 --- autotests/test1AP/IntelWIFI_TKIP.conf | 3 --- autotests/test1AP/connectDisconnectTest.py | 3 ++- autotests/test1AP/hw.conf | 5 +++-- autotests/test1AP/invalidPassphrase.conf | 5 +---- autotests/test1AP/invalidPassphraseTest.py | 5 ++++- autotests/test1AP/scanNetworkTest.py | 3 ++- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/autotests/test1AP/APShutdownTest.py b/autotests/test1AP/APShutdownTest.py index 51ea4362..756658f3 100755 --- a/autotests/test1AP/APShutdownTest.py +++ b/autotests/test1AP/APShutdownTest.py @@ -32,7 +32,8 @@ class TestAPShutdown(unittest.TestCase): stdout_handle.close() os.close(slave) - networkToConnect = utility.getNetworkToConnectTo(objectList) + networkToConnect = utility.getNetworkToConnectTo(objectList, + "IntelWIFI") # check if networkToConnect is not null. If yes, restart program # so that the network list is updated. Alternatively, we can scan # for networks. @@ -58,10 +59,10 @@ class TestAPShutdown(unittest.TestCase): "IntelWIFI") #kill AP - pid_bytes = check_output("pgrep hostapd", shell=True) + pid_bytes = check_output("pgrep -o -x hostapd", shell=True) pid = pid_bytes.decode('utf-8') logger.debug("shutting down AP with pid: %s", pid) - os.system("kill %d"%int(pid)) + os.system("kill " + pid) #should not be connected to any network after AP shutdown logger.info("After AP shutdown, connected to: %s", @@ -82,6 +83,7 @@ class TestAPShutdown(unittest.TestCase): @classmethod def setUpClass(cls): global logger, bus, mainloop + os.system("rm -rf /var/lib/iwd") utility.initLogger() logger = logging.getLogger(__name__) bus = dbus.SystemBus() diff --git a/autotests/test1AP/IntelWIFI_CCMP.conf b/autotests/test1AP/IntelWIFI_CCMP.conf index a6950530..23ba82f8 100644 --- a/autotests/test1AP/IntelWIFI_CCMP.conf +++ b/autotests/test1AP/IntelWIFI_CCMP.conf @@ -1,6 +1,3 @@ -interface=wln0 -driver=nl80211 - hw_mode=g channel=1 ssid=IntelWIFI diff --git a/autotests/test1AP/IntelWIFI_TKIP.conf b/autotests/test1AP/IntelWIFI_TKIP.conf index 91d44ae5..85379d6b 100644 --- a/autotests/test1AP/IntelWIFI_TKIP.conf +++ b/autotests/test1AP/IntelWIFI_TKIP.conf @@ -1,6 +1,3 @@ -interface=wln0 -driver=nl80211 - hw_mode=g channel=1 ssid=IntelWIFI diff --git a/autotests/test1AP/connectDisconnectTest.py b/autotests/test1AP/connectDisconnectTest.py index ad1b5e1d..69ffa9f5 100755 --- a/autotests/test1AP/connectDisconnectTest.py +++ b/autotests/test1AP/connectDisconnectTest.py @@ -31,7 +31,8 @@ class TestConnectDisconnect(unittest.TestCase): stdout_handle.close() os.close(slave) - networkToConnect = utility.getNetworkToConnectTo(objectList) + networkToConnect = utility.getNetworkToConnectTo(objectList, + "IntelWIFI") # check if networkToConnect is not null. If yes, restart program # so that the network list is updated. Alternatively, we can scan # for networks. diff --git a/autotests/test1AP/hw.conf b/autotests/test1AP/hw.conf index c78b11aa..6faafe0e 100644 --- a/autotests/test1AP/hw.conf +++ b/autotests/test1AP/hw.conf @@ -1,5 +1,6 @@ [SETUP] -num_radios=2 +num_radios=3 [HOSTAPD] -rad0=IntelWIFI.conf +rad0=IntelWIFI_TKIP.conf +rad1=invalidPassphrase.conf diff --git a/autotests/test1AP/invalidPassphrase.conf b/autotests/test1AP/invalidPassphrase.conf index 9f9afdb9..18796eb1 100644 --- a/autotests/test1AP/invalidPassphrase.conf +++ b/autotests/test1AP/invalidPassphrase.conf @@ -1,9 +1,6 @@ -interface=wln0 -driver=nl80211 - hw_mode=g channel=1 -ssid=IntelWIFI +ssid=IntelWIFI_WrongPW wpa=1 wpa_pairwise=TKIP diff --git a/autotests/test1AP/invalidPassphraseTest.py b/autotests/test1AP/invalidPassphraseTest.py index 6245655d..3239f4ee 100755 --- a/autotests/test1AP/invalidPassphraseTest.py +++ b/autotests/test1AP/invalidPassphraseTest.py @@ -9,6 +9,7 @@ import logging import os from subprocess import Popen, PIPE, STDOUT import sys +import subprocess sys.path.append('../utility') #needed to import all the utility modules import utility import pty @@ -31,7 +32,8 @@ class TestInvalidPassphrase(unittest.TestCase): stdout_handle.close() os.close(slave) - networkToConnect = utility.getNetworkToConnectTo(objectList) + networkToConnect = utility.getNetworkToConnectTo(objectList, + "IntelWIFI_WrongPW") # check if networkToConnect is not null. If yes, restart program # so that the network list is updated. Alternatively, we can scan # for networks. @@ -66,6 +68,7 @@ class TestInvalidPassphrase(unittest.TestCase): @classmethod def setUpClass(cls): global logger, bus, mainloop + os.system("rm -rf /var/lib/iwd") utility.initLogger() logger = logging.getLogger(__name__) bus = dbus.SystemBus() diff --git a/autotests/test1AP/scanNetworkTest.py b/autotests/test1AP/scanNetworkTest.py index d9d390bf..b75588fd 100755 --- a/autotests/test1AP/scanNetworkTest.py +++ b/autotests/test1AP/scanNetworkTest.py @@ -23,7 +23,8 @@ class TestScanNetwork(unittest.TestCase): os.execl(sys.executable, sys.executable, * sys.argv) logger.info("Network Found: %s", networkName) - self.assertEqual(networkName, "IntelWIFI") + networkListToMatch = ["IntelWIFI", "IntelWIFI_WrongPW"] + self.assertIn(networkName, networkListToMatch) @classmethod def setUpClass(cls):