[Piglit] [PATCH 1/2] genclbuiltins.py: Add a arguments for funtion gen.

Dylan Baker baker.dylan.c at gmail.com
Wed Oct 30 14:19:02 CET 2013


s/funtion/function/

On Wednesday, October 30, 2013 04:01:09 PM Yi Sun wrote:
> Via the new arg, we can configure the vector size while generating the
> test.cl. For NOT disturbing previous test cases, set a default value.
> 
> Signed-off-by: Yi Sun <yi.sun at intel.com>
> 
> diff --git a/generated_tests/genclbuiltins.py
> b/generated_tests/genclbuiltins.py index 721191e..bdb18e9 100644
> --- a/generated_tests/genclbuiltins.py
> +++ b/generated_tests/genclbuiltins.py
> @@ -332,7 +332,7 @@ def print_test(f, fnName, argType, functionDef, tests,
> testIdx, vecSize, tss): f.write('\n')
> 
> 

Rather than setting a default you don't want and then overwriting it with one 
you do, why don't you just make the default the value what you want?

> -def gen(types, minVersions, functions, testDefs, dirName):
> +def gen(types, minVersions, functions, testDefs, dirName, sizes=[]):
sizes=sorted([1] + VEC_WIDTHS) or sizes=sorted(ALL_WIDTHS); I don't know 
enough about CL testing to know whether ALL_WIDTHS is valid. Tom or Aaron 
would have to answer that.

>      # Create the output directory if required
>      if not os.path.exists(dirName):
>          os.makedirs(dirName)
> @@ -377,8 +377,10 @@ def gen(types, minVersions, functions, testDefs,
> dirName): numTests = len(outputValues)
> 
>              # Handle all available scalar/vector widths
> -            sizes = sorted(VEC_WIDTHS)
> -            sizes.insert(0, 1)  # Add 1-wide scalar to the vector widths
> +            if sizes == []:
> +                sizes = sorted(VEC_WIDTHS)
> +                sizes.insert(0, 1)  # Add 1-wide scalar to the vector
> widths +

With the suggested changes you wouldn't need this if statement at all

>              for vecSize in sizes:
>                  for testIdx in range(0, numTests):
>                      print_test(f, fnName, dataType, functionDef, tests,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20131030/f209784b/attachment.pgp>


More information about the Piglit mailing list