Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy authored Nov 10, 2024
1 parent 68505a6 commit 02af4d4
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,30 +61,38 @@ def __setup(self):
#
self._port = get_random_port()
self._commands = ""
self._command = [
# fmt: off
self._gdb_path, "-q", "-nx",
"-ex", f"source {GEF_PATH}",
"-ex", "gef config gef.debug True",
"-ex", "gef config gef.propagate_debug_exception True",
"-ex", "gef config gef.disable_color True",
"-ex", f"source {RPYC_GEF_PATH}",
"-ex", f"pi start_rpyc_service({self._port})",
# fmt: on
]

if COVERAGE_DIR:
self._coverage_file = pathlib.Path(COVERAGE_DIR) / os.getenv(
"PYTEST_XDIST_WORKER", "gw0"
)
self._command.extend(("-ex",
f"""pi import coverage; cov = coverage.Coverage(data_file="{self._coverage_file}", auto_data=True, branch=True); cov.start()"""))
self._commands += f"""
pi import coverage
pi cov = coverage.Coverage(data_file="{self._coverage_file}", auto_data=True, branch=True)
pi cov.start()
"""

self._command.extend(
("--",
str(self._target.absolute()) # type: ignore pylint: disable=E1101
)
)
self._commands += f"""
source {GEF_PATH}
gef config gef.debug True
gef config gef.propagate_debug_exception True
gef config gef.disable_color True
source {RPYC_GEF_PATH}
pi start_rpyc_service({self._port})
"""

self._initfile = tempfile.NamedTemporaryFile(mode="w", delete=False)
self._initfile.write(self._commands)
self._initfile.flush()
self._command = [
"gdb",
"-q",
"-nx",
"-ex",
f"source {self._initfile.name}",
"--",
str(self._target.absolute()), # type: ignore pylint: disable=E1101
]

self._process = subprocess.Popen(self._command)
assert self._process.pid > 0
Expand Down

0 comments on commit 02af4d4

Please sign in to comment.