[script] fix exit status and help command in script/test (#13347)

- Change 'script/test' to exit with error status 1 on unrecognized
  commands, print usage, and redirect both the error message and
  usage text to stderr.
- Fix unbound variable crash in 'print_usage' when calling
  './script/test help'.
This commit is contained in:
Jonathan Hui
2026-07-14 15:36:36 -07:00
committed by GitHub
parent d132939de4
commit 262430abd8
+4 -3
View File
@@ -555,7 +555,7 @@ EXAMPLES:
$0 clean build expect
"
exit "$1"
exit "${1:-0}"
}
do_prepare_coredump_upload()
@@ -749,8 +749,9 @@ main()
do_combine_coverage
;;
*)
echo
echo -e "${OT_COLOR_FAIL}Warning:${OT_COLOR_NONE} Ignoring: '$1'"
echo >&2
echo -e "${OT_COLOR_FAIL}Error:${OT_COLOR_NONE} Unrecognized command: '$1'" >&2
print_usage 1 >&2
;;
esac
shift