[PATCH weston v5 2/6] By default, stop test execution if unrecognized parameters are encountered.

Jon A. Cruz jonc at osg.samsung.com
Thu Jun 25 12:52:29 PDT 2015


On 06/25/2015 05:36 AM, Pekka Paalanen wrote:
> On Sat, 20 Jun 2015 15:47:44 -0700
> "Jon A. Cruz" <jonc at osg.samsung.com> wrote:
> 
>> Signed-off-by: Jon A. Cruz <jonc at osg.samsung.com>
>> ---
>>  tools/zunitc/src/main.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/zunitc/src/main.c b/tools/zunitc/src/main.c
>> index cc86185..8179807 100644
>> --- a/tools/zunitc/src/main.c
>> +++ b/tools/zunitc/src/main.c
>> @@ -41,7 +41,16 @@ main(int argc, char* argv[])
>>  	int rc = zuc_initialize(&argc, argv, &helped);
>>  
>>  	if ((rc == EXIT_SUCCESS) && !helped) {
>> -		rc = ZUC_RUN_TESTS();
>> +		/* Stop if any unrecognized parameters were encountered. */
>> +		if (argc > 1) {
>> +			printf("%s: unrecognized option '%s'\n",
>> +			       argv[0], argv[1]);
>> +			printf("Try '%s --help' for more information.\n",
>> +			       argv[0]);
>> +			rc = EXIT_FAILURE;
>> +		} else {
>> +			rc = ZUC_RUN_TESTS();
>> +		}
>>  	}
>>  
>>  	zuc_cleanup();
> 
> Hi Jon,
> 
> looks good. Any reason it's a follow-up patch rather than squashed into
> patch 1 which creates main.c?

Mainly was that being left in git history by itself makes for a quick
reference for other devs who might need to extend things themselves in
regards to command-line.


> I suppose it could also print all remaining options.

That was one thing looked into, but one bad parameter in the middle of a
set could cause the remaining ones to show up as false negatives.

-- 
Jon A. Cruz - Senior Open Source Developer
Samsung Open Source Group
jonc at osg.samsung.com


More information about the wayland-devel mailing list