1# Module tests
2# Copyright (c) 2014, Jouni Malinen <j@w1.fi>
3#
4# This software may be distributed under the terms of the BSD license.
5# See README for more details.
6
7import os
8import time
9
10import hostapd
11
12def test_module_wpa_supplicant(dev, apdev, params):
13    """wpa_supplicant module tests"""
14    if "OK" not in dev[0].global_request("MODULE_TESTS"):
15        raise Exception("Module tests failed")
16    # allow eloop test to complete
17    time.sleep(0.75)
18    dev[0].relog()
19    with open(os.path.join(params['logdir'], 'log0'), 'r') as f:
20        res = f.read()
21        if "FAIL - should not have called this function" in res:
22            raise Exception("eloop test failed")
23
24def test_module_hostapd(dev):
25    """hostapd module tests"""
26    hapd_global = hostapd.HostapdGlobal()
27    if "OK" not in hapd_global.ctrl.request("MODULE_TESTS"):
28        raise Exception("Module tests failed")
29