lib/tst_test: Do TBROK on unexpected arguments.
RFC PATCH 1/1 lib/tst_test: Do TBROK on unexpected arguments.
The argument parsing code in the test library ignored positional arguments and that lead to:
commit 8501feeb89e8a47e7feacd80179d852c3810249c
Author: Sandeep Patil <[email protected]> Date: Fri Sep 22 15:59:41 2017 -0700
mm: mmapstress04: Remove arguments passed to the test.
Which removed leftover arguments from the testcase much later after the test was rewritten. The correct behavior for the library is to issue TBROK on unexpected command line parameters.
Signed-off-by Cyril Hrubis <[email protected]>
--- lib/tst_test.c | 3 +++ 1 file changed, 3 insertions(+)
lib/tst_test.c +3 -0
@@ -491,6 +491,9 @@ static void parse_opts(int argc, char *argv[])parse_topt (topts_len, opt, optarg); } } + +if (optind < argc) +tst_brk (TBROK ,"Unexpected argument(s) '%s'..." , argv[optind]); }int tst_parse_int (const char *str,int *val,int min,int max)
Signature · 1 line
2.13.5
RFC PATCH 1/1 lib/tst_test: Do TBROK on unexpected arguments.
Hi,
lib/tst_test.c static void parse_opts(int argc, char *argv[]) · line 496
Quoted 2 lines
lib/tst_test.c +2
-0+if (optind < argc) +tst_brk (TBROK ,"Unexpected argument(s) '%s'..." , argv[optind]);
LGTM.
Kind regards,
Petr
RFC PATCH 1/1 lib/tst_test: Do TBROK on unexpected arguments.
Hi!
Pushed.
Signature · 2 lines
Cyril Hrubis [email protected]