]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Use a single set of scripts for running both P2P and AP tests
authorJouni Malinen <j@w1.fi>
Sun, 31 Mar 2013 13:22:28 +0000 (16:22 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 31 Mar 2013 15:05:31 +0000 (18:05 +0300)
This removes the unnecessary separation of P2P (no hostapd) and AP
tests. The same scripts can be used to prepare for these tests and to
execute the tests.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/run-all.sh
tests/hwsim/run-p2p-tests.py [deleted file]
tests/hwsim/run-tests.py [moved from tests/hwsim/run-ap-tests.py with 98% similarity]
tests/hwsim/start-p2p.sh [deleted file]
tests/hwsim/start.sh [moved from tests/hwsim/start-ap.sh with 100% similarity]

index ee29480b339b51bb166d08010b82cb603d65d9f1..51b230ba419cb911cc5e3de2c2b64b8551cf7a92 100755 (executable)
@@ -2,10 +2,8 @@
 
 errors=0
 umask 0002
-./start-p2p.sh
-./run-p2p-tests.py || errors=1
-./start-ap.sh
-./run-ap-tests.py || errors=1
+./start.sh
+./run-tests.py || errors=1
 ./stop-wifi.sh
 if [ $errors -gt 0 ]; then
     exit 1
diff --git a/tests/hwsim/run-p2p-tests.py b/tests/hwsim/run-p2p-tests.py
deleted file mode 100755 (executable)
index 5ae06d2..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/python
-#
-# P2P tests
-# Copyright (c) 2013, Jouni Malinen <j@w1.fi>
-#
-# This software may be distributed under the terms of the BSD license.
-# See README for more details.
-
-import os
-import re
-import sys
-import time
-
-import logging
-
-from wpasupplicant import WpaSupplicant
-
-def main():
-    idx = 1
-    if len(sys.argv) > 1 and sys.argv[1] == '-d':
-        logging.basicConfig(level=logging.DEBUG)
-        idx = idx + 1
-    elif len(sys.argv) > 1 and sys.argv[1] == '-q':
-        logging.basicConfig(level=logging.WARNING)
-        idx = idx + 1
-    else:
-        logging.basicConfig(level=logging.INFO)
-
-    if len(sys.argv) > idx:
-        test_filter = sys.argv[idx]
-    else:
-        test_filter = None
-
-    dev0 = WpaSupplicant('wlan0')
-    dev1 = WpaSupplicant('wlan1')
-    dev2 = WpaSupplicant('wlan2')
-    dev = [ dev0, dev1, dev2 ]
-
-    for d in dev:
-        if not d.ping():
-            print d.ifname + ": No response from wpa_supplicant"
-            return
-        d.reset()
-        print "DEV: " + d.ifname + ": " + d.p2p_dev_addr()
-
-    tests = []
-    for t in os.listdir("."):
-        m = re.match(r'(test_p2p_.*)\.py$', t)
-        if m:
-            print "Import test cases from " + t
-            mod = __import__(m.group(1))
-            for s in dir(mod):
-                if s.startswith("test_"):
-                    func = mod.__dict__.get(s)
-                    tests.append(func)
-
-    passed = []
-    failed = []
-
-    for t in tests:
-        if test_filter:
-            if test_filter != t.__name__:
-                continue
-        for d in dev:
-            d.reset()
-        print "START " + t.__name__
-        if t.__doc__:
-            print "Test: " + t.__doc__
-        for d in dev:
-            d.request("NOTE TEST-START " + t.__name__)
-        try:
-            t(dev)
-            passed.append(t.__name__)
-            print "PASS " + t.__name__
-        except Exception, e:
-            print e
-            failed.append(t.__name__)
-            print "FAIL " + t.__name__
-        for d in dev:
-            d.request("NOTE TEST-STOP " + t.__name__)
-
-    if not test_filter:
-        for d in dev:
-            d.reset()
-
-    print "passed tests: " + str(passed)
-    print "failed tests: " + str(failed)
-    if len(failed):
-        sys.exit(1)
-
-if __name__ == "__main__":
-    main()
similarity index 98%
rename from tests/hwsim/run-ap-tests.py
rename to tests/hwsim/run-tests.py
index 14eab10c8865fb602558b394f83da8404d4dcd44..382a0fb595586a792caa2329f539256fe243570a 100755 (executable)
@@ -58,7 +58,7 @@ def main():
 
     tests = []
     for t in os.listdir("."):
-        m = re.match(r'(test_ap_.*)\.py$', t)
+        m = re.match(r'(test_.*)\.py$', t)
         if m:
             print "Import test cases from " + t
             mod = __import__(m.group(1))
diff --git a/tests/hwsim/start-p2p.sh b/tests/hwsim/start-p2p.sh
deleted file mode 100755 (executable)
index f91932f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-DIR="$( cd "$( dirname "$0" )" && pwd )"
-WPAS=$DIR/../../wpa_supplicant/wpa_supplicant
-WLANTEST=$DIR/../../wlantest/wlantest
-
-$DIR/stop-wifi.sh
-sudo modprobe mac80211_hwsim radios=3
-mkdir -p $DIR/logs
-DATE=`date +%s`
-sudo ifconfig hwsim0 up
-sudo $WLANTEST -i hwsim0 -c -d > $DIR/logs/$DATE-hwsim0 &
-sudo $WPAS -Dnl80211 -iwlan0 -c $DIR/p2p0.conf -ddKt > $DIR/logs/$DATE-log0 &
-sudo $WPAS -Dnl80211 -iwlan1 -c $DIR/p2p1.conf -ddKt > $DIR/logs/$DATE-log1 &
-sudo $WPAS -Dnl80211 -iwlan2 -c $DIR/p2p2.conf -ddKt > $DIR/logs/$DATE-log2 &
-sleep 1
similarity index 100%
rename from tests/hwsim/start-ap.sh
rename to tests/hwsim/start.sh