[LTP] [PATCH v3 4/5] tst_test.sh: Cleanup getopts usage

Martin Doucha mdoucha@suse.cz
Fri May 6 16:55:00 CEST 2022


On 06. 05. 22 16:44, Cyril Hrubis wrote:
> Hi!
>> diff --git a/testcases/kernel/containers/netns/netns_breakns.sh b/testcases/kernel/containers/netns/netns_breakns.sh
>> index 1ce5d37ef..b7f255cb8 100755
>> --- a/testcases/kernel/containers/netns/netns_breakns.sh
>> +++ b/testcases/kernel/containers/netns/netns_breakns.sh
>> @@ -29,11 +29,6 @@
>>  TST_POS_ARGS=3
>>  TST_SETUP=do_setup
>>  TST_TESTFUNC=do_test
>> -. netns_helper.sh
>> -
>> -PROG=$1
>> -IP_VER=$2
>> -COM_TYPE=$3
>>  
>>  do_setup()
>>  {
>> @@ -49,4 +44,10 @@ do_test()
>>  	EXPECT_FAIL $NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK
>>  }
>>  
>> +. netns_helper.sh
>> +
>> +PROG=$1
>> +IP_VER=$2
>> +COM_TYPE=$3
> 
> Can't we just keep these at the top along with the rest of the
> variables? I do not see them redefined anywhere but maybe I miss
> something.

tst_test.sh has to process command line arguments before these variables
can be set. Otherwise you'd have to put all command line switches
*AFTER* the positional arguments.

-- 
Martin Doucha   mdoucha@suse.cz
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list