projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Refactor of response code. All of it has been streamlined to allow for multi
[m6w6/libmemcached]
/
tests
/
test.c
diff --git
a/tests/test.c
b/tests/test.c
index 2ea99ff2c05d2faf01e5892ca2adeeb7c61f8836..60db54cbd8969269d3dad0b6468a4f6be50dc9f6 100644
(file)
--- a/
tests/test.c
+++ b/
tests/test.c
@@
-10,11
+10,12
@@
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
+#include <fnmatch.h>
#include "test.h"
#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10
#include "test.h"
#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10
-#define TEST_SERVERS
1
+#define TEST_SERVERS
5
long int timedif(struct timeval a, struct timeval b)
{
long int timedif(struct timeval a, struct timeval b)
{
@@
-54,14
+55,17
@@
void server_shutdown(char *server_string)
{
unsigned int x;
{
unsigned int x;
- for (x= 0; x < TEST_SERVERS; x++)
- {
- char buffer[1024]; /* Nothing special for number */
- sprintf(buffer, "cat /tmp/%umemc.pid | xargs kill", x);
- system(buffer);
- }
if (server_string)
if (server_string)
+ {
+ for (x= 0; x < TEST_SERVERS; x++)
+ {
+ char buffer[1024]; /* Nothing special for number */
+ sprintf(buffer, "cat /tmp/%umemc.pid | xargs kill", x);
+ system(buffer);
+ }
+
free(server_string);
free(server_string);
+ }
}
int main(int argc, char *argv[])
}
int main(int argc, char *argv[])
@@
-103,7
+107,6
@@
int main(int argc, char *argv[])
for (x= 0; x < memcached_server_list_count(servers); x++)
{
printf("\t%s : %u\n", servers[x].hostname, servers[x].port);
for (x= 0; x < memcached_server_list_count(servers); x++)
{
printf("\t%s : %u\n", servers[x].hostname, servers[x].port);
- assert(servers[x].stack_responses == 0);
assert(servers[x].fd == -1);
assert(servers[x].cursor_active == 0);
}
assert(servers[x].fd == -1);
assert(servers[x].cursor_active == 0);
}
@@
-116,35
+119,37
@@
int main(int argc, char *argv[])
test_st *run;
run= next->tests;
test_st *run;
run= next->tests;
- if (collection_to_run &&
strcmp(collection_to_run, next->name
))
+ if (collection_to_run &&
fnmatch(collection_to_run, next->name, 0
))
continue;
fprintf(stderr, "\n%s\n\n", next->name);
for (x= 0; run->name; run++)
{
continue;
fprintf(stderr, "\n%s\n\n", next->name);
for (x= 0; run->name; run++)
{
- if (wildcard && strcmp(wildcard, run->name))
- continue;
-
- fprintf(stderr, "Testing %s", run->name);
-
+ unsigned int loop;
memcached_st *memc;
memcached_return rc;
struct timeval start_time, end_time;
memcached_st *memc;
memcached_return rc;
struct timeval start_time, end_time;
+ if (wildcard && fnmatch(wildcard, run->name, 0))
+ continue;
+
+ fprintf(stderr, "Testing %s", run->name);
+
memc= memcached_create(NULL);
assert(memc);
memc= memcached_create(NULL);
assert(memc);
- if (run->requires_flush)
- memcached_flush(memc, 0);
-
rc= memcached_server_push(memc, servers);
assert(rc == MEMCACHED_SUCCESS);
rc= memcached_server_push(memc, servers);
assert(rc == MEMCACHED_SUCCESS);
- unsigned int loop;
+ if (run->requires_flush)
+ {
+ memcached_flush(memc, 0);
+ memcached_quit(memc);
+ }
+
for (loop= 0; loop < memcached_server_list_count(servers); loop++)
{
for (loop= 0; loop < memcached_server_list_count(servers); loop++)
{
- assert(memc->hosts[loop].stack_responses == 0);
assert(memc->hosts[loop].fd == -1);
assert(memc->hosts[loop].cursor_active == 0);
}
assert(memc->hosts[loop].fd == -1);
assert(memc->hosts[loop].cursor_active == 0);
}