Example #1
0
def process_args():
    import functest
    functest.configure()
    functest.registry['functest_cli'] = True
    
    args = list(sys.argv)
    if args[0].endswith('functest') or args[0].endswith('functest.py') or args[0].endswith('functest.exe'):
        args.pop(0)
    
    # Create options
    def set_pdb(x): global_settings.pdb = True; global_settings.wrap_stdout = False
    def set_nowrap(x): global_settings.wrap_stdout = False ; global_settings.wrap_stderr = False
    def set_stdout(x): global_settings.wrap_stdout = False
    def set_stdout(x): global_settings.wrap_stderr = False
    def set_bigtb(x): global_settings.bigtb = True
    def set_filter(x): global_settings.test_filter = x
    def set_help(x): print(usage); sys.exit()
    builtin_options = dict([ (k.replace('set_', ''), v,) for k, v in locals().items() if k.startswith('set_') ])
    
    options = [ x.replace('--', '') for x in args ]
    
    for option in options:
        if option.find('=') is not -1:
            key, value = option.split('=')
        else:
            key = option; value = None
        if key in builtin_options.keys():
            builtin_options[key](value)
        elif value is not None:
            functest.registry[key] = value
        else:
            functest.modules_passed.append(option)
            
    return functest.modules_passed
Example #2
0
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import windmill
import logging
from time import sleep
import os, sys
from datetime import datetime
from threading import Thread
import shutil
import socket
import functest
functest.configure()

def process_options(argv_list):
    """Process all the command line options"""
    import admin_options
    admin_options.process_module(admin_options)
    argv_list.pop(0)
    
    action = None
    
    # This might be the hairiest code in windmill :)
    # We have a very specific way we need to parse arguments 
    # because of the way different arguments interact with each other
    # 8/27/2007 Gawd this is ugly, i would love to refactor this but I've
    # forgotten what it does -Mikeal
    # 12/15/2007 Oh man, I'm going to add a feature to this without refactoring it.