Parse all AMD GPU check args (#1586)
This commit is contained in:
@@ -39,19 +39,19 @@ Environment:
|
|||||||
USAGE
|
USAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
case "${1:-}" in
|
for _arg in "$@"; do
|
||||||
--help|-h)
|
case "${_arg}" in
|
||||||
_usage
|
--help|-h)
|
||||||
exit 0
|
_usage
|
||||||
;;
|
exit 0
|
||||||
"")
|
;;
|
||||||
;;
|
*)
|
||||||
*)
|
printf 'Unknown option: %s\n\n' "${_arg}" >&2
|
||||||
printf 'Unknown option: %s\n\n' "$1" >&2
|
_usage >&2
|
||||||
_usage >&2
|
exit 1
|
||||||
exit 1
|
;;
|
||||||
;;
|
esac
|
||||||
esac
|
done
|
||||||
|
|
||||||
_find_cmd() {
|
_find_cmd() {
|
||||||
if command -v "$1" >/dev/null 2>&1; then
|
if command -v "$1" >/dev/null 2>&1; then
|
||||||
|
|||||||
21
tests/test_amd_gpu_check_args.py
Normal file
21
tests/test_amd_gpu_check_args.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import subprocess
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPT = Path(__file__).resolve().parent.parent / "scripts" / "check-docker-amd-gpu.sh"
|
||||||
|
|
||||||
|
|
||||||
|
def test_amd_gpu_check_rejects_unknown_extra_arg_before_diagnostics():
|
||||||
|
proc = subprocess.run(
|
||||||
|
["bash", str(SCRIPT), "--bad-option"],
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
check=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
assert proc.returncode == 1
|
||||||
|
assert "Unknown option: --bad-option" in proc.stderr
|
||||||
|
|
||||||
|
|
||||||
|
def test_amd_gpu_check_shell_syntax():
|
||||||
|
subprocess.run(["bash", "-n", str(SCRIPT)], check=True)
|
||||||
Reference in New Issue
Block a user