Skip to content

Commit 8c2c464

Browse files
committed
fix: try to fix CI hangs
1 parent 7f7efb4 commit 8c2c464

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

bench/bench.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# /// script
33
# requires-python = ">=3.9"
44
# dependencies = [
5-
# "pytest>=8.0",
5+
# "pytest>=8.4.2",
66
# "pytest-codspeed>=4.2.0",
77
# ]
88
# ///
@@ -12,6 +12,7 @@
1212
import shlex
1313
import subprocess
1414
from pathlib import Path
15+
import time
1516

1617
import pytest
1718

@@ -53,7 +54,7 @@ def run_valgrind(self, *args: str) -> None:
5354
Args:
5455
*args: Valgrind arguments
5556
"""
56-
callgrind_output = self.output_dir / f"callgrind.{os.getpid()}"
57+
callgrind_output = self.output_dir / f"callgrind.{os.getpid()}.{time.time_ns()}"
5758

5859
cmd = [
5960
self.valgrind_path,
@@ -63,10 +64,16 @@ def run_valgrind(self, *args: str) -> None:
6364
*shlex.split(self.cmd),
6465
]
6566

66-
result = subprocess.run(cmd)
67+
# Add timeout and capture output to prevent hanging and buffering issues
68+
result = subprocess.run(
69+
cmd,
70+
capture_output=True,
71+
text=True,
72+
)
6773
if result.returncode != 0:
6874
raise RuntimeError(
69-
f"Valgrind execution failed with code {result.returncode}"
75+
f"Valgrind execution failed with code {result.returncode}\n"
76+
f"stderr: {result.stderr}"
7077
)
7178

7279
# Clean up

0 commit comments

Comments
 (0)