Compare commits

...
Author SHA1 Message Date
Vedant Dadhich 2f28a5adbb Scripts: run GPU tests without GNU timeout
stock macOS does not provide the timeout command used by scripts/test-gpu.sh. Add a Python 3 fallback that preserves duration parsing, process-group termination and exit status 124, while continuing to use GNU timeout when it is available.

Signed-off-by: Vedant Dadhich <vedantdadhich21@gmail.com>
2026-11-25 01:38:11 +05:30
3 changed files with 39 additions and 1 deletions

No files matched your search

+1
View File
@@ -23,6 +23,7 @@ remains unsupported.
### Fixed
- Made the native semantic-review timeout in `scripts/test-gpu.sh` configurable with `XENORA_SEMANTIC_TIMEOUT` and raised its default from 120 to 300 seconds, so cold Apple Silicon runs do not fail while the expanded Metal known-answer suite is still progressing.
- Added a Python 3 fallback for `timeout` in `scripts/test-gpu.sh`, so the native Metal suite runs on stock macOS without GNU coreutils while preserving bounded execution and the usual timeout exit status.
### Added
- Added a documented independent acceptance rule for promoting AMD RDNA2 desktop GPU (gfx1030) forms from local CPU and Metal results to `fixture verified`, including clean-commit evidence, reviewer independence, raw-log location, review-log summary, failure handling and status regeneration (#302).
+1 -1
View File
@@ -309,7 +309,7 @@ These require a Metal-capable Apple Silicon Mac.
scripts/test-gpu.sh
```
The native test suite enables Metal API and shader validation and tests the supported compute, rendering and texture paths. The full semantic-review batch defaults to a 300-second timeout; set `XENORA_SEMANTIC_TIMEOUT` to raise or lower it for a slower or faster host.
The native test suite enables Metal API and shader validation and tests the supported compute, rendering and texture paths. The full semantic-review batch defaults to a 300-second timeout; set `XENORA_SEMANTIC_TIMEOUT` to raise or lower it for a slower or faster host. On macOS, the script uses a Python 3 fallback when GNU `timeout` is unavailable.
### Verify guest execution
+37
View File
@@ -13,6 +13,43 @@ export CARGO_BUILD_JOBS=${CARGO_BUILD_JOBS:-4}
# allow slower hosts to raise it without editing the script.
export XENORA_SEMANTIC_TIMEOUT=${XENORA_SEMANTIC_TIMEOUT:-300s}
# macOS does not ship GNU timeout. Python 3 is already a project requirement,
# so use a small POSIX-compatible fallback rather than making coreutils a
# prerequisite for the native suite.
if ! command -v timeout >/dev/null 2>&1; then
timeout() {
duration=$1
shift
python3 - "$duration" "$@" <<'PY'
import os
import re
import signal
import subprocess
import sys
text = sys.argv[1]
match = re.fullmatch(r"(\d+(?:\.\d+)?)([smh]?)", text)
if match is None:
print(f"timeout: invalid duration {text!r}", file=sys.stderr)
raise SystemExit(2)
seconds = float(match.group(1)) * {"": 1, "s": 1, "m": 60, "h": 3600}[match.group(2)]
try:
process = subprocess.Popen(sys.argv[2:], start_new_session=True)
except FileNotFoundError as error:
print(f"timeout: {error}", file=sys.stderr)
raise SystemExit(127)
try:
code = process.wait(timeout=seconds)
except subprocess.TimeoutExpired:
os.killpg(process.pid, signal.SIGKILL)
process.wait()
print(f"timeout: command exceeded {seconds:g} seconds", file=sys.stderr)
raise SystemExit(124)
raise SystemExit(code)
PY
}
fi
cargo test --locked -p xenora-metal --features gpu-tests --test native_compute --no-run
timeout 30s cargo test --locked -p xenora-metal --features gpu-tests --test native_compute -- \
--nocapture --test-threads=1