Example #1
0
def check_regression(pkg_dir, skip_tests, test_round):
    """Check the build log for test regressions using the count module."""
    if skip_tests:
        return

    log_path = os.path.join(pkg_dir, 'results', 'build.log')
    result = count.parse_log(log_path)
    if len(result) == 0 or result[0:2] == ',0':
        log_path = os.path.join(pkg_dir, 'results',
                                f"round{test_round}-build.log")
        result = count.parse_log(log_path)

    titles = [('Package', 'package name', 1), ('Total', 'total tests', 1),
              ('Pass', 'total passing', 1), ('Fail', 'total failing', 0),
              ('Skip', 'tests skipped', 0), ('XFail', 'expected fail', 0)]
    res_str = ""
    for line in result.strip('\n').split('\n'):
        s_line = line.split(',')
        for idx, title in enumerate(titles):
            if s_line[idx]:
                if (s_line[idx] != '0') or (title[2] > 0):
                    print("{}: {}".format(title[1], s_line[idx]))
                res_str += "{} : {}\n".format(title[0], s_line[idx])

    util.write_out(os.path.join(pkg_dir, "testresults"), res_str)
Example #2
0
    def test_parse_log(self):
        """
        test parse_log
        expected = [total_tests,
                    total_pass,
                    total_fail,
                    total_xfail,
                    total_skip,
                    counted_tests,
                    counted_pass,
                    counted_fail,
                    counted_xfail,
                    counted_skip]
        """
        content = '+ make check\n' + line
        m_open = mock_open(read_data=content)
        with patch('count.open', m_open, create=True):
            count.zero_test_data = mock_zero_test_data
            count.parse_log('log')
            count.zero_test_data = backup_zero_test_data

        actual = [
            count.total_tests, count.total_pass, count.total_fail,
            count.total_xfail, count.total_skip, count.counted_tests,
            count.counted_pass, count.counted_fail, count.counted_xfail,
            count.counted_skip
        ]

        self.assertEqual(actual, expected)
Example #3
0
def check_regression(pkg_dir):
    """Check the build log for test regressions using the count module."""
    if config.config_opts['skip_tests']:
        return

    result = count.parse_log(os.path.join(pkg_dir, "results/build.log"))
    titles = [('Package', 'package name', 1), ('Total', 'total tests', 1),
              ('Pass', 'total passing', 1), ('Fail', 'total failing', 0),
              ('Skip', 'tests skipped', 0), ('XFail', 'expected fail', 0)]
    res_str = ""
    for line in result.strip('\n').split('\n'):
        s_line = line.split(',')
        for idx, title in enumerate(titles):
            if s_line[idx]:
                if (s_line[idx] != '0') or (title[2] > 0):
                    print("{}: {}".format(title[1], s_line[idx]))
                res_str += "{} : {}\n".format(title[0], s_line[idx])

    util.write_out(os.path.join(pkg_dir, "testresults"), res_str)