diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:21:40 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-06-28 12:21:40 +0000 |
commit | 134afc9acfb4b12c84cdf8b56b2eabb856fde3e7 (patch) | |
tree | f62956e6c9ac0b39f37afc101270ce8660004831 /src/testing/test_testing_group.c | |
parent | 59ca0059f61b1e2538f2890625601a88b2119f66 (diff) | |
download | gnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.tar.gz gnunet-134afc9acfb4b12c84cdf8b56b2eabb856fde3e7.zip |
callback for peergroup shutdown in testing, requisite testcase changes
Diffstat (limited to 'src/testing/test_testing_group.c')
-rw-r--r-- | src/testing/test_testing_group.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/testing/test_testing_group.c b/src/testing/test_testing_group.c index 81d949e2a..c0ceaa799 100644 --- a/src/testing/test_testing_group.c +++ b/src/testing/test_testing_group.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | 26 | ||
27 | #define VERBOSE GNUNET_YES | 27 | #define VERBOSE GNUNET_NO |
28 | 28 | ||
29 | #define NUM_PEERS 4 | 29 | #define NUM_PEERS 4 |
30 | 30 | ||
@@ -43,6 +43,30 @@ static struct GNUNET_TESTING_PeerGroup *pg; | |||
43 | 43 | ||
44 | static struct GNUNET_SCHEDULER_Handle *sched; | 44 | static struct GNUNET_SCHEDULER_Handle *sched; |
45 | 45 | ||
46 | /** | ||
47 | * Check whether peers successfully shut down. | ||
48 | */ | ||
49 | void shutdown_callback (void *cls, | ||
50 | const char *emsg) | ||
51 | { | ||
52 | if (emsg != NULL) | ||
53 | { | ||
54 | #if VERBOSE | ||
55 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
56 | "Shutdown of peers failed!\n"); | ||
57 | #endif | ||
58 | if (ok == 0) | ||
59 | ok = 666; | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | #if VERBOSE | ||
64 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
65 | "All peers successfully shut down!\n"); | ||
66 | #endif | ||
67 | } | ||
68 | } | ||
69 | |||
46 | 70 | ||
47 | static void | 71 | static void |
48 | my_cb (void *cls, | 72 | my_cb (void *cls, |
@@ -59,7 +83,7 @@ my_cb (void *cls, | |||
59 | { | 83 | { |
60 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 84 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); |
61 | ok = 1; | 85 | ok = 1; |
62 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 86 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
63 | } | 87 | } |
64 | return; | 88 | return; |
65 | } | 89 | } |
@@ -68,14 +92,14 @@ my_cb (void *cls, | |||
68 | if (peers_left == 0) | 92 | if (peers_left == 0) |
69 | { | 93 | { |
70 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers started successfully, ending test!\n"); | 94 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers started successfully, ending test!\n"); |
71 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 95 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
72 | ok = 0; | 96 | ok = 0; |
73 | } | 97 | } |
74 | else if (failed_peers == peers_left) | 98 | else if (failed_peers == peers_left) |
75 | { | 99 | { |
76 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); |
77 | ok = 1; | 101 | ok = 1; |
78 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT); | 102 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
79 | } | 103 | } |
80 | } | 104 | } |
81 | 105 | ||