[Piglit] [PATCH] builtin tests: use 64 instead of 74 for integer arithmetic tests

Brian Paul brianp at vmware.com
Fri Jun 29 16:27:37 PDT 2012


If the driver implements integers with floats, some expressions
such as x=74/74 will not be 1.  That's because a reciprocal is
used: x=(1.0/74.0)*74.0 which evaluates to 0.9999999 and gets
truncated to zero.  Comparing that to 1 fails and the test fails.

Just use 64 instead since 1/64 can be exactly represented with a
float.  So 64/64=1.

This fixes quite a few tests with the svga driver, for example.
---
 generated_tests/builtin_function.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/generated_tests/builtin_function.py b/generated_tests/builtin_function.py
index d433865..43161cd 100644
--- a/generated_tests/builtin_function.py
+++ b/generated_tests/builtin_function.py
@@ -985,7 +985,7 @@ def _make_vector_or_matrix_test_vectors(test_suite_dict):
     bvecs = [np.array(bs) for bs in itertools.product(bools, bools)] + \
 	[np.array(bs) for bs in itertools.product(bools, bools, bools)] + \
 	[np.array(bs) for bs in itertools.product(bools, bools, bools, bools)]
-    ints = [np.int32(x) for x in [12, -6, 74, -32, 0]]
+    ints = [np.int32(x) for x in [12, -6, 64, -32, 0]]
     small_ints = [np.int32(x) for x in [-31, -25, -5, -2, -1, 0, 1, 2, 5, 25, 31]]
     ivecs = [
 	np.array([38, 35], dtype=np.int32),
-- 
1.7.3.4



More information about the Piglit mailing list