On 11/03/2014 01:43 AM, Pohjolainen, Topi wrote: > On Mon, Nov 03, 2014 at 11:10:25AM +0200, Tapani wrote: >> On 09/24/2014 07:47 PM, Ian Romanick wrote: >>> From: Ian Romanick <[email protected]> >>> >>> 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 <[email protected]> >> >> 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'? > > There were only seven digits per hi/lo in the generated tests and we were > guessing the indexing here is probably open ended?
I could have sworn that ranges in Python are inclusive... but I think you are correct: >>> bits = '0x123456789abcdef' >>> print bits[2:9] 1234567 >>> print bits[2:10] 12345678 >>> I did mention that the fp64 parts weren't really tested, right? :) _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
