Commit b11d47c5 authored by Mark Andrews's avatar Mark Andrews
Browse files

sent tests serially

parent daa63138
...@@ -47,6 +47,7 @@ static int ipv6only = 0; ...@@ -47,6 +47,7 @@ static int ipv6only = 0;
static int debug = 0; static int debug = 0;
static int what = 0; static int what = 0;
static int inorder = 0; static int inorder = 0;
static int serial = 0;
static union res_sockaddr_union servers[10]; static union res_sockaddr_union servers[10];
static int nservers = 0; static int nservers = 0;
...@@ -196,6 +197,7 @@ struct summary { ...@@ -196,6 +197,7 @@ struct summary {
char ns[1024]; /* the server's name */ char ns[1024]; /* the server's name */
struct sockaddr_storage storage;/* server we are talking to */ struct sockaddr_storage storage;/* server we are talking to */
int tests; /* number of outstanding tests */ int tests; /* number of outstanding tests */
int last; /* last test sent */
int deferred; /* was the printing deferred */ int deferred; /* was the printing deferred */
int done; /* we are done */ int done; /* we are done */
int type; /* recursive query lookup type */ int type; /* recursive query lookup type */
...@@ -251,6 +253,9 @@ static struct { ...@@ -251,6 +253,9 @@ static struct {
struct workitem *tail; struct workitem *tail;
} work, connecting, reading, ids[0x10000]; } work, connecting, reading, ids[0x10000];
static void
dotest(struct workitem *item);
static void static void
nextserver(struct workitem *item); nextserver(struct workitem *item);
...@@ -415,6 +420,28 @@ printandfree(struct summary *summary) { ...@@ -415,6 +420,28 @@ printandfree(struct summary *summary) {
static void static void
report(struct summary *summary) { report(struct summary *summary) {
/*
* Send the next test now that we have completed the last test.
*/
if (serial && summary->type == 0 && summary->tests == 1) {
unsigned int i = summary->last + 1;
for (; i < sizeof(opts)/sizeof(opts[0]); i++) {
struct workitem *item;
if (opts[i].what != 0 && (opts[i].what & what) == 0) {
summary->last = i;
continue;
}
item = calloc(1, sizeof(*item));
if (item == NULL)
continue;
item->summary = summary;
item->summary->last = item->test = i;
dotest(item);
return;
}
}
/* /*
* Have all the tests completed? * Have all the tests completed?
*/ */
...@@ -787,8 +814,10 @@ check(char *zone, char *ns, char *address, struct summary *parent) { ...@@ -787,8 +814,10 @@ check(char *zone, char *ns, char *address, struct summary *parent) {
break; break;
item->summary = summary; item->summary = summary;
item->summary->tests++; item->summary->tests++;
item->test = i; item->summary->last = item->test = i;
dotest(item); dotest(item);
if (serial)
break;
} }
report(summary); /* Release reference. */ report(summary); /* Release reference. */
} }
...@@ -1546,7 +1575,7 @@ connecttoserver(struct workitem *item) { ...@@ -1546,7 +1575,7 @@ connecttoserver(struct workitem *item) {
if (fd > maxfd) if (fd > maxfd)
maxfd = fd; maxfd = fd;
gettimeofday(&item->when, NULL); gettimeofday(&item->when, NULL);
item->when.tv_sec += 60; item->when.tv_sec += 10;
APPEND(connecting, item, clink); APPEND(connecting, item, clink);
return; return;
} }
...@@ -1763,7 +1792,7 @@ main(int argc, char **argv) { ...@@ -1763,7 +1792,7 @@ main(int argc, char **argv) {
int done = 0; int done = 0;
char *end; char *end;
while ((n = getopt(argc, argv, "46cdfom:s:")) != -1) { while ((n = getopt(argc, argv, "46cdfom:r:s")) != -1) {
switch (n) { switch (n) {
case '4': ipv4only = 1; ipv6only = 0; break; case '4': ipv4only = 1; ipv6only = 0; break;
case '6': ipv6only = 1; ipv4only = 0; break; case '6': ipv6only = 1; ipv4only = 0; break;
...@@ -1775,10 +1804,11 @@ main(int argc, char **argv) { ...@@ -1775,10 +1804,11 @@ main(int argc, char **argv) {
maxoutstanding = n; maxoutstanding = n;
break; break;
case 'o': inorder = 1; break; case 'o': inorder = 1; break;
case 's': addserver(optarg); break; case 'r': addserver(optarg); break;
case 's': serial = 1; break;
default: default:
printf("usage: genreport [-4|-6|-c|-d|-f|-o] [-m maxoutstanding] " printf("usage: genreport [-4|-6|-c|-d|-f|-o|-s] [-m maxoutstanding] "
"[-s server]\n"); "[-r server]\n");
printf("\t-4: IPv4 servers only\n"); printf("\t-4: IPv4 servers only\n");
printf("\t-6: IPv6 servers only\n"); printf("\t-6: IPv6 servers only\n");
printf("\t-c: add common queries\n"); printf("\t-c: add common queries\n");
...@@ -1786,7 +1816,8 @@ main(int argc, char **argv) { ...@@ -1786,7 +1816,8 @@ main(int argc, char **argv) {
printf("\t-f: add full mode tests\n"); printf("\t-f: add full mode tests\n");
printf("\t-m: set maxoutstanding\n"); printf("\t-m: set maxoutstanding\n");
printf("\t-o: inorder output\n"); printf("\t-o: inorder output\n");
printf("\t-s: use specified recursive server\n"); printf("\t-s: serialize tests\n");
printf("\t-r: use specified recursive server\n");
exit(0); exit(0);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment