From 7ebc7e8fa64c0ef73dcf180ddf5f0178e83b9922 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 8 Feb 2015 22:06:07 +0200 Subject: [PATCH] tests: wpa_supplicant DUMP/GET global parameter Signed-off-by: Jouni Malinen --- tests/hwsim/test_wpas_ctrl.py | 14 ++++++++++++++ tests/hwsim/wpasupplicant.py | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/tests/hwsim/test_wpas_ctrl.py b/tests/hwsim/test_wpas_ctrl.py index b2144f71b..00bde0a8a 100644 --- a/tests/hwsim/test_wpas_ctrl.py +++ b/tests/hwsim/test_wpas_ctrl.py @@ -1333,3 +1333,17 @@ def test_wpas_ctrl_misc(dev, apdev): raise Exception("Invalid INTERFACE_REMOVE accepted") if "FAIL" not in dev[0].global_request("SET foo"): raise Exception("Invalid global SET accepted") + +def test_wpas_ctrl_dump(dev, apdev): + """wpa_supplicant ctrl_iface and DUMP/GET global parameters""" + vals = dev[0].get_config() + logger.info("Config values from DUMP: " + str(vals)) + for field in vals: + res = dev[0].request("GET " + field) + if res == 'FAIL\n': + res = "null" + if res != vals[field]: + print "'{}' != '{}'".format(res, vals[field]) + raise Exception("Mismatch in config field " + field) + if "beacon_int" not in vals: + raise Exception("Missing config field") diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index aa6b33439..4f1f17653 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -1050,3 +1050,14 @@ class WpaSupplicant: def get_group_ifname(self): return self.group_ifname if self.group_ifname else self.ifname + + def get_config(self): + res = self.request("DUMP") + if res.startswith("FAIL"): + raise Exception("DUMP failed") + lines = res.splitlines() + vals = dict() + for l in lines: + [name,value] = l.split('=', 1) + vals[name] = value + return vals