[Piglit] [PATCH] cl: fix 64bit-integer reading
Homer Hsing
homer.xing at intel.com
Wed Aug 14 19:12:43 PDT 2013
"int-definitions.cl" uses a 64bit-integer 18446744073709551615.
in "tests/cl/program/execute/compiler_long_mult.cl",
[test]
name: Long Definitions
kernel_name: test_long
arg_out: 0 buffer long[3] 9223372036854775807 \
-9223372036854775808 \
HERE-> 18446744073709551615
That integer was read by "strtoll()".
in "tests/cl/program/program-tester.c",
int64_t
get_int(const char* src)
{
if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
HERE-> return strtoll(src, NULL, 0);
But,
strtoll("18446744073709551615", NULL, 0) == 9223372036854775807
This patch fixes the bug.
Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
tests/cl/program/program-tester.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/cl/program/program-tester.c b/tests/cl/program/program-tester.c
index d898691..a153f50 100644
--- a/tests/cl/program/program-tester.c
+++ b/tests/cl/program/program-tester.c
@@ -582,7 +582,9 @@ get_bool(const char* src)
int64_t
get_int(const char* src)
{
- if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
+ if(regex_match(src, REGEX_FULL_MATCH(REGEX_UINT))) {
+ return strtoull(src, NULL, 0);
+ } else if(regex_match(src, REGEX_FULL_MATCH(REGEX_INT))) {
return strtoll(src, NULL, 0);
} else {
fprintf(stderr,
--
1.8.1.2
More information about the Piglit
mailing list