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

Bryce Harrington bryce at osg.samsung.com
Fri May 29 11:37:08 PDT 2015


On Tue, May 26, 2015 at 04:06:38PM -0700, Jon A. Cruz wrote:
> Signed-off-by: Jon A. Cruz <jonc at osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

> ---
>  tools/zunitc/src/main.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/zunitc/src/main.c b/tools/zunitc/src/main.c
> index 7049db0..0b4ce86 100644
> --- a/tools/zunitc/src/main.c
> +++ b/tools/zunitc/src/main.c
> @@ -26,6 +26,7 @@
>  
>  #include "config.h"
>  
> +#include <stdio.h>
>  #include <stdlib.h>
>  
>  #include "zunitc/zunitc.h"
> @@ -36,7 +37,16 @@ int 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();
> -- 
> 2.1.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list