[PATCH] hwsim tests: reset at the end of a test

Johannes Berg johannes
Wed Oct 30 14:54:35 PDT 2013


From: Johannes Berg <johannes.berg at intel.com>

Resetting at the beginning causes the reset logging/tracing
data to leak from the previous test into the next, and the
last one being missed at all - reset at the end of each run
instead. Also reset before all tests just in case running a
test actually crashed the python script.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 tests/hwsim/run-tests.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 080d151..a772e05 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -201,6 +201,10 @@ def main():
     skipped = []
     failed = []
 
+    # make sure nothing is left over from previous runs
+    # (if there were any other manual runs or we crashed)
+    reset_devs(dev, apdev)
+
     if args.dmesg:
         subprocess.call(['dmesg', '-c'], stdout=open('/dev/null', 'w'))
 
@@ -212,7 +216,6 @@ def main():
             if not t.__module__ in args.testmodules:
                 continue
         with DataCollector(args.logdir, t.__name__, args.tracing, args.dmesg):
-            reset_devs(dev, apdev)
             logger.info("START " + t.__name__)
             if log_to_file:
                 print "START " + t.__name__
@@ -276,9 +279,7 @@ def main():
                 except Exception, e:
                     logger.info("Failed to issue TEST-STOP after " + t.__name__ + " for " + d.ifname)
                     logger.info(e)
-
-    if not args.tests:
-        reset_devs(dev, apdev)
+            reset_devs(dev, apdev)
 
     if conn:
         conn.close()
-- 
1.8.4.rc3




More information about the Hostap mailing list