util: remove -compat from arguments so as not to confuse tests

Submitted by Marek Olšák on Nov. 9, 2017, 10:49 p.m.

Details

Message ID 1510267789-18695-1-git-send-email-maraeo@gmail.com
State New
Headers show
Series "util: remove -compat from arguments so as not to confuse tests" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák Nov. 9, 2017, 10:49 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 tests/util/piglit-framework-gl.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
index 29e0e3a..22aadc5 100644
--- a/tests/util/piglit-framework-gl.c
+++ b/tests/util/piglit-framework-gl.c
@@ -179,20 +179,22 @@  process_args(int *argc, char *argv[], unsigned *force_samples,
 			}
 		} else if (!strcmp(argv[j], "-compat")) {
 			if (config->supports_gl_es_version) {
 				fprintf(stderr,
 					"-compat isn't allowed with ES tests!\n");
 				piglit_report_result(PIGLIT_FAIL);
 			}
 			config->supports_gl_compat_version = 10;
 			config->supports_gl_core_version = 0;
 			puts("The compatibility profile forced.");
+			delete_arg(argv, *argc, j--);
+			*argc -= 1;
 		}
 	}
 }
 
 void
 piglit_gl_process_args(int *argc, char *argv[],
 		       struct piglit_gl_test_config *config)
 {
 	unsigned force_samples = 0;
 

Comments

On 11/09/2017 03:49 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>   tests/util/piglit-framework-gl.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c
> index 29e0e3a..22aadc5 100644
> --- a/tests/util/piglit-framework-gl.c
> +++ b/tests/util/piglit-framework-gl.c
> @@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned *force_samples,
>   			}
>   		} else if (!strcmp(argv[j], "-compat")) {
>   			if (config->supports_gl_es_version) {
>   				fprintf(stderr,
>   					"-compat isn't allowed with ES tests!\n");
>   				piglit_report_result(PIGLIT_FAIL);
>   			}
>   			config->supports_gl_compat_version = 10;
>   			config->supports_gl_core_version = 0;
>   			puts("The compatibility profile forced.");
> +			delete_arg(argv, *argc, j--);
> +			*argc -= 1;
>   		}
>   	}
>   }
>
>   void
>   piglit_gl_process_args(int *argc, char *argv[],
>   		       struct piglit_gl_test_config *config)
>   {
>   	unsigned force_samples = 0;
>
>

Reviewed-by: Brian Paul <brianp@vmware.com>

IMO, the delete_arg() function should take care of decrementing argc. 
Want to do that too?

-Brian
On Thu, Nov 9, 2017 at 11:55 PM, Brian Paul <brianp@vmware.com> wrote:
> On 11/09/2017 03:49 PM, Marek Olšák wrote:
>>
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> ---
>>   tests/util/piglit-framework-gl.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/tests/util/piglit-framework-gl.c
>> b/tests/util/piglit-framework-gl.c
>> index 29e0e3a..22aadc5 100644
>> --- a/tests/util/piglit-framework-gl.c
>> +++ b/tests/util/piglit-framework-gl.c
>> @@ -179,20 +179,22 @@ process_args(int *argc, char *argv[], unsigned
>> *force_samples,
>>                         }
>>                 } else if (!strcmp(argv[j], "-compat")) {
>>                         if (config->supports_gl_es_version) {
>>                                 fprintf(stderr,
>>                                         "-compat isn't allowed with ES
>> tests!\n");
>>                                 piglit_report_result(PIGLIT_FAIL);
>>                         }
>>                         config->supports_gl_compat_version = 10;
>>                         config->supports_gl_core_version = 0;
>>                         puts("The compatibility profile forced.");
>> +                       delete_arg(argv, *argc, j--);
>> +                       *argc -= 1;
>>                 }
>>         }
>>   }
>>
>>   void
>>   piglit_gl_process_args(int *argc, char *argv[],
>>                        struct piglit_gl_test_config *config)
>>   {
>>         unsigned force_samples = 0;
>>
>>
>
> Reviewed-by: Brian Paul <brianp@vmware.com>
>
> IMO, the delete_arg() function should take care of decrementing argc. Want
> to do that too?

Not planning to. I don't remember what the other delete_arg call sites expect.

Marek