Exemple #1
0
def send_coverage_to_codecov(flag):
    """Send the coverage report to Codecov with the given flag."""
    if CONFIG.get('COVERAGE', False):
        logger.info("Sending coverage results to codecov for flag %s." % flag)
        subprocess.call(
            "bash -c 'bash <(curl -s https://codecov.io/bash) -c -F %s'" %
            flag, shell=True)
Exemple #2
0
def send_coverage_to_codecov(flag):
    """Send the coverage report to Codecov with the given flag."""
    if CONFIG.get('COVERAGE', False):
        logger.info("Sending coverage results to codecov for flag %s." % flag)
        subprocess.check_call(
            "bash -c 'bash <(curl -s https://codecov.io/bash) -c -F %s'" %
            flag, shell=True)
Exemple #3
0
def profiling_cmdline(cmdline, output_basename):
    """Return a cmdline possibly decorated to record profiling information."""
    profiler = CONFIG.get("PROFILER", PROFILER_NONE)
    if profiler == PROFILER_NONE:
        return cmdline
    elif profiler == PROFILER_YAPPI:
        return _format_cmdline(_YAPPI_CMDLINE, cmdline, output_basename)
    elif profiler == PROFILER_KERNPROF:
        return _format_cmdline(_KERNPROF_CMDLINE, cmdline, output_basename)
    else:
        raise ValueError("Unknown profiler %s" % profiler)
Exemple #4
0
def profiling_cmdline(cmdline, output_basename):
    """Return a cmdline possibly decorated to record profiling information."""
    profiler = CONFIG.get("PROFILER", PROFILER_NONE)
    if profiler == PROFILER_NONE:
        return cmdline
    elif profiler == PROFILER_YAPPI:
        return _format_cmdline(_YAPPI_CMDLINE, cmdline, output_basename)
    elif profiler == PROFILER_KERNPROF:
        return _format_cmdline(_KERNPROF_CMDLINE, cmdline, output_basename)
    else:
        raise ValueError("Unknown profiler %s" % profiler)
Exemple #5
0
    def _spawn(cmdline):
        """Execute a python application."""
        def kill(job):
            try:
                job.kill()
            except OSError:
                pass

        if CONFIG["VERBOSITY"] >= 1:
            logger.info("$ %s", " ".join(cmdline))

        if CONFIG["TEST_DIR"] is not None and CONFIG.get("COVERAGE"):
            cmdline = Program._COVERAGE_CMDLINE + cmdline

        if CONFIG["VERBOSITY"] >= 3:
            stdout = None
            stderr = None
        else:
            stdout = io.open(os.devnull, "wb")
            stderr = stdout
        job = subprocess.Popen(cmdline, stdout=stdout, stderr=stderr)
        atexit.register(lambda: kill(job))
        return job
Exemple #6
0
    def _spawn(cmdline):
        """Execute a python application."""

        def kill(job):
            try:
                job.kill()
            except OSError:
                pass

        if CONFIG["VERBOSITY"] >= 1:
            logger.info("$" + " ".join(cmdline))

        if CONFIG["TEST_DIR"] is not None and CONFIG.get("COVERAGE"):
            cmdline = Program._COVERAGE_CMDLINE + cmdline

        if CONFIG["VERBOSITY"] >= 3:
            stdout = None
            stderr = None
        else:
            stdout = io.open(os.devnull, "wb")
            stderr = stdout
        job = subprocess.Popen(cmdline, stdout=stdout, stderr=stderr)
        atexit.register(lambda: kill(job))
        return job
Exemple #7
0
import atexit
import tempfile
import subprocess
import shutil
import os
from argparse import ArgumentParser

from cms import utf8_decoder
from cmstestsuite import info, sh, configure_cms, read_cms_config, CONFIG

# These settings are only used within this file.
CONFIG.update({
    "DB_HOST": "localhost",
    "DB_USER": "******",
    "DB_PASSWORD": "******",
    "DB_NAME": "cmstestdb",
    "GIT_ORIGIN": None,
    "GIT_REVISION": None,
})


def drop_old_data():
    info("Dropping any old databases called %(DB_NAME)s." % CONFIG)
    sh("sudo -u postgres dropdb %(DB_NAME)s" % CONFIG, ignore_failure=True)

    info("Purging old checkout from %(TEST_DIR)s." % CONFIG)
    shutil.rmtree("%(TEST_DIR)s" % CONFIG)


def setup_cms():
    info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." %
Exemple #8
0
def combine_coverage():
    """Combine coverage reports from different programs."""
    if CONFIG.get('COVERAGE', False):
        logger.info("Combining coverage results.")
        sh([sys.executable, "-m", "coverage", "combine"])
Exemple #9
0
def clear_coverage():
    """Clear existing coverage reports."""
    if CONFIG.get('COVERAGE', False):
        logging.info("Clearing old coverage data.")
        sh([sys.executable, "-m", "coverage", "erase"])
Exemple #10
0
def coverage_cmdline(cmdline):
    """Return a cmdline possibly decorated to record coverage."""
    if CONFIG.get('COVERAGE', False):
        return _COVERAGE_CMDLINE + cmdline
    else:
        return cmdline
Exemple #11
0
import atexit
import tempfile
import subprocess
import shutil
import os
from argparse import ArgumentParser

from cms import utf8_decoder
from cmstestsuite import info, sh, configure_cms, read_cms_config, CONFIG

# These settings are only used within this file.
CONFIG.update({
    "DB_HOST": "localhost",
    "DB_USER": "******",
    "DB_PASSWORD": "******",
    "DB_NAME": "cmstestdb",
    "GIT_ORIGIN": None,
    "GIT_REVISION": None,
})


def drop_old_data():
    info("Dropping any old databases called %(DB_NAME)s." % CONFIG)
    sh("sudo -u postgres dropdb %(DB_NAME)s" % CONFIG, ignore_failure=True)

    info("Purging old checkout from %(TEST_DIR)s." % CONFIG)
    shutil.rmtree("%(TEST_DIR)s" % CONFIG)


def setup_cms():
    info("Creating database called %(DB_NAME)s accessible by %(DB_USER)s." %
Exemple #12
0
def combine_coverage():
    """Combine coverage reports from different programs."""
    if CONFIG.get('COVERAGE', False):
        logger.info("Combining coverage results.")
        sh([sys.executable, "-m", "coverage", "combine"])
Exemple #13
0
def clear_coverage():
    """Clear existing coverage reports."""
    if CONFIG.get('COVERAGE', False):
        logging.info("Clearing old coverage data.")
        sh([sys.executable, "-m", "coverage", "erase"])
Exemple #14
0
def coverage_cmdline(cmdline):
    """Return a cmdline possibly decorated to record coverage."""
    if CONFIG.get('COVERAGE', False):
        return _COVERAGE_CMDLINE + cmdline
    else:
        return cmdline
Exemple #15
0
def send_coverage_to_codecov(flag):
    """Send the coverage report to Codecov with the given flag."""
    if CONFIG.get('COVERAGE', False):
        logger.info("Sending coverage results to codecov for flag %s." % flag)
        uploader = _get_codecov_uploader()
        subprocess.check_call([uploader, "-F", flag])