summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-03-15 15:59:59 +0100
committerChristoph Reiter <reiter.christoph@gmail.com>2018-03-15 16:00:20 +0100
commit8e80469a008fb1da5a667203362f9881005f9229 (patch)
treed182e68829e1102afda08d5c2c303699d285e07e /setup.py
parent37c1912658c91788c0e3ef221667efba00aed0b4 (diff)
downloadpygobject-8e80469a008fb1da5a667203362f9881005f9229.tar.gz
setup.py: add option to run under gdb
setup.py test --gdb Also sets an env var so we can disable one test which uses SIGINT on the test process, which makes gdb break.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index 57009158..1620c4a7 100755
--- a/setup.py
+++ b/setup.py
@@ -444,16 +444,19 @@ class test(Command):
user_options = [
("valgrind", None, "run tests under valgrind"),
("valgrind-log-file=", None, "save logs instead of printing them"),
+ ("gdb", None, "run tests under gdb"),
]
def initialize_options(self):
self.valgrind = None
self.valgrind_log_file = None
+ self.gdb = None
def finalize_options(self):
self.valgrind = bool(self.valgrind)
if self.valgrind_log_file and not self.valgrind:
raise DistutilsOptionError("valgrind not enabled")
+ self.gdb = bool(self.gdb)
def run(self):
cmd = self.reinitialize_command("build_tests")
@@ -479,20 +482,24 @@ class test(Command):
sys.prefix, "share", "glib-2.0", "valgrind", "glib.supp"))
return [f for f in files if os.path.isfile(f)]
+ pre_args = []
+
if self.valgrind:
env["G_SLICE"] = "always-malloc"
env["G_DEBUG"] = "gc-friendly"
env["PYTHONMALLOC"] = "malloc"
- pre_args = [
+ pre_args += [
"valgrind", "--leak-check=full", "--show-possibly-lost=no",
"--num-callers=20", "--child-silent-after-fork=yes",
] + ["--suppressions=" + f for f in get_suppression_files()]
if self.valgrind_log_file:
pre_args += ["--log-file=" + self.valgrind_log_file]
- else:
- pre_args = []
+
+ if self.gdb:
+ env["PYGI_TEST_GDB"] = "1"
+ pre_args += ["gdb", "--args"]
if pre_args:
log.info(" ".join(pre_args))