/* -*- Mode: C; tab-width: 2; c-basic-offset: 2; indent-tabs-mode: nil -*- */
#undef NDEBUG
-#include "config.h"
-#include <pthread.h>
-#include <sys/types.h>
+#include <config.h>
+
+#ifdef HAVE_POLL_H
+#include <poll.h>
+#else
+#include "poll/poll.h"
+#endif
+
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctype.h>
#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <assert.h>
-#include <string.h>
#include <inttypes.h>
-#include <stdbool.h>
+#include <pthread.h>
+#include <signal.h>
+#include <sys/types.h>
#include <unistd.h>
-#include <ctype.h>
#include <libmemcached/memcached.h>
#include <libmemcached/memcached/protocol_binary.h>
#include <libmemcached/byteorder.h>
-#include "utilities.h"
+#include <clients/utilities.h>
#ifdef linux
/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to
command cmd;
response rsp;
- uint64_t value= 0xdeadbeefdeadcafe;
+ uint64_t value= 0xdeadbeefdeadcafeULL;
storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
/* set should always work */
{
command cmd;
response rsp;
- uint64_t value= 0xdeadbeefdeadcafe;
+ uint64_t value= 0xdeadbeefdeadcafeULL;
storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
/* first add should work, rest of them should fail (even with cas
{
command cmd;
response rsp;
- uint64_t value= 0xdeadbeefdeadcafe;
+ uint64_t value= 0xdeadbeefdeadcafeULL;
storage_command(&cmd, cc, key, strlen(key), &value, sizeof (value), 0, 0);
/* first replace should fail, successive should succeed (when the
verify(strncmp(buffer, "VALUE ", 6) == 0);
char *end= strchr(buffer + 6, ' ');
verify(end != NULL);
- *end= '\0';
+ if (end)
+ {
+ *end= '\0';
+ }
*key= strdup(buffer + 6);
verify(*key != NULL);
char *ptr= end + 1;
*ndata = (ssize_t)strtoul(end, &end, 10); /* size */
verify(ptr != end);
verify(end != NULL);
- while (*end != '\n' && isspace(*end))
+ while (end and *end != '\n' and isspace(*end))
++end;
- verify(*end == '\n');
+ verify(end and *end == '\n');
*value= static_cast<char*>(malloc((size_t)*ndata));
verify(*value != NULL);
verify(ptr != end);
verify(val == datasize);
verify(end != NULL);
- while (*end != '\n' && isspace(*end))
+ while (end and *end != '\n' and isspace(*end))
+ {
++end;
- verify(*end == '\n');
+ }
+ verify(end and *end == '\n');
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
verify(val == datasize);
verify(end != NULL);
- while (*end != '\n' && isspace(*end))
+ while (end and *end != '\n' and isspace(*end))
+ {
++end;
- verify(*end == '\n');
+ }
+ verify(end and *end == '\n');
execute(retry_read(buffer, datasize));
verify(memcmp(buffer, value, datasize) == 0);
- while ((cmd= getopt(argc, argv, "t:vch:p:PT:?ab")) != EOF)
+ while ((cmd= getopt(argc, argv, "qt:vch:p:PT:?ab")) != EOF)
{
switch (cmd) {
case 'a':
tests.ascii= true;
tests.binary= false;
break;
+
case 'b':
tests.ascii= false;
tests.binary= true;
break;
+
case 't':
timeout= atoi(optarg);
if (timeout == 0)
return EXIT_FAILURE;
}
break;
+
case 'v': verbose= true;
break;
+
case 'c': do_core= true;
break;
+
case 'h': hostname= optarg;
break;
+
case 'p': port= optarg;
break;
+
+ case 'q':
+ close_stdio();
+ break;
+
case 'P': prompt= true;
break;
+
case 'T': testname= optarg;
break;
+
default:
fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n] [-P] [-T testname]'\n"
"\t-c\tGenerate coredump if a test fails\n"