Skip to content

Commit bf2da78

Browse files
committed
Revert "Truncate external tracer error output"
This reverts commit 9d87605.
1 parent 9d87605 commit bf2da78

1 file changed

Lines changed: 6 additions & 25 deletions

File tree

Lib/test/test_dtrace.py

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ def get_probe_binary():
5151
return binary
5252

5353

54-
def truncate_output(output, *, max_lines=3, max_chars=500):
55-
lines = [line.strip() for line in output.splitlines() if line.strip()]
56-
omitted = len(lines) - max_lines
57-
output = "; ".join(lines[:max_lines])
58-
if omitted > 0:
59-
output += f"; ... ({omitted} lines omitted)"
60-
if len(output) > max_chars:
61-
output = output[:max_chars - 3] + "..."
62-
return output
63-
64-
6554
def normalize_trace_output(output):
6655
"""Normalize DTrace output for comparison.
6756
@@ -132,8 +121,7 @@ def run_readelf(cmd):
132121
raise AssertionError(
133122
f"Command {shlex.join(cmd)!r} failed "
134123
f"with exit code {proc.returncode}: "
135-
f"stdout={truncate_output(stdout)!r} "
136-
f"stderr={truncate_output(stderr)!r}"
124+
f"stdout={stdout!r} stderr={stderr!r}"
137125
)
138126

139127
return stdout
@@ -179,8 +167,7 @@ def trace(self, script_file, subcommand=None, *, timeout=None,
179167
if check_returncode and proc.returncode:
180168
raise AssertionError(
181169
f"Command {shlex.join(command)!r} failed "
182-
f"with exit code {proc.returncode}: "
183-
f"output={truncate_output(stdout)!r}"
170+
f"with exit code {proc.returncode}: output={stdout!r}"
184171
)
185172
return stdout
186173

@@ -205,9 +192,7 @@ def assert_usable(self):
205192
output = str(fnfe)
206193
if output != "probe: success":
207194
raise unittest.SkipTest(
208-
"{}(1) failed: {}".format(
209-
self.COMMAND[0], truncate_output(output)
210-
)
195+
"{}(1) failed: {}".format(self.COMMAND[0], output)
211196
)
212197

213198

@@ -369,8 +354,7 @@ def run_case(self, name, optimize_python=None):
369354

370355
if proc.returncode != 0:
371356
raise AssertionError(
372-
f"bpftrace failed with code {proc.returncode}: "
373-
f"{truncate_output(stderr)}"
357+
f"bpftrace failed with code {proc.returncode}:\n{stderr}"
374358
)
375359

376360
stdout = self._filter_probe_rows(stdout)
@@ -410,15 +394,12 @@ def assert_usable(self):
410394
# Check for permission errors (bpftrace usually requires root)
411395
if proc.returncode != 0:
412396
raise unittest.SkipTest(
413-
f"bpftrace(1) failed with code {proc.returncode}: "
414-
f"{truncate_output(stderr)}"
397+
f"bpftrace(1) failed with code {proc.returncode}: {stderr}"
415398
)
416399

417400
if "probe: success" not in stdout:
418401
raise unittest.SkipTest(
419-
f"bpftrace(1) failed: "
420-
f"stdout={truncate_output(stdout)!r} "
421-
f"stderr={truncate_output(stderr)!r}"
402+
f"bpftrace(1) failed: stdout={stdout!r} stderr={stderr!r}"
422403
)
423404

424405

0 commit comments

Comments
 (0)