Exemplo n.º 1
0
    def download_coverage_artifacts(self, build_task_id):
        try:
            os.mkdir('ccov-artifacts')
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise e

        task_data = taskcluster.get_task_details(build_task_id)

        artifacts = taskcluster.get_task_artifacts(build_task_id)
        for artifact in artifacts:
            if 'target.code-coverage-gcno.zip' in artifact['name']:
                taskcluster.download_artifact(build_task_id, '', artifact)

        all_suites = set()

        tasks = taskcluster.get_tasks_in_group(task_data['taskGroupId'])
        test_tasks = [t for t in tasks if taskcluster.is_coverage_task(t)]
        for test_task in test_tasks:
            suite_name = taskcluster.get_suite_name(test_task)
            all_suites.add(suite_name)
            test_task_id = test_task['status']['taskId']
            artifacts = taskcluster.get_task_artifacts(test_task_id)
            for artifact in artifacts:
                if any(n in artifact['name'] for n in
                       ['code-coverage-gcda.zip', 'code-coverage-jsvm.zip']):
                    taskcluster.download_artifact(test_task_id, suite_name,
                                                  artifact)

        self.suites = list(all_suites)
        self.suites.sort()
Exemplo n.º 2
0
        def download_artifact(test_task):
            status = test_task['status']['state']
            assert status in ALL_STATUSES
            while status not in FINISHED_STATUSES:
                time.sleep(60)
                status = taskcluster.get_task_status(test_task['status']['taskId'])['status']['state']
                assert status in ALL_STATUSES

            chunk_name = taskcluster.get_chunk_name(test_task)
            platform_name = taskcluster.get_platform_name(test_task)
            # Ignore awsy and talos as they aren't actually suites of tests.
            if any(to_ignore in chunk_name for to_ignore in self.suites_to_ignore):
                return

            # If we have already downloaded this chunk from another task, check if the
            # other task has a better status than this one.
            if not should_download(status, chunk_name, platform_name):
                return

            test_task_id = test_task['status']['taskId']
            for artifact in taskcluster.get_task_artifacts(test_task_id):
                if not any(n in artifact['name'] for n in ['code-coverage-grcov.zip', 'code-coverage-jsvm.zip']):
                    continue

                artifact_path = taskcluster.download_artifact(test_task_id, chunk_name, platform_name, artifact)
                logger.info('%s artifact downloaded' % artifact_path)
                if 'code-coverage-jsvm.zip' in artifact['name']:
                    self.rewrite_jsvm_lcov(artifact_path)
                    logger.info('%s artifact rewritten' % artifact_path)
Exemplo n.º 3
0
def download_coverage_artifacts(build_task_id):
    try:
        os.mkdir('ccov-artifacts')
    except:
        pass

    task_data = taskcluster.get_task_details(build_task_id)

    artifacts = taskcluster.get_task_artifacts(build_task_id)
    for artifact in artifacts:
        if 'target.code-coverage-gcno.zip' in artifact['name']:
            taskcluster.download_artifact(build_task_id, artifact)

    tasks = taskcluster.get_tasks_in_group(task_data['taskGroupId'])
    test_tasks = [t for t in tasks if is_coverage_task(t)]
    for test_task in test_tasks:
        test_task_id = test_task['status']['taskId']
        artifacts = taskcluster.get_task_artifacts(test_task_id)
        for artifact in artifacts:
            if 'code-coverage-gcda.zip' in artifact['name']:
                taskcluster.download_artifact(test_task_id, artifact)
Exemplo n.º 4
0
    def download(self, test_task):
        chunk_name = taskcluster.get_chunk(
            test_task['task']['metadata']['name'])
        platform_name = taskcluster.get_platform(
            test_task['task']['metadata']['name'])
        test_task_id = test_task['status']['taskId']

        for artifact in taskcluster.get_task_artifacts(test_task_id):
            if not any(n in artifact['name'] for n in
                       ['code-coverage-grcov.zip', 'code-coverage-jsvm.zip']):
                continue

            artifact_path = self.generate_path(platform_name, chunk_name,
                                               artifact)
            taskcluster.download_artifact(artifact_path, test_task_id,
                                          artifact['name'])
            logger.info('%s artifact downloaded' % artifact_path)
Exemplo n.º 5
0
    def download_coverage_artifacts(self, build_task_id):
        try:
            os.mkdir('ccov-artifacts')
        except OSError as e:
            if e.errno != errno.EEXIST:
                raise e

        task_data = taskcluster.get_task_details(build_task_id)

        all_suites = set()

        def rewriting_task(path):
            return lambda: self.rewrite_jsvm_lcov(path)

        tasks = taskcluster.get_tasks_in_group(task_data['taskGroupId'])
        test_tasks = [t for t in tasks if taskcluster.is_coverage_task(t)]
        with ThreadPoolExecutorResult() as executor:
            for test_task in test_tasks:
                suite_name = taskcluster.get_suite_name(test_task)
                # Ignore awsy and talos as they aren't actually suites of tests.
                if any(to_ignore in suite_name
                       for to_ignore in ['awsy', 'talos']):
                    continue

                all_suites.add(suite_name)

                test_task_id = test_task['status']['taskId']
                for artifact in taskcluster.get_task_artifacts(test_task_id):
                    if not any(
                            n in artifact['name'] for n in
                        ['code-coverage-grcov.zip', 'code-coverage-jsvm.zip']):
                        continue

                    artifact_path = taskcluster.download_artifact(
                        test_task_id, suite_name, artifact)
                    if 'code-coverage-jsvm.zip' in artifact['name']:
                        executor.submit(rewriting_task(artifact_path))

            self.suites = list(all_suites)
            self.suites.sort()

            logger.info('Code coverage artifacts downloaded')
Exemplo n.º 6
0
def disable_test_get_task_artifacts():
    task_id = taskcluster.get_last_task('linux')
    artifacts = taskcluster.get_task_artifacts(task_id)
    assert len(artifacts) > 0
Exemplo n.º 7
0
def test_get_task_artifacts():
    task_id = taskcluster.get_last_task()
    artifacts = taskcluster.get_task_artifacts(task_id)
    assert len(artifacts) > 0
Exemplo n.º 8
0
def test_get_task_artifacts(LINUX_TASK_ID, LINUX_TASK_ARTIFACTS):
    responses.add(responses.GET, 'https://queue.taskcluster.net/v1/task/{}/artifacts'.format(LINUX_TASK_ID), json=LINUX_TASK_ARTIFACTS, status=200)
    assert taskcluster.get_task_artifacts(LINUX_TASK_ID) == LINUX_TASK_ARTIFACTS['artifacts']