[PATCH v4 2/3] tests: Check wmediumd version

Masashi Honma masashi.honma at gmail.com
Thu Mar 9 15:12:29 PST 2017


Some wmediumd tests requires new wmediumd features. Modified SNR table,
location-based config and log levels. The wmediumd 0.2 does not have
these features, so skip such a tests.

Signed-off-by: Masashi Honma <masashi.honma at gmail.com>
---
 tests/hwsim/test_wmediumd.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/tests/hwsim/test_wmediumd.py b/tests/hwsim/test_wmediumd.py
index 9da54d3..a3e475b 100644
--- a/tests/hwsim/test_wmediumd.py
+++ b/tests/hwsim/test_wmediumd.py
@@ -11,6 +11,9 @@ from test_wpas_mesh import check_mesh_support, check_mesh_group_added
 from test_wpas_mesh import check_mesh_peer_connected, add_open_mesh_network
 from test_wpas_mesh import check_mesh_group_removed
 
+class LocalVariables:
+    is_old_wmediumd = None
+
 CFG = """
 ifaces :
 {
@@ -34,6 +37,26 @@ ifaces :
 };
 """
 
+def check_wmediumd_version():
+    if LocalVariables.is_old_wmediumd != None:
+        if LocalVariables.is_old_wmediumd:
+            raise HwsimSkip('wmediumd not available')
+        return
+
+    try:
+        stdoutdata = subprocess.check_output(['wmediumd', '-V'])
+    except OSError, e:
+        if e.errno == errno.ENOENT:
+            LocalVariables.is_old_wmediumd = True
+            raise HwsimSkip('wmediumd not available')
+        raise
+
+    if stdoutdata.find('wmediumd v0.2 ') > -1:
+        LocalVariables.is_old_wmediumd = True
+        raise HwsimSkip('wmediumd not available')
+    else:
+        LocalVariables.is_old_wmediumd = False
+
 def output_wmediumd_log(p, params, data):
     log_file = open(os.path.abspath(os.path.join(params['logdir'],
                                                  'wmediumd.log')), 'a')
@@ -93,6 +116,7 @@ def test_wmediumd_path_simple(dev, apdev, params):
     # |           |
     # +-----X-----+
     # This tests if 1 and 2 can communicate each other via 0.
+    check_wmediumd_version()
     fd, fn = tempfile.mkstemp()
     try:
         f = os.fdopen(fd, 'w')
-- 
2.7.4




More information about the Hostap mailing list