diff options
author | Nathan S. Evans <evans@in.tum.de> | 2010-11-16 13:02:52 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2010-11-16 13:02:52 +0000 |
commit | b0685d4301b6ddf5d95e5467add39a23b51aa5a1 (patch) | |
tree | a9808ba0b435e871f1b85ac4e7006895979e9d8b /src/testing/test_testing_group.c | |
parent | 7f082ef1cd69b48984b05ae72f3c124493fdd86e (diff) | |
download | gnunet-b0685d4301b6ddf5d95e5467add39a23b51aa5a1.tar.gz gnunet-b0685d4301b6ddf5d95e5467add39a23b51aa5a1.zip |
Fix for testing where peer_start callback immediately calls peer_stop (also white space changes)
Diffstat (limited to 'src/testing/test_testing_group.c')
-rw-r--r-- | src/testing/test_testing_group.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/testing/test_testing_group.c b/src/testing/test_testing_group.c index b1e6be395..e3a3b2e63 100644 --- a/src/testing/test_testing_group.c +++ b/src/testing/test_testing_group.c | |||
@@ -44,14 +44,13 @@ static struct GNUNET_TESTING_PeerGroup *pg; | |||
44 | /** | 44 | /** |
45 | * Check whether peers successfully shut down. | 45 | * Check whether peers successfully shut down. |
46 | */ | 46 | */ |
47 | void shutdown_callback (void *cls, | 47 | void |
48 | const char *emsg) | 48 | shutdown_callback (void *cls, const char *emsg) |
49 | { | 49 | { |
50 | if (emsg != NULL) | 50 | if (emsg != NULL) |
51 | { | 51 | { |
52 | #if VERBOSE | 52 | #if VERBOSE |
53 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 53 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Shutdown of peers failed!\n"); |
54 | "Shutdown of peers failed!\n"); | ||
55 | #endif | 54 | #endif |
56 | if (ok == 0) | 55 | if (ok == 0) |
57 | ok = 666; | 56 | ok = 666; |
@@ -74,28 +73,32 @@ my_cb (void *cls, | |||
74 | { | 73 | { |
75 | if (id == NULL) | 74 | if (id == NULL) |
76 | { | 75 | { |
77 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start callback called with error (too long starting peers), aborting test!\n"); | 76 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
77 | "Start callback called with error (too long starting peers), aborting test!\n"); | ||
78 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n"); | 78 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Error from testing: `%s'\n"); |
79 | failed_peers++; | 79 | failed_peers++; |
80 | if (failed_peers == peers_left) | 80 | if (failed_peers == peers_left) |
81 | { | 81 | { |
82 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 82 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
83 | ok = 1; | 83 | "Too many peers failed, ending test!\n"); |
84 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 84 | ok = 1; |
85 | } | 85 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
86 | } | ||
86 | return; | 87 | return; |
87 | } | 88 | } |
88 | 89 | ||
89 | peers_left--; | 90 | peers_left--; |
90 | if (peers_left == 0) | 91 | if (peers_left == 0) |
91 | { | 92 | { |
92 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All peers started successfully, ending test!\n"); | 93 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
94 | "All peers started successfully, ending test!\n"); | ||
93 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 95 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
94 | ok = 0; | 96 | ok = 0; |
95 | } | 97 | } |
96 | else if (failed_peers == peers_left) | 98 | else if (failed_peers == peers_left) |
97 | { | 99 | { |
98 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Too many peers failed, ending test!\n"); | 100 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
101 | "Too many peers failed, ending test!\n"); | ||
99 | ok = 1; | 102 | ok = 1; |
100 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); | 103 | GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL); |
101 | } | 104 | } |