File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,24 @@ shopt -s nullglob
1111
1212TIMEOUT_SEC=5
1313
14+ # Use GNU timeout if available; Windows timeout.exe is incompatible with
15+ # `timeout N command ...` and can make every test look like a failure.
16+ TIMEOUT_BIN=" "
17+ if command -v timeout > /dev/null 2>&1 ; then
18+ if timeout --version 2> /dev/null | grep -qi " coreutils" ; then
19+ TIMEOUT_BIN=" timeout"
20+ fi
21+ fi
22+
23+ # macOS users often install coreutils as gtimeout.
24+ if [[ -z " $TIMEOUT_BIN " ]] && command -v gtimeout > /dev/null 2>&1 ; then
25+ TIMEOUT_BIN=" gtimeout"
26+ fi
27+
28+ if [[ -z " $TIMEOUT_BIN " ]]; then
29+ echo " ⚠️ GNU timeout not found; running without per-test timeout."
30+ fi
31+
1432cargo fmt --all
1533
1634echo " 🔍 Running clippy... (warnings ignored)"
@@ -41,12 +59,17 @@ for f in "${examples[@]}"; do
4159 fi
4260
4361 echo " testing $f "
44- output=$( timeout " $TIMEOUT_SEC " " ${cmd[@]} " 2>&1 )
45- rc=$?
62+ if [[ -n " $TIMEOUT_BIN " ]]; then
63+ output=$( $TIMEOUT_BIN " $TIMEOUT_SEC " " ${cmd[@]} " 2>&1 )
64+ rc=$?
65+ else
66+ output=$( " ${cmd[@]} " 2>&1 )
67+ rc=$?
68+ fi
4669
4770 if [[ $rc -eq 0 ]]; then
4871 pass+=(" $name " )
49- elif [[ $rc -eq 124 ]]; then
72+ elif [[ -n " $TIMEOUT_BIN " && $rc -eq 124 ]]; then
5073 tout+=(" $name " )
5174 elif echo " $output " | grep -q " Unimplemented" ; then
5275 skip+=(" $name " )
You can’t perform that action at this time.
0 commit comments