[Piglit] [PATCH] Use right comparison function for double

arsenm2 at gmail.com arsenm2 at gmail.com
Wed Aug 24 04:33:19 UTC 2016


From: Matt Arsenault <arsenm2 at gmail.com>

---
 tests/cl/program/program-tester.c | 12 ++++++------
 tests/util/piglit-util-cl.c       |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index 25b677f..1a87610 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -2115,14 +2115,14 @@ check_test_arg_value(struct test_arg test_arg,
 			}                                                                \
 		}                                                                    \
 		return true;
-#define CASEF(enum_type, type, cl_type)                                      \
+#define CASEF(enum_type, type, cl_type, testfn)				\
 	case enum_type:                                                          \
 		for(i = 0; i < test_arg.length; i++) {                               \
 			for(c = 0; c < test_arg.cl_size; c++) {                          \
 				rb = i*test_arg.cl_mem_size + c;                             \
-				if(!piglit_cl_probe_floating(((cl_type*)value)[rb],          \
-				                             ((cl_type*)test_arg.value)[rb], \
-				                             test_arg.ulp)) {               \
+				if(!testfn(((cl_type*)value)[rb],          \
+		                           ((cl_type*)test_arg.value)[rb], \
+		                           test_arg.ulp)) {                \
 					ra = i*test_arg.cl_size + c;                             \
 					printf("Error at %s[%zu]\n", type, ra);                  \
 					return false;                                            \
@@ -2141,8 +2141,8 @@ check_test_arg_value(struct test_arg test_arg,
 		CASEI(TYPE_LONG,   "long",   cl_long)
 		CASEU(TYPE_ULONG,  "ulong",  cl_ulong)
 		CASEH(TYPE_HALF,   "half",   cl_half)
-		CASEF(TYPE_FLOAT,  "float",  cl_float)
-		CASEF(TYPE_DOUBLE,  "double",  cl_double)
+		CASEF(TYPE_FLOAT,  "float",  cl_float, piglit_cl_probe_floating)
+		CASEF(TYPE_DOUBLE,  "double",  cl_double, piglit_cl_probe_double)
 	}
 
 #undef CASEF
diff --git a/tests/util/piglit-util-cl.c b/tests/util/piglit-util-cl.c
index fb32fee..dba3263 100644
--- a/tests/util/piglit-util-cl.c
+++ b/tests/util/piglit-util-cl.c
@@ -130,7 +130,7 @@ piglit_cl_probe_double(double value, double expect, uint64_t ulp)
 	diff = fabsl(value - expect);
 
 	if(diff > ulp || isnan(value)) {
-		printf("Expecting %f (0x%lx) with tolerance %f (%lu ulps), but got %f (0x%lx)\n",
+		printf("Expecting %f (0x%" PRIx64") with tolerance %f (%lu ulps), but got %f (0x%" PRIx64")\n",
 		       e.f, e.u, t.f, t.u, v.f, v.u);
 		return false;
 	}
-- 
2.9.2



More information about the Piglit mailing list