本文整理汇总了Python中lldbsuite.test_event.event_builder.EventBuilder类的典型用法代码示例。如果您正苦于以下问题:Python EventBuilder类的具体用法?Python EventBuilder怎么用?Python EventBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EventBuilder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupTestResults
def setupTestResults():
"""Sets up test results-related objects based on arg settings."""
# Setup the results formatter configuration.
formatter_config = formatter.FormatterConfig()
formatter_config.filename = configuration.results_filename
formatter_config.formatter_name = configuration.results_formatter_name
formatter_config.formatter_options = (
configuration.results_formatter_options)
formatter_config.port = configuration.results_port
# Create the results formatter.
formatter_spec = formatter.create_results_formatter(
formatter_config)
if formatter_spec is not None and formatter_spec.formatter is not None:
configuration.results_formatter_object = formatter_spec.formatter
# Send an initialize message to the formatter.
initialize_event = EventBuilder.bare_event("initialize")
if isMultiprocessTestRunner():
if (configuration.test_runner_name is not None and
configuration.test_runner_name == "serial"):
# Only one worker queue here.
worker_count = 1
else:
# Workers will be the number of threads specified.
worker_count = configuration.num_threads
else:
worker_count = 1
initialize_event["worker_count"] = worker_count
formatter_spec.formatter.handle_event(initialize_event)
# Make sure we clean up the formatter on shutdown.
if formatter_spec.cleanup_func is not None:
atexit.register(formatter_spec.cleanup_func)
示例2: addSuccess
def addSuccess(self, test):
super(LLDBTestResult, self).addSuccess(test)
if configuration.parsable:
self.stream.write("PASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_success(test))
示例3: addFailure
def addFailure(self, test, err):
if self.checkExclusion(configuration.xfail_tests, test.id()):
self.addExpectedFailure(test, err, None)
return
configuration.sdir_has_content = True
super(LLDBTestResult, self).addFailure(test, err)
method = getattr(test, "markFailure", None)
if method:
method()
if configuration.parsable:
self.stream.write("FAIL: LLDB (%s) :: %s\n" %
(self._config_string(test), str(test)))
if configuration.useCategories:
test_categories = self.getCategoriesForTest(test)
for category in test_categories:
if category in configuration.failuresPerCategory:
configuration.failuresPerCategory[
category] = configuration.failuresPerCategory[
category] + 1
else:
configuration.failuresPerCategory[category] = 1
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_failure(test, err))
示例4: wrapper
def wrapper(*args, **kwargs):
self = args[0]
if expected_fn(self):
# Send event marking test as explicitly eligible for rerunning.
if configuration.results_formatter_object is not None:
# Mark this test as rerunnable.
configuration.results_formatter_object.handle_event(
EventBuilder.event_for_mark_test_rerun_eligible(self))
func(*args, **kwargs)
示例5: addError
def addError(self, test, err):
configuration.sdir_has_content = True
if self._isBuildError(err):
self._saveBuildErrorTuple(test, err)
else:
super(LLDBTestResult, self).addError(test, err)
method = getattr(test, "markError", None)
if method:
method()
if configuration.parsable:
self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
if self.results_formatter:
# Handle build errors as a separate event type
if self._isBuildError(err):
error_event = EventBuilder.event_for_build_error(test, err)
else:
error_event = EventBuilder.event_for_error(test, err)
self.results_formatter.handle_event(error_event)
示例6: addSkip
def addSkip(self, test, reason):
configuration.sdir_has_content = True
super(LLDBTestResult, self).addSkip(test, reason)
method = getattr(test, "markSkippedTest", None)
if method:
method()
if configuration.parsable:
self.stream.write("UNSUPPORTED: LLDB (%s) :: %s (%s) \n" % (self._config_string(test), str(test), reason))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_skip(test, reason))
示例7: addUnexpectedSuccess
def addUnexpectedSuccess(self, test, bugnumber):
configuration.sdir_has_content = True
super(LLDBTestResult, self).addUnexpectedSuccess(test, bugnumber)
method = getattr(test, "markUnexpectedSuccess", None)
if method:
method(bugnumber)
if configuration.parsable:
self.stream.write("XPASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_unexpected_success(
test, bugnumber))
示例8: addExpectedFailure
def addExpectedFailure(self, test, err, bugnumber):
configuration.sdir_has_content = True
super(LLDBTestResult, self).addExpectedFailure(test, err, bugnumber)
method = getattr(test, "markExpectedFailure", None)
if method:
method(err, bugnumber)
if configuration.parsable:
self.stream.write("XFAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_expected_failure(
test, err, bugnumber))
示例9: addCleanupError
def addCleanupError(self, test, err):
configuration.sdir_has_content = True
super(LLDBTestResult, self).addCleanupError(test, err)
method = getattr(test, "markCleanupError", None)
if method:
method()
if configuration.parsable:
self.stream.write("CLEANUP ERROR: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_cleanup_error(
test, err))
示例10: addSuccess
def addSuccess(self, test):
if self.checkExclusion(configuration.xfail_tests, test.id()):
self.addUnexpectedSuccess(test, None)
return
super(LLDBTestResult, self).addSuccess(test)
if configuration.parsable:
self.stream.write("PASS: LLDB (%s) :: %s\n" %
(self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_success(test))
示例11: startTest
def startTest(self, test):
if configuration.shouldSkipBecauseOfCategories(self.getCategoriesForTest(test)):
self.hardMarkAsSkipped(test)
configuration.setCrashInfoHook("%s at %s" % (str(test),inspect.getfile(test.__class__)))
self.counter += 1
#if self.counter == 4:
# import crashinfo
# crashinfo.testCrashReporterDescription(None)
test.test_number = self.counter
if self.showAll:
self.stream.write(self.fmt % self.counter)
super(LLDBTestResult, self).startTest(test)
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_start(test))
示例12: startTest
def startTest(self, test):
if configuration.shouldSkipBecauseOfCategories(
self.getCategoriesForTest(test)):
self.hardMarkAsSkipped(test)
if self.checkExclusion(
configuration.skip_tests, test.id()):
self.hardMarkAsSkipped(test)
self.counter += 1
test.test_number = self.counter
if self.showAll:
self.stream.write(self.fmt % self.counter)
super(LLDBTestResult, self).startTest(test)
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_start(test))
示例13: visit
def visit(prefix, dir, names):
"""Visitor function for os.path.walk(path, visit, arg)."""
dir_components = set(dir.split(os.sep))
excluded_components = set(['.svn', '.git'])
if dir_components.intersection(excluded_components):
return
# Gather all the Python test file names that follow the Test*.py pattern.
python_test_files = [
name
for name in names
if name.endswith('.py') and name.startswith(prefix)]
# Visit all the python test files.
for name in python_test_files:
try:
# Ensure we error out if we have multiple tests with the same
# base name.
# Future improvement: find all the places where we work with base
# names and convert to full paths. We have directory structure
# to disambiguate these, so we shouldn't need this constraint.
if name in configuration.all_tests:
raise Exception("Found multiple tests with the name %s" % name)
configuration.all_tests.add(name)
# Run the relevant tests in the python file.
visit_file(dir, name)
except Exception as ex:
# Convert this exception to a test event error for the file.
test_filename = os.path.abspath(os.path.join(dir, name))
if configuration.results_formatter_object is not None:
# Grab the backtrace for the exception.
import traceback
backtrace = traceback.format_exc()
# Generate the test event.
configuration.results_formatter_object.handle_event(
EventBuilder.event_for_job_test_add_error(
test_filename, ex, backtrace))
raise
示例14: parseOptionsAndInitTestdirs
#.........这里部分代码省略.........
configuration.sdir_name = args.s
configuration.session_file_format = args.session_file_format
if args.t:
os.environ['LLDB_COMMAND_TRACE'] = 'YES'
if args.v:
configuration.verbose = 2
# argparse makes sure we have a number
if args.sharp:
configuration.count = args.sharp
if sys.platform.startswith('win32'):
os.environ['LLDB_DISABLE_CRASH_DIALOG'] = str(
args.disable_crash_dialog)
os.environ['LLDB_LAUNCH_INFERIORS_WITHOUT_CONSOLE'] = str(True)
if do_help:
usage(parser)
if args.no_multiprocess:
configuration.no_multiprocess_test_runner = True
if args.inferior:
configuration.is_inferior_test_runner = True
if args.num_threads:
configuration.num_threads = args.num_threads
if args.test_subdir:
configuration.multiprocess_test_subdir = args.test_subdir
if args.test_runner_name:
configuration.test_runner_name = args.test_runner_name
# Capture test results-related args.
if args.curses and not args.inferior:
# Act as if the following args were set.
args.results_formatter = "lldbsuite.test_event.formatter.curses.Curses"
args.results_file = "stdout"
if args.results_file:
configuration.results_filename = args.results_file
if args.results_port:
configuration.results_port = args.results_port
if args.results_file and args.results_port:
sys.stderr.write(
"only one of --results-file and --results-port should "
"be specified\n")
usage(args)
if args.results_formatter:
configuration.results_formatter_name = args.results_formatter
if args.results_formatter_options:
configuration.results_formatter_options = args.results_formatter_options
# Default to using the BasicResultsFormatter if no formatter is specified
# and we're not a test inferior.
if not args.inferior and configuration.results_formatter_name is None:
configuration.results_formatter_name = (
"lldbsuite.test_event.formatter.results_formatter.ResultsFormatter")
# rerun-related arguments
configuration.rerun_all_issues = args.rerun_all_issues
configuration.rerun_max_file_threshold = args.rerun_max_file_threshold
if args.lldb_platform_name:
configuration.lldb_platform_name = args.lldb_platform_name
if args.lldb_platform_url:
configuration.lldb_platform_url = args.lldb_platform_url
if args.lldb_platform_working_dir:
configuration.lldb_platform_working_dir = args.lldb_platform_working_dir
if args.event_add_entries and len(args.event_add_entries) > 0:
entries = {}
# Parse out key=val pairs, separated by comma
for keyval in args.event_add_entries.split(","):
key_val_entry = keyval.split("=")
if len(key_val_entry) == 2:
(key, val) = key_val_entry
val_parts = val.split(':')
if len(val_parts) > 1:
(val, val_type) = val_parts
if val_type == 'int':
val = int(val)
entries[key] = val
# Tell the event builder to create all events with these
# key/val pairs in them.
if len(entries) > 0:
EventBuilder.add_entries_to_all_events(entries)
# Gather all the dirs passed on the command line.
if len(args.args) > 0:
configuration.testdirs = list(
map(lambda x: os.path.realpath(os.path.abspath(x)), args.args))
# Shut off multiprocessing mode when test directories are specified.
configuration.no_multiprocess_test_runner = True