diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-07-09 22:34:49 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-07-09 22:34:49 +0000 |
commit | c0b81510ffe194dc662c3a6267d5e66a69873c4b (patch) | |
tree | 5ad5cc473d6993523be80bcf1430230e224d9216 /src/transport/test_transport_testing_restart.c | |
parent | a7345f7436c421fd15e18e87ec399ea93b6dde03 (diff) | |
download | gnunet-c0b81510ffe194dc662c3a6267d5e66a69873c4b.tar.gz gnunet-c0b81510ffe194dc662c3a6267d5e66a69873c4b.zip |
-start to refactor testcases for sanity
Diffstat (limited to 'src/transport/test_transport_testing_restart.c')
-rw-r--r-- | src/transport/test_transport_testing_restart.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/transport/test_transport_testing_restart.c b/src/transport/test_transport_testing_restart.c index dbbefa774..2f36e080a 100644 --- a/src/transport/test_transport_testing_restart.c +++ b/src/transport/test_transport_testing_restart.c | |||
@@ -34,9 +34,9 @@ | |||
34 | 34 | ||
35 | struct GNUNET_SCHEDULER_Task * timeout_task; | 35 | struct GNUNET_SCHEDULER_Task * timeout_task; |
36 | 36 | ||
37 | static struct PeerContext *p; | 37 | static struct GNUNET_TRANSPORT_TESTING_PeerContext *p; |
38 | 38 | ||
39 | struct GNUNET_TRANSPORT_TESTING_handle *tth; | 39 | struct GNUNET_TRANSPORT_TESTING_Handle *tth; |
40 | 40 | ||
41 | static int ret = 0; | 41 | static int ret = 0; |
42 | 42 | ||
@@ -48,7 +48,7 @@ end () | |||
48 | if (timeout_task != NULL) | 48 | if (timeout_task != NULL) |
49 | GNUNET_SCHEDULER_cancel (timeout_task); | 49 | GNUNET_SCHEDULER_cancel (timeout_task); |
50 | 50 | ||
51 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); | 51 | GNUNET_TRANSPORT_TESTING_stop_peer (p); |
52 | GNUNET_TRANSPORT_TESTING_done (tth); | 52 | GNUNET_TRANSPORT_TESTING_done (tth); |
53 | } | 53 | } |
54 | 54 | ||
@@ -59,7 +59,7 @@ end_badly () | |||
59 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); | 59 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Fail! Stopping peers\n"); |
60 | 60 | ||
61 | if (NULL != p) | 61 | if (NULL != p) |
62 | GNUNET_TRANSPORT_TESTING_stop_peer (tth, p); | 62 | GNUNET_TRANSPORT_TESTING_stop_peer (p); |
63 | 63 | ||
64 | if (NULL != tth) | 64 | if (NULL != tth) |
65 | GNUNET_TRANSPORT_TESTING_done (tth); | 65 | GNUNET_TRANSPORT_TESTING_done (tth); |
@@ -68,12 +68,13 @@ end_badly () | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static void | 70 | static void |
71 | restart_cb (struct PeerContext *p, void *cls) | 71 | restart_cb (struct GNUNET_TRANSPORT_TESTING_PeerContext *p, |
72 | void *cls) | ||
72 | { | 73 | { |
73 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') successfully restarted\n", | 74 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
75 | "Peer %u (`%s') successfully restarted\n", | ||
74 | p->no, | 76 | p->no, |
75 | GNUNET_i2s (&p->id)); | 77 | GNUNET_i2s (&p->id)); |
76 | |||
77 | ret = 0; | 78 | ret = 0; |
78 | GNUNET_SCHEDULER_add_now (&end, NULL); | 79 | GNUNET_SCHEDULER_add_now (&end, NULL); |
79 | } | 80 | } |
@@ -87,14 +88,13 @@ restart_task () | |||
87 | p->no, | 88 | p->no, |
88 | GNUNET_i2s (&p->id)); | 89 | GNUNET_i2s (&p->id)); |
89 | GNUNET_TRANSPORT_TESTING_restart_peer (p, | 90 | GNUNET_TRANSPORT_TESTING_restart_peer (p, |
90 | NULL, | ||
91 | &restart_cb, | 91 | &restart_cb, |
92 | p); | 92 | p); |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | static void | 96 | static void |
97 | start_cb (struct PeerContext *p, void *cls) | 97 | start_cb (struct GNUNET_TRANSPORT_TESTING_PeerContext *p, void *cls) |
98 | { | 98 | { |
99 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') successfully started\n", | 99 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer %u (`%s') successfully started\n", |
100 | p->no, | 100 | p->no, |
@@ -113,9 +113,12 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
113 | GNUNET_assert (NULL != tth); | 113 | GNUNET_assert (NULL != tth); |
114 | 114 | ||
115 | timeout_task = | 115 | timeout_task = |
116 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &end_badly, NULL); | 116 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, |
117 | 117 | &end_badly, | |
118 | p = GNUNET_TRANSPORT_TESTING_start_peer(tth, cfgfile, 1, | 118 | NULL); |
119 | p = GNUNET_TRANSPORT_TESTING_start_peer(tth, | ||
120 | cfgfile, | ||
121 | 1, | ||
119 | NULL, /* receive cb */ | 122 | NULL, /* receive cb */ |
120 | NULL, /* connect cb */ | 123 | NULL, /* connect cb */ |
121 | NULL, /* disconnect cb */ | 124 | NULL, /* disconnect cb */ |