[PATCH 1/6] tests: pass apdev to add_ap() function

Jouni Malinen j at w1.fi
Sun Apr 3 14:18:03 PDT 2016


On Wed, Mar 30, 2016 at 10:55:56AM +0200, Janusz Dziedzic wrote:
> Pass apdev to the add_ap() function instead
> of ifname. In such case we can handle also
> remote hosts while we can check apdev['hostname'],
> apdev['port'].

>  64 files changed, 1197 insertions(+), 1182 deletions(-)

This was too long a patch to be accepted on the mailing list. Anyway, I
did apply this in a bit cleaned up version after splitting the commit to
smaller pieces to make it easier to review. There was some indentation
issues that I hopefully caught and fixed.

> diff --git a/tests/hwsim/fst_module_aux.py b/tests/hwsim/fst_module_aux.py
> @@ -610,7 +610,8 @@ class FstAP (FstDevice):
> -        self.hapd=hostapd.add_ap(self.iface, params)
> +        ap = { "ifname" : self.iface }
> +        self.hapd=hostapd.add_ap(ap, params)

I dropped this type of changes in the FST test cases. I don't see much
point in creating a fake apdev dict within a test case, i.e., I would
use only the apdev dict from run-tests.php as an actual input to
hostapd.add_ap().

> diff --git a/tests/hwsim/hostapd.py b/tests/hwsim/hostapd.py
> @@ -339,9 +339,16 @@ class Hostapd:
> -def add_ap(ifname, params, wait_enabled=True, no_enable=False, timeout=30,
> -           hostname=None, port=8878):
> -        logger.info("Starting AP " + ifname)
> +def add_ap(apdev, params, wait_enabled=True, no_enable=False, timeout=30):
> +        ifname = apdev['ifname']

This being Python, the function here can easily check whether apdev is a
dict an use the new style only then. I did that here and left those FST
cases as backwards compatibility mode for now. They can eventually be
converted, if desired, but for now, they work fine for the local hwsim
testing case.

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list