[Piglit] [PATCH 1/5] arb_uniform_buffer_object: Random test generation infrastructure

Tapani tapani.palli at intel.com
Mon Nov 3 01:10:25 PST 2014


On 09/24/2014 07:47 PM, Ian Romanick wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This is the core of the random test generation infrastructure.  This
> Python script can be used stand-alone to generate fully random tests, or
> it can be called from other Python code to generate tests in a more
> directed manner.  Examples of both uses are coming in future patches.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>

8<

> +
> +def scalar_derp(type, name, offset, data):
> +    if type == "bool":
> +        if int(data) == 0:
> +            return name
> +        else:
> +            return "!" + name
> +    elif type == "uint":
> +        return "{} != {}u".format(name, data)
> +    elif type == "int":
> +        return "{} != {}".format(name, data)
> +    elif type == "float":
> +        bits = fudge_data_for_setter(data, "float")
> +        return "!float_match({}, {}, {}u)".format(name, data, bits)
> +    elif type == "double":
> +        bits = fudge_data_for_setter(data, "double")
> +
> +        # 0xHHHHHHHHLLLLLLLL
> +        # 012345678901234567
> +
> +        hi = "0x" + bits[2:9]
> +        lo = "0x" + bits[10:17]

I noticed  that the tests had wrong values for hi and lo when testing 
uvec2 against double. We had a look at this with Topi and believe that 
here generator should use 2:10 and 10:18 to get correct values. Maybe 
'bits' could be renamed as 'hex_digits'?

> +
> +        return "!double_match({}, uvec2({}, {}))".format(name, lo, hi)
> +    else:
> +        raise BaseException("Unknown scalar type {}".format(type))
> +
> +
>

// Tapani


More information about the Piglit mailing list