Beispiel #1
0
def VM_SSH(name):
    """open a shell to a virtual machine

    Open an SSH session to a running virtual machine.
    """
    vm = VM.find(name)
    if not vm.running():
        raise fail("VM is not running: {}", vm.name)
    vm.forward(22)
    host = "linux-vm"
    if vm.system == 'windows':
        host = "windows-vm"
    with env(debug=True):
        exe("ssh -F %s %s" % (CTL_DIR + "/ssh_config", host))
Beispiel #2
0
def CLIENT(engine, name=None):
    """start a native database client

    Run `cogs client <engine> [<name>]` to start a native database
    client on a regression database.

    If the database name is not specified, the client is started
    with administrative rights against the default database.

    To get a list of supported engines and databases, run:
      `cogs help createdb`
    """
    command = make_client(engine, name)
    with env(debug=True):
        exe(command)
Beispiel #3
0
 def unpack_iso(self, iso_path, target_path):
     # Unpack an ISO image.
     assert os.path.isfile(iso_path)
     if not os.path.exists(target_path):
         mktree(target_path)
     debug("unpacking: {} => {}", iso_path, target_path)
     listing = pipe("isoinfo -i %s -R -f" % iso_path)
     for entry in listing.splitlines():
         filename = target_path + entry
         dirname = os.path.dirname(filename)
         if not os.path.exists(dirname):
             mktree(dirname)
         with env(debug=False):
             content = pipe("isoinfo -i %s -R -x '%s'" % (iso_path, entry))
         if not content:
             continue
         #debug("extracting: {} => {}", entry, filename)
         stream = open(filename, 'w')
         stream.write(content)
         stream.close()
Beispiel #4
0
def pyflakes(command):
    # Run `pyflakes <command>`.
    with env(debug=True):
        sh(env.pyflakes_path + " " + command)
Beispiel #5
0
def coverage_py(command, environ=None):
    # Run `coverage <command>`.
    path = env.coverage_path
    with env(debug=True):
        sh(path + " " + command, environ=environ)
Beispiel #6
0
def exe_htsql_ctl(command, environ=None):
    # Execute `htsql-ctl <command>`.
    with env(debug=True):
        exe(env.ctl_path + " " + command, environ=environ)
Beispiel #7
0
def exe_regress(command):
    # Run `pbbt test/regress.yaml <command>`.
    variables = make_variables()
    with env(debug=True):
        exe(env.pbbt_path + " test/regress.yaml -E test/regress.py " +
            variables + command)
Beispiel #8
0
def LINT():
    """detect errors in the source code with PyFlakes"""
    with env(debug=True):
        exe("pyflakes src/cogs")
Beispiel #9
0
def htsql_ctl(command, environ=None):
    # Run `htsql-ctl <command>`.
    with env(debug=True):
        sh(env.ctl_path + " " + command)
Beispiel #10
0
def PURGE_TEST():
    """purge stale output records from regression tests"""
    with env(debug=True):
        exe("pbbt test/input.yaml test/output.yaml -q --train --purge")
Beispiel #11
0
def TRAIN():
    """run regression tests in the train mode"""
    with env(debug=True):
        exe("pbbt test/input.yaml test/output.yaml --train")
Beispiel #12
0
def TEST():
    """run regression tests"""
    with env(debug=True):
        exe("pbbt test/input.yaml test/output.yaml -q")
Beispiel #13
0
def sphinx(command, cd=None):
    # Run `sphinx-build <command>`.
    with env(debug=True):
        sh(env.sphinx_path + " " + command, cd=cd)
Beispiel #14
0
def python(command, cd=None):
    # Run `python <command>`.
    with env(debug=True):
        sh(env.python_path + " " + command, cd=cd)