X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Ftest-reconnect.c;h=8441fadd3bcacffd62ea71d07733818409e17c5c;hb=ff8decf1a318b4a611cb08bb3f12833044e8a872;hp=a8784fc884dcbbafec50f9e3dd047e7f75a27e24;hpb=3ed497fc10033c9857140270d60ef6aa2d7c0c08;p=openvswitch diff --git a/tests/test-reconnect.c b/tests/test-reconnect.c index a8784fc8..8441fadd 100644 --- a/tests/test-reconnect.c +++ b/tests/test-reconnect.c @@ -40,6 +40,7 @@ int main(void) { struct reconnect_stats prev; + unsigned int old_max_tries; int old_time; char line[128]; @@ -49,6 +50,7 @@ main(void) reconnect_get_stats(reconnect, now, &prev); printf("### t=%d ###\n", now); old_time = now; + old_max_tries = reconnect_get_max_tries(reconnect); while (fgets(line, sizeof line, stdin)) { struct reconnect_stats cur; struct svec args; @@ -74,6 +76,10 @@ main(void) reconnect_get_stats(reconnect, now, &cur); diff_stats(&prev, &cur); prev = cur; + if (reconnect_get_max_tries(reconnect) != old_max_tries) { + old_max_tries = reconnect_get_max_tries(reconnect); + printf(" %u tries left\n", old_max_tries); + } } return 0; @@ -190,6 +196,12 @@ do_timeout(int argc UNUSED, char *argv[] UNUSED) } } +static void +do_set_max_tries(int argc UNUSED, char *argv[]) +{ + reconnect_set_max_tries(reconnect, atoi(argv[1])); +} + static void diff_stats(const struct reconnect_stats *old, const struct reconnect_stats *new) @@ -235,6 +247,7 @@ static const struct command commands[] = { { "run", 0, 1, do_run }, { "advance", 1, 1, do_advance }, { "timeout", 0, 0, do_timeout }, + { "set-max-tries", 1, 1, do_set_max_tries }, { NULL, 0, 0, NULL }, };