projects
/
m6w6
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (parent:
2133fbb
)
Add option -P and -T to memcapable
author
Trond Norbye
<trond.norbye@gmail.com>
Fri, 13 Aug 2010 12:58:56 +0000
(14:58 +0200)
committer
Trond Norbye
<trond.norbye@gmail.com>
Fri, 13 Aug 2010 12:58:56 +0000
(14:58 +0200)
The two options come in handy if you're trying to debug a failing test case
clients/memcapable.c
patch
|
blob
|
history
diff --git
a/clients/memcapable.c
b/clients/memcapable.c
index 2527861739c00c3e7f618558944968c99433aa1f..8fa783ebbbacab9e8c43fdb7819e0b0fe1381788 100644
(file)
--- a/
clients/memcapable.c
+++ b/
clients/memcapable.c
@@
-1869,8
+1869,10
@@
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;
+ bool prompt= false;
+ const char *testname= NULL;
- while ((cmd= getopt(argc, argv, "t:vch:p:?")) != EOF)
+ while ((cmd= getopt(argc, argv, "t:vch:p:
PT:
?")) != EOF)
{
switch (cmd) {
case 't':
{
switch (cmd) {
case 't':
@@
-1889,11
+1891,21
@@
int main(int argc, char **argv)
break;
case 'p': port= optarg;
break;
break;
case 'p': port= optarg;
break;
+ case 'P': prompt= true;
+ break;
+ case 'T': testname= optarg;
+ break;
default:
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]"
+ " [-P] [-T testname]'\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-P\tPrompt the user before starting a test.\n"
+ "\t\t\t\"skip\" will skip the test\n"
+ "\t\t\t\"quit\" will terminate memcapable\n"
+ "\t\t\tEverything else will start the test\n"
+ "\t-T n\tJust run the test named n\n",
argv[0]);
return 1;
}
argv[0]);
return 1;
}
@@
-1910,10
+1922,32
@@
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 (testname != NULL && strcmp(testcases[ii].description, testname) != 0)
+ continue;
+
++total;
fprintf(stdout, "%-40s", testcases[ii].description);
fflush(stdout);
++total;
fprintf(stdout, "%-40s", testcases[ii].description);
fflush(stdout);
+ if (prompt)
+ {
+ fprintf(stdout, "\nPress <return> when you are ready? ");
+ char buffer[80] = {0};
+ (void)fgets(buffer, sizeof(buffer), stdin);
+ if (strncmp(buffer, "skip", 4) == 0)
+ {
+ fprintf(stdout, "%-40s%s\n", testcases[ii].description,
+ status_msg[TEST_SKIP]);
+ fflush(stdout);
+ continue;
+ }
+ if (strncmp(buffer, "quit", 4) == 0)
+ exit(0);
+
+ fprintf(stdout, "%-40s", testcases[ii].description);
+ fflush(stdout);
+ }
+
bool reconnect= false;
enum test_return ret= testcases[ii].function();
if (ret == TEST_FAIL)
bool reconnect= false;
enum test_return ret= testcases[ii].function();
if (ret == TEST_FAIL)