projects
/
awesomized
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
55e0ec6
)
Add -a/-b to memcacpable to test either ascii or binary protocol
author
Trond Norbye
<trond.norbye@gmail.com>
Sat, 31 Jul 2010 21:44:02 +0000
(23:44 +0200)
committer
Trond Norbye
<trond.norbye@gmail.com>
Sat, 31 Jul 2010 21:44:02 +0000
(23:44 +0200)
clients/memcapable.c
patch
|
blob
|
history
diff --git
a/clients/memcapable.c
b/clients/memcapable.c
index 2527861739c00c3e7f618558944968c99433aa1f..7f5d51ee94e5144571eb320e7783f2b39f54cb45 100644
(file)
--- a/
clients/memcapable.c
+++ b/
clients/memcapable.c
@@
-1861,6
+1861,9
@@
struct testcase testcases[]= {
{ NULL, NULL}
};
{ NULL, NULL}
};
+const int ascii_tests = 1;
+const int binary_tests = 2;
+
int main(int argc, char **argv)
{
static const char * const status_msg[]= {"[skip]", "[pass]", "[pass]", "[FAIL]"};
int main(int argc, char **argv)
{
static const char * const status_msg[]= {"[skip]", "[pass]", "[pass]", "[FAIL]"};
@@
-1869,10
+1872,18
@@
int main(int argc, char **argv)
const char *hostname= "localhost";
const char *port= "11211";
int cmd;
const char *hostname= "localhost";
const char *port= "11211";
int cmd;
+ int tests = ascii_tests | binary_tests;
+
- while ((cmd= getopt(argc, argv, "t:vch:p:?")) != EOF)
+ while ((cmd= getopt(argc, argv, "t:vch:p:?
ab
")) != EOF)
{
switch (cmd) {
{
switch (cmd) {
+ case 'a':
+ tests = ascii_tests;
+ break;
+ case 'b':
+ tests = binary_tests;
+ break;
case 't':
timeout= atoi(optarg);
if (timeout == 0)
case 't':
timeout= atoi(optarg);
if (timeout == 0)
@@
-1890,10
+1901,12
@@
int main(int argc, char **argv)
case 'p': port= optarg;
break;
default:
case 'p': port= optarg;
break;
default:
- fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n]\n"
+ fprintf(stderr, "Usage: %s [-h hostname] [-p port] [-c] [-v] [-t n]
[-a] [-b]
\n"
"\t-c\tGenerate coredump if a test fails\n"
"\t-v\tVerbose test output (print out the assertion)\n"
"\t-c\tGenerate coredump if a test fails\n"
"\t-v\tVerbose test output (print out the assertion)\n"
- "\t-t n\tSet the timeout for io-operations to n seconds\n",
+ "\t-t n\tSet the timeout for io-operations to n seconds\n"
+ "\t-a\tOnly test the ascii protocol\n"
+ "\t-b\tOnly test the binary protocol\n",
argv[0]);
return 1;
}
argv[0]);
return 1;
}
@@
-1910,6
+1923,11
@@
int main(int argc, char **argv)
for (int ii= 0; testcases[ii].description != NULL; ++ii)
{
for (int ii= 0; testcases[ii].description != NULL; ++ii)
{
+ if ((testcases[ii].description[0] == 'a' && (tests & ascii_tests) == 0) ||
+ (testcases[ii].description[0] == 'b' && (tests & binary_tests) == 0))
+ {
+ continue;
+ }
++total;
fprintf(stdout, "%-40s", testcases[ii].description);
fflush(stdout);
++total;
fprintf(stdout, "%-40s", testcases[ii].description);
fflush(stdout);