[LTP] [PATCH 1/3] lib/tst_net.sh: Append 6 to the end of $TST_OPTS
Alexey Kodanev
alexey.kodanev@oracle.com
Mon May 7 12:31:05 CEST 2018
On 05/07/2018 11:09 AM, Petr Vorel wrote:
> Hi Xiao,
>
>>> Good catch. Although I propose to get rid of ':' at the beginning for users of new shell
>>> API (as it's IMHO better to see errors).
>> Hi Petr,
>
>> If getopts is in silent mode, the invalid option is placed in OPTARG, so
>> we can see errors by printing
>> the value of OPTARG. But it is reasonable for me to get rid of ':' at the
>> beginning of optstring. :-)
> I know, TBROK inform us, so it can stay how it is for legacy API.
> I meant it for the new API, where is going to be removed (the TBROK as well) as error is
> handled in tst_run in tst_test.sh.
>
What about silence error in tst_test.sh? And remove preceding column in the
tests (tcp_fastopen.sh, nfs_lib.sh). We handle the error already there, in
tst_run (and in old API the scripts have TBROK), so there is no point
printing one more redundant message that doesn't have LTP format.
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index 8d49d34..edac619 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -265,11 +265,12 @@ tst_run()
OPTIND=1
- while getopts "hi:$TST_OPTS" name $TST_ARGS; do
+ while getopts ":hi:$TST_OPTS" name $TST_ARGS; do
case $name in
'h') tst_usage; exit 0;;
'i') TST_ITERATIONS=$OPTARG;;
- '?') tst_usage; exit 2;;
+ '?') tst_usage
+ tst_brk TBROK "invalid option: '$OPTARG'";;
*) $TST_PARSE_ARGS "$name" "$OPTARG";;
esac
More information about the ltp
mailing list