Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-98894: Check readelf failures in test_dtrace
Report readelf command failures directly instead of later failing with
missing-probe assertions.
  • Loading branch information
stratakis committed Jun 26, 2026
commit 3555323c72bb9275fb64f312f707cdc3102cd877
14 changes: 11 additions & 3 deletions Lib/test/test_dtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def get_readelf_version():
version, stderr = proc.communicate()

if proc.returncode:
raise Exception(
raise AssertionError(
f"Command {' '.join(cmd)!r} failed "
f"with exit code {proc.returncode}: "
f"stdout={version!r} stderr={stderr!r}"
Expand Down Expand Up @@ -464,13 +464,21 @@ def get_readelf_output(self):
command = ["readelf", "-n", binary]
# Force the C locale to disable localization.
env = dict(os.environ, LC_ALL="C")
stdout, _ = subprocess.Popen(
proc = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
env=env,
).communicate()
)
with proc:
stdout, _ = proc.communicate()

if proc.returncode:
raise AssertionError(
f"Command {' '.join(command)!r} failed "
f"with exit code {proc.returncode}: stdout={stdout!r}"
)
return stdout

def test_check_probes(self):
Expand Down
Loading