From 863a54093ddb0d9568afe96848ad636964987ab2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 20 Dec 2014 16:46:39 +0200 Subject: [PATCH] tests: rfkill block prior to wpa_supplicant start Signed-off-by: Jouni Malinen --- tests/hwsim/test_rfkill.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/hwsim/test_rfkill.py b/tests/hwsim/test_rfkill.py index 376f62e38..a0b5b2aca 100644 --- a/tests/hwsim/test_rfkill.py +++ b/tests/hwsim/test_rfkill.py @@ -12,6 +12,7 @@ import time import hostapd from hostapd import HostapdGlobal import hwsim_utils +from wpasupplicant import WpaSupplicant def get_rfkill_id(dev): try: @@ -165,3 +166,26 @@ def test_rfkill_hostapd(dev, apdev): raise Exception("ENABLE succeeded unexpectedly (rfkill)") finally: subprocess.call(['rfkill', 'unblock', id]) + +def test_rfkill_wpas(dev, apdev): + """rfkill block prior to wpa_supplicant start""" + wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5') + wpas.interface_add("wlan5") + id = get_rfkill_id(wpas) + if id is None: + return "skip" + wpas.interface_remove("wlan5") + try: + subprocess.call(['rfkill', 'block', id]) + wpas.interface_add("wlan5") + time.sleep(0.5) + state = wpas.get_status_field("wpa_state") + if state != "INTERFACE_DISABLED": + raise Exception("Unexpected state with rfkill blocked: " + state) + subprocess.call(['rfkill', 'unblock', id]) + time.sleep(0.5) + state = wpas.get_status_field("wpa_state") + if state == "INTERFACE_DISABLED": + raise Exception("Unexpected state with rfkill unblocked: " + state) + finally: + subprocess.call(['rfkill', 'unblock', id])