RLTest 0.7.14__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
RLTest/_version.py ADDED
@@ -0,0 +1,8 @@
1
+
2
+ # This attribute is the only one place that the version number is written down,
3
+ # so there is only one place to change it when the version number changes.
4
+ try:
5
+ import pkg_resources
6
+ __version__ = pkg_resources.get_distribution('RLTest').version
7
+ except (pkg_resources.DistributionNotFound, AttributeError, ImportError):
8
+ __version__ = "99.99.99" # like redis modules
RLTest/debuggers.py ADDED
@@ -0,0 +1,81 @@
1
+ import platform
2
+ import os.path
3
+
4
+
5
+ class Valgrind(object):
6
+ is_interactive = False
7
+
8
+ def __init__(self, options, suppressions=None, fail_on_errors=True, leakcheck=True ):
9
+ self.options = options
10
+ self.suppressions = suppressions
11
+ self.leakcheck = leakcheck
12
+ self.fail_on_errors = fail_on_errors
13
+
14
+ def generate_command(self, logfile=None):
15
+ cmd = ['valgrind']
16
+ if self.fail_on_errors == True:
17
+ cmd += ['--error-exitcode=255']
18
+ for option in self.options.split():
19
+ cmd += [option]
20
+ if self.leakcheck:
21
+ if '--leak-check=full' not in self.options:
22
+ cmd += ['--leak-check=full']
23
+ if '--errors-for-leak-kinds=definite' not in self.options:
24
+ cmd += ['--errors-for-leak-kinds=definite']
25
+ if self.suppressions:
26
+ cmd += ['--suppressions=' + self.suppressions]
27
+ if logfile:
28
+ cmd += ['--log-file=' + logfile]
29
+ return cmd
30
+
31
+
32
+ class GenericInteractiveDebugger(object):
33
+ is_interactive = True
34
+
35
+ def __init__(self, cmdline):
36
+ self.args = cmdline.split()
37
+
38
+ def generate_command(self, *argc, **kw):
39
+ return [self.args]
40
+
41
+
42
+ class GDB(GenericInteractiveDebugger):
43
+ def __init__(self, cmdline="gdb"):
44
+ super(GDB, self).__init__(cmdline)
45
+
46
+ def generate_command(self, *argc, **kw):
47
+ return ['gdb', '-ex', 'run', '--args']
48
+
49
+
50
+ class CGDB(GenericInteractiveDebugger):
51
+ def __init__(self, cmdline="cgdb"):
52
+ super(CGDB, self).__init__(cmdline)
53
+
54
+ def generate_command(self, *argc, **kw):
55
+ return ['cgdb', '-ex', 'run', '--args']
56
+
57
+
58
+ class LLDB(GenericInteractiveDebugger):
59
+ def __init__(self, cmdline="lldb"):
60
+ super(LLDB, self).__init__(cmdline)
61
+
62
+ def generate_command(self, *argc, **kw):
63
+ return ['lldb', '-o', 'run', '--']
64
+
65
+
66
+ if platform.system() == 'Darwin':
67
+ DefaultInteractiveDebugger = LLDB
68
+ else:
69
+ DefaultInteractiveDebugger = GDB
70
+
71
+ default_interactive_debugger = DefaultInteractiveDebugger()
72
+
73
+ def set_interactive_debugger(debugger):
74
+ global default_interactive_debugger
75
+ cmd = os.path.basename(debugger.split()[0])
76
+ if cmd == 'gdb':
77
+ default_interactive_debugger = GDB(debugger)
78
+ elif cmd == 'cgdb':
79
+ default_interactive_debugger = CGDB(debugger)
80
+ elif cmd == 'lldb':
81
+ default_interactive_debugger = LLDB(debugger)