Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Nov 10, 2024
1 parent 03f9cf9 commit 2a5c585
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -11736,7 +11736,7 @@ def target_remote_posthook():
gef.session.remote = GefRemoteSessionManager(conn)

# switch back context to its old context
gef.config["context.enable"] = gef.temp.pop("context_old_value", False)
gef.config["context.enable"] = gef.temp.pop("context_old_value", True)

# if here, no exception was thrown, print context
gdb.execute("context")
Expand Down
47 changes: 30 additions & 17 deletions tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@ def __setup(self):
#
self._port = get_random_port()
self._commands = ""

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

# self._initfile = tempfile.NamedTemporaryFile(mode="w", delete=False)
# self._initfile.write(self._commands)
# self._initfile.flush()
self._command = [
# fmt: off
self._gdb_path, "-q", "-nx",
Expand All @@ -84,10 +70,37 @@ def __setup(self):
"-ex", "gef config gef.disable_color True",
"-ex", f"source {RPYC_GEF_PATH}",
"-ex", f"pi start_rpyc_service({self._port})",
"--",
# fmt: off
str(self._target.absolute()), # type: ignore pylint: disable=E1101
# 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._initfile = tempfile.NamedTemporaryFile(mode="w", delete=False)
# self._initfile.write(self._commands)
# self._initfile.flush()
# 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: off
self._command.extend(
("-ex",
str(self._target.absolute()) # type: ignore pylint: disable=E1101
)
)
# ]
self._process = subprocess.Popen(self._command)
assert self._process.pid > 0
time.sleep(RPYC_SPAWN_TIME)
Expand Down

0 comments on commit 2a5c585

Please sign in to comment.