https://github.com/python/cpython/commit/e0db0e4d3472716149f5861deee6390ac8e9b47f commit: e0db0e4d3472716149f5861deee6390ac8e9b47f branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: vstinner <[email protected]> date: 2026-07-02T15:37:52Z summary:
[3.15] gh-98894: Check tracer exit status in test_dtrace (GH-152893) (#152900) gh-98894: Check tracer exit status in test_dtrace (GH-152893) Fail functional dtrace and SystemTap cases directly when the tracer exits non-zero. (cherry picked from commit 311e7e79f4e305f1217ef548a62ea219a47c0d7b) Co-authored-by: stratakis <[email protected]> files: M Lib/test/test_dtrace.py diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py index 788d31c60f4d97..e1662a70b26d3e 100644 --- a/Lib/test/test_dtrace.py +++ b/Lib/test/test_dtrace.py @@ -125,7 +125,8 @@ def generate_trace_command(self, script_file, subcommand=None): command += ["-c", subcommand] return command - def trace(self, script_file, subcommand=None, *, timeout=None): + def trace(self, script_file, subcommand=None, *, timeout=None, + check_returncode=False): command = self.generate_trace_command(script_file, subcommand) proc = create_process_group(command, stdout=subprocess.PIPE, @@ -136,6 +137,11 @@ def trace(self, script_file, subcommand=None, *, timeout=None): except subprocess.TimeoutExpired: kill_process_group(proc) raise + if check_returncode and proc.returncode: + raise AssertionError( + f"Command {' '.join(command)!r} failed " + f"with exit code {proc.returncode}: output={stdout!r}" + ) return stdout def trace_python(self, script_file, python_file, optimize_python=None): @@ -143,7 +149,8 @@ def trace_python(self, script_file, python_file, optimize_python=None): if optimize_python: python_flags.extend(["-O"] * optimize_python) subcommand = " ".join([sys.executable] + python_flags + [python_file]) - return self.trace(script_file, subcommand, timeout=60) + return self.trace(script_file, subcommand, timeout=60, + check_returncode=True) def assert_usable(self): try: _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
