diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-05-27 10:54:00 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-05-27 10:54:00 +0000 |
commit | 512de1fc705634737fbe776d8cd33249b61a897a (patch) | |
tree | 6f4e20dcfc33be89dbe2c36201ac001c6d53ec70 /src/fs/test_gnunet_service_fs_migration.c | |
parent | 315a5cc108293e1ac8f8aaa8fda5c9a7bbd71531 (diff) | |
download | gnunet-512de1fc705634737fbe776d8cd33249b61a897a.tar.gz gnunet-512de1fc705634737fbe776d8cd33249b61a897a.zip |
fixing mig test
Diffstat (limited to 'src/fs/test_gnunet_service_fs_migration.c')
-rw-r--r-- | src/fs/test_gnunet_service_fs_migration.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/fs/test_gnunet_service_fs_migration.c b/src/fs/test_gnunet_service_fs_migration.c index 78cd3813a..94e959f14 100644 --- a/src/fs/test_gnunet_service_fs_migration.c +++ b/src/fs/test_gnunet_service_fs_migration.c | |||
@@ -25,8 +25,9 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "fs_test_lib.h" | 27 | #include "fs_test_lib.h" |
28 | #include "gnunet_testing_lib.h" | ||
28 | 29 | ||
29 | #define VERBOSE GNUNET_NO | 30 | #define VERBOSE GNUNET_YES |
30 | 31 | ||
31 | /** | 32 | /** |
32 | * File-size we use for testing. | 33 | * File-size we use for testing. |
@@ -61,7 +62,7 @@ do_stop (void *cls, | |||
61 | char *fancy; | 62 | char *fancy; |
62 | 63 | ||
63 | GNUNET_FS_TEST_daemons_stop (sched, | 64 | GNUNET_FS_TEST_daemons_stop (sched, |
64 | 1, | 65 | 2, |
65 | daemons); | 66 | daemons); |
66 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) | 67 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE)) |
67 | { | 68 | { |
@@ -88,11 +89,21 @@ do_stop (void *cls, | |||
88 | 89 | ||
89 | static void | 90 | static void |
90 | do_download (void *cls, | 91 | do_download (void *cls, |
91 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 92 | const char *emsg) |
92 | { | 93 | { |
93 | struct GNUNET_FS_Uri *uri = cls; | 94 | struct GNUNET_FS_Uri *uri = cls; |
94 | 95 | ||
95 | GNUNET_FS_TEST_daemons_stop (sched, 1, &daemons[1]); | 96 | if (emsg != NULL) |
97 | { | ||
98 | GNUNET_FS_TEST_daemons_stop (sched, | ||
99 | 2, | ||
100 | daemons); | ||
101 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
102 | "Failed to stop source daemon: %s\n", | ||
103 | emsg); | ||
104 | ok = 1; | ||
105 | return; | ||
106 | } | ||
96 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 107 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
97 | "Downloading %llu bytes\n", | 108 | "Downloading %llu bytes\n", |
98 | (unsigned long long) FILESIZE); | 109 | (unsigned long long) FILESIZE); |
@@ -107,6 +118,22 @@ do_download (void *cls, | |||
107 | 118 | ||
108 | 119 | ||
109 | static void | 120 | static void |
121 | stop_source_peer (void *cls, | ||
122 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
123 | { | ||
124 | struct GNUNET_FS_Uri *uri = cls; | ||
125 | struct GNUNET_TESTING_PeerGroup *pg; | ||
126 | |||
127 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
128 | "Stopping source peer\n"); | ||
129 | pg = GNUNET_FS_TEST_get_group (daemons); | ||
130 | GNUNET_TESTING_daemons_vary (pg, 1, GNUNET_NO, TIMEOUT, | ||
131 | &do_download, | ||
132 | uri); | ||
133 | } | ||
134 | |||
135 | |||
136 | static void | ||
110 | do_wait (void *cls, | 137 | do_wait (void *cls, |
111 | const struct GNUNET_FS_Uri *uri) | 138 | const struct GNUNET_FS_Uri *uri) |
112 | { | 139 | { |
@@ -122,10 +149,12 @@ do_wait (void *cls, | |||
122 | ok = 1; | 149 | ok = 1; |
123 | return; | 150 | return; |
124 | } | 151 | } |
152 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
153 | "Waiting to allow content to migrate\n"); | ||
125 | d = GNUNET_FS_uri_dup (uri); | 154 | d = GNUNET_FS_uri_dup (uri); |
126 | GNUNET_SCHEDULER_add_delayed (sched, | 155 | GNUNET_SCHEDULER_add_delayed (sched, |
127 | MIGRATION_DELAY, | 156 | MIGRATION_DELAY, |
128 | &do_download, | 157 | &stop_source_peer, |
129 | d); | 158 | d); |
130 | } | 159 | } |
131 | 160 | ||