From 119562cfdfa3c2de20a3c7f90d95bc96687d6ffa Mon Sep 17 00:00:00 2001
From: Jouni Malinen <jouni@qca.qualcomm.com>
Date: Thu, 19 Nov 2015 17:33:34 +0200
Subject: [PATCH] tests: Clear FST sessions at the end of fst_setup_mbie_diff

This avoids issues with following test cases failing due to unexpected
starting state. This issue showed up with the following hwsim test case
sequence:
fst_setup_mbie_diff fst_dynamic_iface_attach

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
---
 tests/hwsim/test_fst_module.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tests/hwsim/test_fst_module.py b/tests/hwsim/test_fst_module.py
index 1f62db121..6ba70a874 100644
--- a/tests/hwsim/test_fst_module.py
+++ b/tests/hwsim/test_fst_module.py
@@ -2538,6 +2538,13 @@ def _test_fst_setup_mbie_diff(dev, apdev, test_params):
         fst_setup_req(wpas, hglobal, 5180, apdev[0]['bssid'], req, stie, mbie,
                       no_wait=True)
 
+    # Remove sessions to avoid causing issues to following test ases
+    s = hglobal.request("FST-MANAGER LIST_SESSIONS " + group)
+    if not s.startswith("FAIL"):
+        for sid in s.split(' '):
+            if len(sid):
+                hglobal.request("FST-MANAGER SESSION_REMOVE " + sid)
+
 def test_fst_many_setup(dev, apdev, test_params):
     """FST setup multiple times"""
     try: