Пример #1
0
    def init(self):
        """(override) Generate test reports."""

        # Test result database
        if self.get('download_test_results', True):
            start = time.time()
            LOG.info("Collecting CIVET results...")

            sites = list()
            hashes = mooseutils.git_merge_commits()
            for category in self.get('remotes').values():
                sites.append((category['url'], category['repo']))

            self.__database = mooseutils.get_civet_results(
                hashes=hashes,
                sites=sites,
                cache=self.get('test_results_cache'),
                possible=['OK', 'FAIL', 'DIFF', 'TIMEOUT'],
                logger=LOG)

            LOG.info("Collecting CIVET results complete [%s sec.]",
                     time.time() - start)

        if self.get('generate_test_reports', True):
            if not self.__database:
                LOG.error("'generate_test_reports' requires results to exist.")
                return

            self.__has_test_reports = True
            start = time.time()
            LOG.info("Creating CIVET result pages...")

            report_root = self.get('test_reports_location')
            if not self.translator.findPage(
                    report_root, exact=True, throw_on_zero=False):
                self.translator.addContent(
                    pages.Directory(report_root, source=report_root))
            self.translator.addContent(
                pages.Source('{}/index.md'.format(report_root),
                             source='{}/index.md'.format(report_root),
                             read=False,
                             tokenize=False))

            count = 0
            for key, item in self.__database.items():
                name = 'result_{}'.format(count)
                self.__test_result_numbers[key] = name
                count += 1

                fullname = '{}/{}.md'.format(report_root, name)
                self.translator.addContent(
                    pages.Source(fullname,
                                 source=fullname,
                                 read=False,
                                 tokenize=False,
                                 key=key))

            LOG.info("Creating CIVET result pages complete [%s sec.]",
                     time.time() - start)
Пример #2
0
    def createToken(self, parent, info, page):
        site, repo = self.getCivetInfo()

        rows = []
        for sha in mooseutils.git_merge_commits():
            url = '{}/sha_events/{}/{}'.format(site, repo, sha)
            link = core.Link(parent, url=url, string=sha)
            core.LineBreak(parent)
        return parent
Пример #3
0
    def createToken(self, parent, info, page):
        owner = self.settings['owner'] or self.extension.get('owner')
        repo = self.settings['repo'] or self.extension.get('repo')

        rows = []
        for sha in mooseutils.git_merge_commits():
            url = 'https://civet.inl.gov/sha_events/{}/{}/{}'.format(owner, repo, sha)
            link = core.Link(parent, url=url, string=sha)
            core.LineBreak(parent)
        return parent
Пример #4
0
 def testGitMergeCommits(self):
     merges = mooseutils.git_merge_commits()
     self.assertEqual(len(merges[0]), 40)
Пример #5
0
    def init(self):
        """(override) Generate test reports."""

        # Test result database
        start = time.time()
        LOG.info("Collecting CIVET results...")

        self.__database = dict()
        for name, category in self.get('remotes').items():
            working_dir = mooseutils.eval_path(
                category.get('location', MooseDocs.ROOT_DIR))
            LOG.info("Gathering CIVET results for '%s' category in %s", name,
                     working_dir)
            hashes = None
            if category.get('download_test_results',
                            self.get('download_test_results', True)):
                hashes = mooseutils.git_merge_commits(working_dir)
                LOG.info("Downloading CIVET results for '%s' category in %s",
                         name, working_dir)

            local = mooseutils.eval_path(
                category.get('test_results_cache',
                             self.get('test_results_cache')))
            site = (category['url'], category['repo'])
            local_db = mooseutils.get_civet_results(
                local=local,
                hashes=hashes,
                site=site,
                cache=local,
                possible=['OK', 'FAIL', 'DIFF', 'TIMEOUT'],
                logger=LOG)
            self.__database.update(local_db)
        LOG.info("Collecting CIVET results complete [%s sec.]",
                 time.time() - start)

        if not self.__database and self.get('generate_test_reports', True):
            LOG.warning(
                "'generate_test_reports' is being disabled, it requires results to exist but none were located."
            )
            self.update(generate_test_reports=False)

        if self.get('generate_test_reports', True):
            self.__has_test_reports = True
            start = time.time()
            LOG.info("Creating CIVET result pages...")

            report_root = self.get('test_reports_location')
            if not self.translator.findPage(
                    report_root, exact=True, throw_on_zero=False):
                self.translator.addPage(
                    pages.Directory(report_root, source=report_root))

            src = pages.Source('{}/index.md'.format(report_root),
                               source='{}/index.md'.format(report_root),
                               read=False,
                               tokenize=False)
            self.translator.addPage(src)

            count = 0
            for key, item in self.__database.items():
                name = 'result_{}'.format(count)
                self.__test_result_numbers[key] = name
                count += 1

                fullname = '{}/{}.md'.format(report_root, name)
                src = pages.Source(fullname,
                                   source=fullname,
                                   read=False,
                                   tokenize=False,
                                   key=key)
                self.translator.addPage(src)

            LOG.info("Creating CIVET result pages complete [%s sec.]",
                     time.time() - start)