def __init__(self, dest, junit_suffix='', **options): super(JUnitBackend, self).__init__(dest, **options) self._test_suffix = junit_suffix # make dictionaries of all test names expected to crash/fail # for quick lookup when writing results. Use lower-case to # provide case insensitive matches. self._expected_failures = {} if PIGLIT_CONFIG.has_section("expected-failures"): for (fail, _) in PIGLIT_CONFIG.items("expected-failures"): self._expected_failures[fail.lower()] = True self._expected_crashes = {} if PIGLIT_CONFIG.has_section("expected-crashes"): for (fail, _) in PIGLIT_CONFIG.items("expected-crashes"): self._expected_crashes[fail.lower()] = True
def __init__(self, dest, junit_suffix='', junit_subtests=False, **options): super(JUnitBackend, self).__init__(dest, **options) # make dictionaries of all test names expected to crash/fail # for quick lookup when writing results. Use lower-case to # provide case insensitive matches. expected_failures = {} if PIGLIT_CONFIG.has_section("expected-failures"): for fail, _ in PIGLIT_CONFIG.items("expected-failures"): expected_failures[fail.lower()] = True expected_crashes = {} if PIGLIT_CONFIG.has_section("expected-crashes"): for fail, _ in PIGLIT_CONFIG.items("expected-crashes"): expected_crashes[fail.lower()] = True if not junit_subtests: self._write = JUnitWriter(junit_suffix, expected_failures, expected_crashes) else: self._write = JUnitSubtestWriter( # pylint: disable=redefined-variable-type junit_suffix, expected_failures, expected_crashes)
def __init__(self, monitoring_enabled): """Create a LinuxMonitored instance""" # Get the monitoring rules from piglit.conf and store them into a dict. self._monitoring_rules = {} if monitoring_enabled and PIGLIT_CONFIG.has_section('monitored-errors'): for key, _ in PIGLIT_CONFIG.items('monitored-errors'): if PIGLIT_CONFIG.has_section(key): type = PIGLIT_CONFIG.required_get(key, 'type') regex = PIGLIT_CONFIG.required_get(key, 'regex') parameters = PIGLIT_CONFIG.required_get(key, 'parameters') self.add_rule(key, type, parameters, regex)
def __init__(self, dest, metadata, **options): self._file = open(os.path.join(dest, 'results.xml'), 'w') FSyncMixin.__init__(self, **options) # make dictionaries of all test names expected to crash/fail # for quick lookup when writing results. Use lower-case to # provide case insensitive matches. self._expected_failures = {} if PIGLIT_CONFIG.has_section("expected-failures"): for (fail, _) in PIGLIT_CONFIG.items("expected-failures"): self._expected_failures[fail.lower()] = True self._expected_crashes = {} if PIGLIT_CONFIG.has_section("expected-crashes"): for (fail, _) in PIGLIT_CONFIG.items("expected-crashes"): self._expected_crashes[fail.lower()] = True # Write initial headers and other data that etree cannot write for us self._file.write('<?xml version="1.0" encoding="UTF-8" ?>\n') self._file.write('<testsuites>\n') self._file.write( '<testsuite name="piglit" tests="{}">\n'.format( metadata['test_count'])) self._test_suffix = metadata["test_suffix"]