diff mbox

[5/8] tests: setup the wlantest only once in check_qos_map()

Message ID 1466702196-26828-5-git-send-email-jonathan@wizery.com
State Changes Requested
Headers show

Commit Message

Jonathan Afek June 23, 2016, 5:16 p.m. UTC
Some tests call the check_qos_map() func more than once.
Make sure it setups the wlantest only once on the first
time it is called.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
---
 tests/hwsim/test_ap_qosmap.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jouni Malinen June 27, 2016, 10:46 a.m. UTC | #1
On Thu, Jun 23, 2016 at 08:16:33PM +0300, Jonathan Afek wrote:
> Some tests call the check_qos_map() func more than once.
> Make sure it setups the wlantest only once on the first
> time it is called.

> diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py
> @@ -17,7 +17,8 @@ def check_qos_map(ap, hapd, dev, sta, dscp, tid, ap_tid=None):

> -    Wlantest.setup(hapd)
> +    if not Wlantest.setup_done:
> +        Wlantest.setup(hapd)

Is this really the correct thing to do? Isn't that Wlantest.setup_done
shared through all test cases? What if the QoS mapping test cases get
run after a test case that used wlantest on another channel? If this
commit is trying to optimize test execution (the commit message should
really provide the reason for doing this change..), that would likely
need to be done by maintaining a local variable for the test case(s) in
question rather than relying on Wlantest.setup_done.
Jonathan Afek July 13, 2016, 5 p.m. UTC | #2
On Mon, Jun 27, 2016 at 12:46 PM, Jouni Malinen <j@w1.fi> wrote:
> Is this really the correct thing to do? Isn't that Wlantest.setup_done
> shared through all test cases?
It is not shared. The wlantest state is reset between tests.
> If this
> commit is trying to optimize test execution (the commit message should
> really provide the reason for doing this change..), that would likely
> need to be done by maintaining a local variable for the test case(s) in
> question rather than relying on Wlantest.setup_done.
Sending another version.
diff mbox

Patch

diff --git a/tests/hwsim/test_ap_qosmap.py b/tests/hwsim/test_ap_qosmap.py
index 48348bf..a98176b 100644
--- a/tests/hwsim/test_ap_qosmap.py
+++ b/tests/hwsim/test_ap_qosmap.py
@@ -17,7 +17,8 @@  def check_qos_map(ap, hapd, dev, sta, dscp, tid, ap_tid=None):
     if not ap_tid:
         ap_tid = tid
     bssid = ap['bssid']
-    Wlantest.setup(hapd)
+    if not Wlantest.setup_done:
+        Wlantest.setup(hapd)
     wt = Wlantest()
     wt.clear_sta_counters(bssid, sta)
     hwsim_utils.test_connectivity(dev, hapd, dscp=dscp, config=False)