Exemple #1
0
def module_init():
    """ Called at import """
    args = Options().args
    # Change the current working directory to where all test
    # collections are supposed to reside
    # If script executed with (python test-run.py) dirname is ''
    # so we need to make it .
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    setenv()

    warn_unix_sockets_at_start(args.vardir)

    # always run with clean (non-existent) 'var' directory
    try:
        shutil.rmtree(args.vardir)
    except OSError:
        pass

    args.builddir = os.path.abspath(os.path.expanduser(args.builddir))

    SOURCEDIR = os.path.dirname(os.getcwd())
    BUILDDIR = args.builddir
    os.environ["SOURCEDIR"] = SOURCEDIR
    os.environ["BUILDDIR"] = BUILDDIR
    soext = sys.platform == 'darwin' and 'dylib' or 'so'
    os.environ[
        "LUA_PATH"] = SOURCEDIR + "/?.lua;" + SOURCEDIR + "/?/init.lua;;"
    os.environ["LUA_CPATH"] = BUILDDIR + "/?." + soext + ";;"

    TarantoolServer.find_exe(args.builddir)
    UnittestServer.find_exe(args.builddir)
Exemple #2
0
def run_project(args):
    options = Options()
    options.parse(args)

    if options.known.do_clippings:
        clip = Clippings(options.known.directory)
        clip.parse()
Exemple #3
0
def main(workflow):
    query = "" if len(workflow.args) == 0 else workflow.args[0]

    config = workflow.stored_data("configuration")
    if config == None:
        Options.warning(
            "Didn't find your configuration",
            "Please supply your cheat sheet path using 'cf ~/your/path'",
            workflow)
        workflow.send_feedback()
        return -1

    parser = Parser(config.getPath())
    options = Options(parser, workflow)

    tokens = query.strip().split(" ", 1)
    tokens = [i.strip() for i in tokens if i != ""]

    if len(tokens) < 2:
        sheetName = "" if len(tokens) == 0 else tokens[0]
        handler = options.showAvailable if sheetName not in parser.availableSheets(
        ) else options.list
        handler(sheetName)
    else:
        sheetName = tokens[0]
        searchTerm = tokens[1]
        if sheetName == "--search":
            options.search(None, searchTerm)
        else:
            options.search(sheetName, searchTerm)

    workflow.send_feedback()
    return None
Exemple #4
0
 def __init__(self, options=None):
     self.options = options or Options()
     self.rsyslog = Rsyslog()
     self.leef = Leef(options)
     self.cef = Cef(options)
     self.sumo = Sumologic()
     self.event_handler = EventHandler()
Exemple #5
0
    def __init__(self, ini, test_suite=None):
        self.core = ini['core']
        self.ini = ini
        self.vardir = ini['vardir']
        self.inspector_port = int(
            ini.get('inspector_port', self.DEFAULT_INSPECTOR))
        self.disable_schema_upgrade = Options().args.disable_schema_upgrade
        self.snapshot_path = Options().args.snapshot_path

        # filled in {Test,AppTest,LuaTest,PythonTest}.execute()
        # or passed through execfile() for PythonTest (see
        # TarantoolServer.__init__).
        self.current_test = None

        # Used in valgrind_log property. 'test_suite' is not None only for
        # default servers running in TestSuite.run_all()
        self.test_suite = test_suite
Exemple #6
0
 def __init__(self):
     self.scans = ScansController()
     self.servers = ServersController()
     self.queues = QueuesController()
     self.date = DateController()
     self.opts = Options().params()
     self.path = os.path.join(os.path.dirname(__file__), 'details/')
     self.queues.setup_thread(self.files_consumer)
     self.queues.setup_thread(self.scans_consumer)
Exemple #7
0
def module_init():
    """ Called at import """
    args = Options().args
    # Change the current working directory to where all test
    # collections are supposed to reside
    # If script executed with (python test-run.py) dirname is ''
    # so we need to make it .
    path = os.path.dirname(sys.argv[0])
    if not path:
        path = '.'
    os.chdir(path)
    setenv()

    # Keep the PWD environment variable in sync with a current
    # working directory. It does not strictly necessary, just to
    # avoid any confusion.
    os.environ['PWD'] = os.getcwd()

    warn_unix_sockets_at_start(args.vardir)

    # always run with clean (non-existent) 'var' directory
    try:
        shutil.rmtree(args.vardir)
    except OSError:
        pass

    args.builddir = os.path.abspath(os.path.expanduser(args.builddir))

    SOURCEDIR = os.path.dirname(os.getcwd())
    BUILDDIR = args.builddir
    os.environ["SOURCEDIR"] = SOURCEDIR
    os.environ["BUILDDIR"] = BUILDDIR
    soext = sys.platform == 'darwin' and 'dylib' or 'so'
    os.environ[
        "LUA_PATH"] = SOURCEDIR + "/?.lua;" + SOURCEDIR + "/?/init.lua;;"
    os.environ["LUA_CPATH"] = BUILDDIR + "/?." + soext + ";;"
    os.environ["REPLICATION_SYNC_TIMEOUT"] = str(args.replication_sync_timeout)
    os.environ['MEMTX_ALLOCATOR'] = args.memtx_allocator

    TarantoolServer.find_exe(args.builddir)
    UnittestServer.find_exe(args.builddir)
    AppServer.find_exe(args.builddir)

    Options().check_schema_upgrade_option(TarantoolServer.debug)
Exemple #8
0
def run_server(execs, cwd, server, logfile, retval, test_id):
    os.putenv("LISTEN", server.iproto)
    server.process = Popen(execs, stdout=PIPE, stderr=PIPE, cwd=cwd)
    sampler.register_process(server.process.pid, test_id, server.name)
    test_timeout = Options().args.test_timeout
    timer = Timer(test_timeout, timeout_handler,
                  (server.process, test_timeout))
    timer.start()
    stdout, stderr = server.process.communicate()
    timer.cancel()
    sys.stdout.write_bytes(stdout)
    with open(logfile, 'ab') as f:
        f.write(stderr)
    retval['returncode'] = server.process.wait()
    server.process = None
Exemple #9
0
    def __init__(self):
        pygame.init()
        self.options = Options(self)
        self.screen = pygame.display.set_mode(self.options.window_size)
        self.icon = Image("game_icon.png")
        self.caption = "Sunni (Alpha 3.0.0)"
        self.keys = Keys(self)
        self.page = None
        self.file_directory = os.getcwd()[:-3]
        self.mouse = Mouse()
        self.clock = pygame.time.Clock()
        self.fps = 30
        self.start_time = time.time()
        self.current_time = 0   # The amount of time the program as been running
        self.music = Music(self)
        self.saves = [Save(n) for n in range(4)]
        self.selected_save = None
        self.is_running = True
        self.next_battle = None

        self.main_menu = MainMenu(self)
        self.opening_sequence = OpeningSequence(self)
        self.opening_sequence.visit()
        self.new_game_page = NewGamePage(self)
        self.load_game_page = LoadGamePage(self)

        self.player = None
        self.opponent = None

        self.initialise()
        OpeningSequence.initialise()
        NewGamePage.initialise()
        LoadGamePage.initialise()
        Surface.initialise(self)
        Options.initialise()
        Move.initialise(self)
        Character.initialise()
        Player.initialise()
        MainMenu.initialise()
        MemeDog.initialise()
        Battle.initialise()

        self.opponents = OrderedDict()
        self.opponents["Meme Dog"] = MemeDog
        self.opponents["Kanye Snake"] = KanyeSnake
        self.opponents["Spook Dog"] = SpookDog
        self.opponents["Evil Cloud"] = EvilCloud
Exemple #10
0
def main(workflow):
    # Try to read configuration from local disk
    config = workflow.stored_data("configuration")
    if config is None:
        Options.warning("Didn't find your configuration", "Please supply your cheat sheet path using 'cf ~/your/path'", workflow)
        workflow.send_feedback()
        return -1

    parser = Parser(config.getPath())
    # Note: by pasing workflow as a variable, its state is changed in Options.py logic
    options = Options(parser, workflow)

    # Query is whatever comes after "cheat". Stored in one single variable
    query = "" if len(workflow.args) == 0 else workflow.args[0]
    tokens = query.strip().split(" ", 1)  # len 2 list
    tokens = [i.strip() for i in tokens if i != ""]

    if len(tokens) == 0:
        options.showAvailable()
        workflow.send_feedback()
        return None

    if len(tokens) == 1 and tokens[0] == "--search":
        Options.hint("Globally searching for ...?", "In global mode", workflow)
        workflow.send_feedback()
        return None

    if len(tokens) == 1 and tokens[0] not in parser.availableSheets():
        options.showAvailable(tokens[0])
        workflow.send_feedback()
        return None

    if len(tokens) == 1:
        options.list(tokens[0])
        workflow.send_feedback()
        return None

    sheetName = None if tokens[0] == "--search" else tokens[0]
    searchTerm = tokens[1]
    options.searchInSheetByKeyword(sheetName, searchTerm)

    workflow.send_feedback()
    return None
Exemple #11
0
 def __init__(self, options=None):
     self.options = options or Options()
     self.configs = loadyaml.load_cef()
import os
import glob

import sys

from lib.img_preparing import ImgPreparing
from lib.options import Options

if __name__ == '__main__':
    options = Options()
    opts = options.parse(sys.argv[1:])
    img_prepare = ImgPreparing()

    os.system('rm -rf  ' + opts.train_lmdb)
    os.system('rm -rf  ' + opts.validation_lmdb)

    # Get information about images
    train_data = [img for img in glob.glob(opts.train)]
    test_data = [img for img in glob.glob(opts.test)]

    # Create binary views for files
    img_prepare.create_lmdb(train_data, opts.train_lmdb)
    img_prepare.create_lmdb(train_data, opts.validation_lmdb)

Exemple #13
0
    def execute(self, server):
        super(LuaTest, self).execute(server)

        # Track the same process metrics as part of another test.
        sampler.register_process(server.process.pid, self.id, server.name)

        cls_name = server.__class__.__name__.lower()
        if 'gdb' in cls_name or 'lldb' in cls_name or 'strace' in cls_name:
            # don't propagate gdb/lldb/strace mixin to non-default servers,
            # it doesn't work properly for now
            # TODO: strace isn't interactive, so it's easy to make it works for
            #       non-default server
            create_server = TarantoolServer
        else:
            # propagate valgrind mixin to non-default servers
            create_server = server.__class__
        ts = TestState(
            self.suite_ini, server, create_server,
            self.run_params
        )
        self.inspector.set_parser(ts)
        lua = TestRunGreenlet(self.exec_loop, ts)
        self.current_test_greenlet = lua
        lua.start()
        try:
            save_join(lua, timeout=Options().args.test_timeout)
        except KeyboardInterrupt:
            # prevent tests greenlet from writing to the real stdout
            lua.kill()
            raise
        except TarantoolStartError as e:
            color_stdout('\n[Instance "{0}"] Failed to start tarantool '
                         'instance "{1}"\n'.format(server.name, e.name),
                         schema='error')
            server.kill_current_test()
        finally:
            # Stop any servers created by the test, except the
            # default one.
            #
            # The stop_nondefault() method calls
            # TarantoolServer.stop() under the hood. It sends
            # SIGTERM (if another signal is not passed), waits
            # for 5 seconds for a process termination and, if
            # nothing occurs, sends SIGKILL and continue waiting
            # for the termination.
            #
            # Look, 5 seconds (plus some delay for waiting) for
            # each instance if it does not follow SIGTERM[^1].
            # It is unacceptable, because the difference between
            # --test-timeout (110 seconds by default) and
            # --no-output-timeout (120 seconds by default) may
            # be lower than (5 seconds + delay) * (non-default
            # instance count).
            #
            # That's why we send SIGKILL for residual instances
            # right away.
            #
            # Hitting --no-output-timeout is undesirable, because
            # in the current implementation it is the show-stopper
            # for a testing: test-run doesn't restart fragile
            # tests, doesn't continue processing of other tests,
            # doesn't save artifacts at the end of the testing.
            #
            # [^1]: See gh-4127 and gh-5573 for problems of this
            #       kind.
            ts.stop_nondefault(signal=signal.SIGKILL)
Exemple #14
0
 def setUp(self):
     self.options = Options()
Exemple #15
0
 def __init__(self, options=None):
     self.options = options or Options()
     self.rsyslog = Rsyslog()
     self.leef = Leef(options)
     self.cef = Cef(options)
Exemple #16
0
from lib.node import Node
from lib.driver import Driver
from lib.options import Options
from lib.log import Log, LogLevel
from lib.vers import ozw_vers_major, ozw_vers_minor, ozw_vers_revision
from lib.xmlfiles import networkFileConfig, DeviceClasses, Manufacturers
from lib.command_classes.commandclasses import CommandClasses
import os
import re
import threading
import psutil
import subprocess
#import copy

MANAGER = None  # A Singleton for manager
OPTIONS = Options()  # A Singleton for Options

#SUPPORTEDCOMMANDCLASSES = {
#    0x71: "COMMAND_CLASS_ALARM",
#    0x22: "COMMAND_CLASS_APPLICATION_STATUS",
#    0x85: "COMMAND_CLASS_ASSOCIATION",
#    0x9b: "COMMAND_CLASS_ASSOCIATION_COMMAND_CONFIGURATION",
#    0x20: "COMMAND_CLASS_BASIC",
#    0x50: "COMMAND_CLASS_BASIC_WINDOW_COVERING",
#    0x80: "COMMAND_CLASS_BATTERY",
#    0x46: "COMMAND_CLASS_CLIMATE_CONTROL_SCHEDULE",
#    0x81: "COMMAND_CLASS_CLOCK",
#    0x70: "COMMAND_CLASS_CONFIGURATION",
#    0x21: "COMMAND_CLASS_CONTROLLER_REPLICATION",
#    0x56: "COMMAND_CLASS_CRC_16_ENCAP" ,
#    0x90: "COMMAND_CLASS_ENERGY_PRODUCTION",
Exemple #17
0
 def _default_options(self):
     options = Options()
     options.parse()
     return options