| 1 |
# DExTer : Debugging Experience Tester |
| 2 |
# ~~~~~~ ~ ~~ ~ ~~ |
| 3 |
# |
| 4 |
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 5 |
# See https://llvm.org/LICENSE.txt for license information. |
| 6 |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 7 |
"""A Command that enables test writers to terminate a test after a specified |
| 8 |
breakpoint has been hit a number of times. |
| 9 |
""" |
| 10 |
|
| 11 |
from dex.command.CommandBase import CommandBase |
| 12 |
|
| 13 |
|
| 14 |
class DexFinishTest(CommandBase): |
| 15 |
def __init__(self, *args, **kwargs): |
| 16 |
if len(args) == 0: |
| 17 |
self.expression = None |
| 18 |
self.values = [] |
| 19 |
elif len(args) == 1: |
| 20 |
raise TypeError("expected 0 or at least 2 positional arguments") |
| 21 |
else: |
| 22 |
self.expression = args[0] |
| 23 |
self.values = [str(arg) for arg in args[1:]] |
| 24 |
self.on_line = kwargs.pop("on_line") |
| 25 |
self.hit_count = kwargs.pop("hit_count", 0) |
| 26 |
if kwargs: |
| 27 |
raise TypeError("unexpected named args: {}".format(", ".join(kwargs))) |
| 28 |
super(DexFinishTest, self).__init__() |
| 29 |
|
| 30 |
def eval(self): |
| 31 |
raise NotImplementedError("DexFinishTest commands cannot be evaled.") |
| 32 |
|
| 33 |
@staticmethod |
| 34 |
def get_name(): |
| 35 |
return __class__.__name__ |
| 36 |
|
| 37 |
@staticmethod |
| 38 |
def get_subcommands() -> dict: |
| 39 |
return None |