#include <errno.h>
#include <strings.h>
#include <string.h>
+#include <sys/types.h>
+#include <stdlib.h>
+#include <limits.h>
+
#include <libmemcached/memcached.h>
/* Check for various possible errors */
- if ((errno == ERANGE && (val == INTMAX_MAX || val == INTMAX_MIN))
+ if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
|| (errno != 0 && val == 0))
{
*error= true;
TESTS_LDADDS = libmemcached/libmemcached.la
-VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes
+VALGRIND_COMMAND= $(LIBTOOL) --mode=execute valgrind --leak-check=yes --show-reachable=yes --track-fds=yes
DEBUG_COMMAND= $(LIBTOOL) --mode=execute gdb
// See if memcached is reachable.
value= memcached_get(tl_memc_h, key, strlen(key), &len, &flags, &rc);
- if (value)
- {
- free(value);
- test_true(value); // Pointer won't be zero so this is fine.
- }
-
+ test_false(value);
test_true(len == 0);
test_true(rc == MEMCACHED_ERRNO);
+ memcached_free(tl_memc_h);
+
return TEST_SUCCESS;
}
// See if memcached is reachable.
value= memcached_get(memc, key, strlen(key), &len, &flags, &rc);
- if (value)
- {
- free(value);
- test_true(value); // Pointer won't be zero so this is fine.
- }
-
+ test_false(value);
test_true(len == 0);
test_true(rc == MEMCACHED_NOTFOUND);
// See if memcached is reachable.
value= memcached_get_by_key(tl_memc_h, key, strlen(key), key, strlen(key), &len, &flags, &rc);
- if (value)
- {
- free(value);
- test_true(value); // Pointer won't be zero so this is fine.
- }
-
+ test_false(value);
test_true(len == 0);
test_true(rc == MEMCACHED_ERRNO);
+ memcached_free(tl_memc_h);
+
return TEST_SUCCESS;
}
// See if memcached is reachable.
value= memcached_get_by_key(memc, key, strlen(key), key, strlen(key), &len, &flags, &rc);
- if (value)
- {
- free(value);
- test_true(value); // Pointer won't be zero so this is fine.
- }
-
+ test_false(value);
test_true(len == 0);
test_true(rc == MEMCACHED_NOTFOUND);