Changeset 1507

Show
Ignore:
Timestamp:
06/06/08 10:56:59 (7 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1506 r1507  
    112008-06-06  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * qa/base.py (TestBase.has_module), 
     4        qa/util.py (cherokee_has_plugin): The base.has_module() is 
     5        replaced with cherokee_has_plugin() helper function. It is now 
     6        able to detect both dynamic and built-in plug-ins. 
    27 
    38        * cherokee/main.c: Added a new -i, --print-server-info parameter. 
  • cherokee/trunk/qa/061-PAM.py

    r1496 r1507  
    4242 
    4343        # Check that pam module was compiled 
    44         if not self.has_module("pam"): 
     44        if not cherokee_has_plugin("pam"): 
    4545            return False 
    4646 
  • cherokee/trunk/qa/167-RuleGeoIP.py

    r1497 r1507  
    3939        return True 
    4040        # Check that pam module was compiled 
    41         if not self.has_module("geoip"): 
     41        if not cherokee_has_plugin("geoip"): 
    4242            return False 
    4343        return True 
  • cherokee/trunk/qa/base.py

    r1496 r1507  
    341341            return final 
    342342 
    343     def has_module (self, module): 
    344         try: 
    345             pams = filter(lambda x: module in x, os.listdir(CHEROKEE_MODS)) 
    346             if len(pams) < 1: 
    347                 return False 
    348         except: 
    349             return False 
    350         return True 
    351  
    352343 
    353344class TestCollection: 
  • cherokee/trunk/qa/util.py

    r1225 r1507  
    145145    __free_port += 1 
    146146    return __free_port 
     147 
     148 
     149_built_in_list      = [] 
     150_built_in_list_done = False 
     151 
     152def cherokee_has_plugin (module): 
     153    # Check for the dynamic plug-in 
     154    try: 
     155        mods = filter(lambda x: module in x, os.listdir(CHEROKEE_MODS)) 
     156        if len(mods) >= 1: 
     157            return True 
     158    except: 
     159        pass 
     160 
     161    # Let's see whether it's built-in 
     162    global _built_in_list 
     163    global _built_in_list_done 
     164 
     165    if not _built_in_list_done: 
     166        _built_in_list_done = True 
     167 
     168        f = os.popen ("%s -i" % (CHEROKEE_PATH)) 
     169        cont = f.read() 
     170        f.close() 
     171         
     172        try: 
     173            line = filter(lambda x: x.startswith (" Built-in: "), cont.split("\n"))[0] 
     174            line = line.replace(" Built-in: ", "") 
     175            _built_in_list = line.split(" ") 
     176        except: 
     177            pass 
     178 
     179    return module in _built_in_list 
     180