Re: [PATCH] test-suite: handle format with filename.c not existing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/23/2018 03:22 AM, Christopher Li wrote:
> On Mon, Jan 22, 2018 at 11:05 AM, Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>> From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
>>
>> In error(), quiet is undefined when the command:
>>   $ ./test-suite format filename1.c foobar1
>>
>> is used and filename1.c does not exist. This causes a shell script error:
>>   ./test-suite: line 147: [: : integer expression expected
>>
>> because $quiet is undefined in
>>   [ "$quiet" -ne 1 ] && echo "error: $1"
>> so the error message is lost.
>>
>> Just initialize quiet before any command line parsing.
>>
>> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
>> ---
>>  validation/test-suite |    2 ++
>>  1 file changed, 2 insertions(+)
>>
>> --- sprs.orig/validation/test-suite
>> +++ sprs.next/validation/test-suite
>> @@ -368,6 +368,8 @@ arg_file()
>>         return 0
>>  }
>>
>> +quiet=0
>> +
> 
> Good catch. I think this fix is not ideal.
> There is another quite=0 inside "do_test()".
> <quote>
> quiet=0
> [ $must_fail -eq 1 ] && [ $V -eq 0 ] && quiet=1
> </quote>
> 
> The "quite=0" only cover the case inside "do_test()".
> Even with this patch,  If  the "quite" is used outside of
> "do_test()", The "quite" variable is not set properly according to "V".
> 
> I would suggest move the above two quote line out side
> of "do_test()", right after the default value of "V", in the
> beginning of the file:
> 
> <quote>
> # defaults to not verbose
> [ -z "$V" ] && V=0
> </quote>

At the beginning of the file, $must_fail is not defined, so it will not -eq 1,
so quiet will remain = 0.

I guess that I don't understand the interplay between $V and $quiet and why
have both of them.

Are you suggesting that $quiet should be initialized by default like this:
(just drop the $must_fail part)

> quiet=0
> [ $V -eq 0 ] && quiet=1


thanks,
-- 
~Randy
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux