示例#1
0
def get_test_provider_info(provider):
    """
    Get a dictionary with relevant test provider info, such as:

    * provider uri (git repo or filesystem location)
    * provider git repo data, such as branch, ref, pubkey
    * backends that this provider has tests for. For each backend type the
        provider has tests for, the 'path' will be also available.

    :param provider: Test provider name, such as 'io-github-autotest-qemu'.
    """
    provider_info = {}
    provider_path = os.path.join(data_dir.get_test_providers_dir(),
                                 '%s.ini' % provider)
    provider_cfg = test_config.config_loader(provider_path)
    provider_info['name'] = provider
    provider_info['uri'] = provider_cfg.get('provider', 'uri')
    provider_info['branch'] = provider_cfg.get('provider', 'branch', 'master')
    provider_info['ref'] = provider_cfg.get('provider', 'ref')
    provider_info['pubkey'] = provider_cfg.get('provider', 'pubkey')
    provider_info['backends'] = {}

    for backend in get_known_backends():
        subdir = provider_cfg.get(backend, 'subdir')
        if subdir is not None:
            if provider_info['uri'].startswith('file://'):
                src = os.path.join(provider_info['uri'][7:],
                                   subdir)
            else:
                src = os.path.join(data_dir.get_test_provider_dir(provider),
                                   subdir)
            provider_info['backends'].update({backend: {'path': src}})

    return provider_info
示例#2
0
def get_test_provider_info(provider):
    """
    Get a dictionary with relevant test provider info, such as:

    * provider uri (git repo or filesystem location)
    * provider git repo data, such as branch, ref, pubkey
    * backends that this provider has tests for. For each backend type the
        provider has tests for, the 'path' will be also available.

    :param provider: Test provider name, such as 'io-github-autotest-qemu'.
    """
    provider_info = {}
    provider_path = os.path.join(data_dir.get_test_providers_dir(),
                                 '%s.ini' % provider)
    provider_cfg = test_config.config_loader(provider_path)
    provider_info['name'] = provider
    provider_info['uri'] = provider_cfg.get('provider', 'uri')
    provider_info['branch'] = provider_cfg.get('provider', 'branch', 'master')
    provider_info['ref'] = provider_cfg.get('provider', 'ref')
    provider_info['pubkey'] = provider_cfg.get('provider', 'pubkey')
    provider_info['backends'] = {}

    for backend in get_known_backends():
        subdir = provider_cfg.get(backend, 'subdir')
        if subdir is not None:
            if provider_info['uri'].startswith('file://'):
                src = os.path.join(provider_info['uri'][7:], subdir)
            else:
                src = os.path.join(data_dir.get_test_provider_dir(provider),
                                   subdir)
            provider_info['backends'].update({backend: {'path': src}})

    return provider_info
示例#3
0
def get_test_provider_info(provider):
    """
    Get a dictionary with relevant test provider info, such as:

    * provider uri (git repo or filesystem location)
    * provider git repo data, such as branch, ref, pubkey
    * backends that this provider has tests for. For each backend type the
        provider has tests for, the 'path' will be also available.

    :param provider: Test provider name, such as 'io-github-autotest-qemu'.
    """
    provider_info = {}
    provider_path = os.path.join(data_dir.get_test_providers_dir(), "%s.ini" % provider)
    provider_cfg = test_config.config_loader(provider_path)
    provider_info["name"] = provider
    provider_info["uri"] = provider_cfg.get("provider", "uri")
    provider_info["branch"] = provider_cfg.get("provider", "branch", "master")
    provider_info["ref"] = provider_cfg.get("provider", "ref")
    provider_info["pubkey"] = provider_cfg.get("provider", "pubkey")
    provider_info["backends"] = {}

    for backend in get_known_backends():
        subdir = provider_cfg.get(backend, "subdir")
        if subdir is not None:
            if provider_info["uri"].startswith("file://"):
                src = os.path.join(provider_info["uri"][7:], subdir)
            else:
                src = os.path.join(data_dir.get_test_provider_dir(provider), subdir)
            provider_info["backends"].update({backend: {"path": src}})

    return provider_info
示例#4
0
    def run_once(self, test='antlr', config='./dacapo.cfg', jvm='default'):
        cfg = config_loader(cfg=config, tmpdir=self.tmpdir, raise_errors=True)
        self.test = test
        cachedir = os.path.join(os.path.dirname(self.srcdir), 'cache')
        if not os.path.isdir(cachedir):
            os.makedirs(cachedir)

        dacapo_url = cfg.get('dacapo', 'tarball_url')
        dacapo_md5 = cfg.get('dacapo', 'package_md5')
        dacapo_pkg = utils.unmap_url_cache(cachedir, dacapo_url, dacapo_md5)

        if not jvm == 'default':
            # Get the jvm package
            jvm_pkg_url = cfg.get(jvm, 'jvm_pkg_url')
            jvm_pkg_md5 = cfg.get(jvm, 'package_md5')
            jvm_pkg = utils.unmap_url_cache(cachedir, jvm_pkg_url, jvm_pkg_md5)
            # Install it
            swman = software_manager.SoftwareManager()
            swman.install(jvm_pkg)
            # Basic Java environment variables setup
            java_root = cfg.get(jvm, 'java_root')
            self.set_java_environment(jvm, java_root)

        if cfg.get('global', 'use_global') == 'yes':
            iterations = cfg.get('global', 'iterations')
            workload = cfg.get('global', 'workload')
        else:
            iterations = cfg.get(test, 'iterations')
            workload = cfg.get(test, 'workload')

        verbose = '-v '
        workload = '-s %s ' % workload
        iterations = '-n %s ' % iterations
        self.scratch = os.path.join(self.resultsdir, test)
        scratch = '--scratch-directory %s ' % self.scratch
        args = verbose + workload + scratch + iterations + test

        self.raw_result_file = os.path.join(self.resultsdir,
                                            'raw_output_%s' % self.iteration)
        raw_result = open(self.raw_result_file, 'w')

        logging.info('Running dacapo benchmark %s', test)
        try:
            cmd = 'java -jar %s %s' % (dacapo_pkg, args)
            results = utils.run(command=cmd,
                                stdout_tee=raw_result,
                                stderr_tee=raw_result)
            self.results = results.stderr
            raw_result.close()
        except error.CmdError, e:
            raise error.TestError('Dacapo benchmark %s has failed: %s' %
                                  (test, e))
示例#5
0
    def run_once(self, test='antlr', config='./dacapo.cfg', jvm='default'):
        cfg = config_loader(cfg=config, tmpdir=self.tmpdir, raise_errors=True)
        self.test = test
        cachedir = os.path.join(os.path.dirname(self.srcdir), 'cache')
        if not os.path.isdir(cachedir):
            os.makedirs(cachedir)

        dacapo_url = cfg.get('dacapo', 'tarball_url')
        dacapo_md5 = cfg.get('dacapo', 'package_md5')
        dacapo_pkg = utils.unmap_url_cache(cachedir, dacapo_url, dacapo_md5)

        if not jvm == 'default':
            # Get the jvm package
            jvm_pkg_url = cfg.get(jvm, 'jvm_pkg_url')
            jvm_pkg_md5 = cfg.get(jvm, 'package_md5')
            jvm_pkg = utils.unmap_url_cache(cachedir, jvm_pkg_url, jvm_pkg_md5)
            # Install it
            swman = software_manager.SoftwareManager()
            swman.install(jvm_pkg)
            # Basic Java environment variables setup
            java_root = cfg.get(jvm, 'java_root')
            self.set_java_environment(jvm, java_root)

        if cfg.get('global', 'use_global') == 'yes':
            iterations = cfg.get('global', 'iterations')
            workload = cfg.get('global', 'workload')
        else:
            iterations = cfg.get(test, 'iterations')
            workload = cfg.get(test, 'workload')

        verbose = '-v '
        workload = '-s %s ' % workload
        iterations = '-n %s ' % iterations
        self.scratch = os.path.join(self.resultsdir, test)
        scratch = '--scratch-directory %s ' % self.scratch
        args = verbose + workload + scratch + iterations + test

        self.raw_result_file = os.path.join(self.resultsdir,
                                            'raw_output_%s' % self.iteration)
        raw_result = open(self.raw_result_file, 'w')

        logging.info('Running dacapo benchmark %s', test)
        try:
            cmd = 'java -jar %s %s' % (dacapo_pkg, args)
            results = utils.run(command=cmd, stdout_tee=raw_result,
                                stderr_tee=raw_result)
            self.results = results.stderr
            raw_result.close()
        except error.CmdError, e:
            raise error.TestError('Dacapo benchmark %s has failed: %s' %
                                  (test, e))
示例#6
0
    def initialize(self, config):
        arch = utils.get_current_kernel_arch()
        if arch in ['i386', 'i486', 'i586', 'i686', 'athlon']:
            self.arch = 'ia32'
        elif arch == 'ppc':
            self.arch = 'ppc32'
        elif arch in ['s390', 's390x', 'ia64', 'x86_64', 'ppc64']:
            self.arch = arch
        else:
            e_msg = 'Architecture %s not supported by LSB' % arch
            raise error.TestError(e_msg)

        self.config = config_loader(config, self.tmpdir)
        self.cachedir = os.path.join(os.path.dirname(self.srcdir), 'cache')
        if not os.path.isdir(self.cachedir):
            os.makedirs(self.cachedir)

        self.packages_installed = False
        self.libraries_linked = False
示例#7
0
    def initialize(self, config):
        arch = utils.get_current_kernel_arch()
        if arch in ['i386', 'i486', 'i586', 'i686', 'athlon']:
            self.arch = 'ia32'
        elif arch == 'ppc':
            self.arch = 'ppc32'
        elif arch in ['s390', 's390x', 'ia64', 'x86_64', 'ppc64']:
            self.arch = arch
        else:
            e_msg = 'Architecture %s not supported by LSB' % arch
            raise error.TestError(e_msg)

        self.config = config_loader(config, self.tmpdir)
        self.cachedir = os.path.join(os.path.dirname(self.srcdir), 'cache')
        if not os.path.isdir(self.cachedir):
            os.makedirs(self.cachedir)

        self.packages_installed = False
        self.libraries_linked = False
示例#8
0
def get_asset_info(asset):
    asset_info = {}
    asset_path = os.path.join(data_dir.get_download_dir(), '%s.ini' % asset)
    asset_cfg = test_config.config_loader(asset_path)

    asset_info['url'] = asset_cfg.get(asset, 'url')
    asset_info['sha1_url'] = asset_cfg.get(asset, 'sha1_url')
    asset_info['title'] = asset_cfg.get(asset, 'title')
    destination = asset_cfg.get(asset, 'destination')
    if not os.path.isabs(destination):
        destination = os.path.join(data_dir.get_data_dir(), destination)
    asset_info['destination'] = destination
    asset_info['asset_exists'] = os.path.isfile(destination)

    # Optional fields
    d_uncompressed = asset_cfg.get(asset, 'destination_uncompressed')
    if d_uncompressed is not None and not os.path.isabs(d_uncompressed):
        d_uncompressed = os.path.join(data_dir.get_data_dir(), d_uncompressed)
    asset_info['destination_uncompressed'] = d_uncompressed
    asset_info['uncompress_cmd'] = asset_cfg.get(asset, 'uncompress_cmd')

    return asset_info
示例#9
0
def get_asset_info(asset):
    asset_info = {}
    asset_path = os.path.join(data_dir.get_download_dir(), "%s.ini" % asset)
    asset_cfg = test_config.config_loader(asset_path)

    asset_info["url"] = asset_cfg.get(asset, "url")
    asset_info["sha1_url"] = asset_cfg.get(asset, "sha1_url")
    asset_info["title"] = asset_cfg.get(asset, "title")
    destination = asset_cfg.get(asset, "destination")
    if not os.path.isabs(destination):
        destination = os.path.join(data_dir.get_data_dir(), destination)
    asset_info["destination"] = destination
    asset_info["asset_exists"] = os.path.isfile(destination)

    # Optional fields
    d_uncompressed = asset_cfg.get(asset, "destination_uncompressed")
    if d_uncompressed is not None and not os.path.isabs(d_uncompressed):
        d_uncompressed = os.path.join(data_dir.get_data_dir(), d_uncompressed)
    asset_info["destination_uncompressed"] = d_uncompressed
    asset_info["uncompress_cmd"] = asset_cfg.get(asset, "uncompress_cmd")

    return asset_info
示例#10
0
def get_asset_info(asset):
    asset_info = {}
    asset_path = os.path.join(data_dir.get_download_dir(), '%s.ini' % asset)
    asset_cfg = test_config.config_loader(asset_path)

    asset_info['url'] = asset_cfg.get(asset, 'url')
    asset_info['sha1_url'] = asset_cfg.get(asset, 'sha1_url')
    asset_info['title'] = asset_cfg.get(asset, 'title')
    destination = asset_cfg.get(asset, 'destination')
    if not os.path.isabs(destination):
        destination = os.path.join(data_dir.get_data_dir(), destination)
    asset_info['destination'] = destination
    asset_info['asset_exists'] = os.path.isfile(destination)

    # Optional fields
    d_uncompressed = asset_cfg.get(asset, 'destination_uncompressed')
    if d_uncompressed is not None and not os.path.isabs(d_uncompressed):
        d_uncompressed = os.path.join(data_dir.get_data_dir(),
                                      d_uncompressed)
    asset_info['destination_uncompressed'] = d_uncompressed
    asset_info['uncompress_cmd'] = asset_cfg.get(asset, 'uncompress_cmd')

    return asset_info