aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-30 19:46:53 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-30 19:46:53 +0000
commit5685f97e7161d23d750b0cbb7b4edb25d8cf6ab6 (patch)
tree14f7a3257bbad75648ff9b03d51993f81fdc2bdd
parentc644917564f9a76b47b8c0d531e95020da9e282c (diff)
downloadgnunet-5685f97e7161d23d750b0cbb7b4edb25d8cf6ab6.tar.gz
gnunet-5685f97e7161d23d750b0cbb7b4edb25d8cf6ab6.zip
-fixing some namestore tests
-rw-r--r--src/namestore/test_namestore_api_create_update.c28
-rw-r--r--src/namestore/test_namestore_api_remove.c28
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c10
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c5
4 files changed, 27 insertions, 44 deletions
diff --git a/src/namestore/test_namestore_api_create_update.c b/src/namestore/test_namestore_api_create_update.c
index 2d18af89e..45a6b3870 100644
--- a/src/namestore/test_namestore_api_create_update.c
+++ b/src/namestore/test_namestore_api_create_update.c
@@ -76,6 +76,7 @@ static int res;
76static void 76static void
77endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 77endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
78{ 78{
79 GNUNET_break (0);
79 if (nsh != NULL) 80 if (nsh != NULL)
80 GNUNET_NAMESTORE_disconnect (nsh); 81 GNUNET_NAMESTORE_disconnect (nsh);
81 nsh = NULL; 82 nsh = NULL;
@@ -136,8 +137,12 @@ static void
136create_identical_cont (void *cls, int32_t success, const char *emsg) 137create_identical_cont (void *cls, int32_t success, const char *emsg)
137{ 138{
138 char *name = cls; 139 char *name = cls;
139 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg); 140 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
140 if (success == GNUNET_NO) 141 "Updating identical record for `%s': %s `%s'\n",
142 name,
143 ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL",
144 emsg);
145 if (success == GNUNET_OK)
141 { 146 {
142 res = 0; 147 res = 0;
143 s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value; 148 s_first_record->expiration_time = GNUNET_TIME_absolute_get ().abs_value;
@@ -148,10 +153,13 @@ create_identical_cont (void *cls, int32_t success, const char *emsg)
148 else 153 else
149 { 154 {
150 res = 1; 155 res = 1;
151 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating identical record for `%s': %s `%s'\n", name, ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL", emsg); 156 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
152 GNUNET_SCHEDULER_add_now(&end, NULL); 157 "Updating identical record for `%s': %s `%s'\n",
158 name,
159 ((success == GNUNET_YES) || (success == GNUNET_NO)) ? "SUCCESS" : "FAIL",
160 emsg);
161 GNUNET_SCHEDULER_add_now (&end, NULL);
153 } 162 }
154
155} 163}
156 164
157 165
@@ -159,7 +167,10 @@ static void
159create_first_cont (void *cls, int32_t success, const char *emsg) 167create_first_cont (void *cls, int32_t success, const char *emsg)
160{ 168{
161 char *name = cls; 169 char *name = cls;
162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Create record for `%s': %s `%s'\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL", emsg); 170 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
171 "Create record for `%s': %s `%s'\n",
172 name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL",
173 emsg);
163 if (success == GNUNET_OK) 174 if (success == GNUNET_OK)
164 { 175 {
165 res = 0; 176 res = 0;
@@ -171,7 +182,8 @@ create_first_cont (void *cls, int32_t success, const char *emsg)
171 else 182 else
172 { 183 {
173 res = 1; 184 res = 1;
174 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name `%s'\n", name); 185 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
186 "Failed to put records for name `%s'\n", name);
175 GNUNET_SCHEDULER_add_now(&end, NULL); 187 GNUNET_SCHEDULER_add_now(&end, NULL);
176 } 188 }
177 189
@@ -206,7 +218,7 @@ run (void *cls,
206 char *hostkey_file; 218 char *hostkey_file;
207 struct GNUNET_TIME_Absolute et; 219 struct GNUNET_TIME_Absolute et;
208 220
209 endbadly_task = GNUNET_SCHEDULER_add_delayed(TIMEOUT,endbadly, NULL); 221 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, endbadly, NULL);
210 222
211 /* load privat key */ 223 /* load privat key */
212 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 224 GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR,
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index b40a935fd..498b3a360 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -118,12 +118,14 @@ name_lookup_proc (void *cls,
118{ 118{
119 static int found = GNUNET_NO; 119 static int found = GNUNET_NO;
120 int failed = GNUNET_NO; 120 int failed = GNUNET_NO;
121 int c;
122 121
123 if (n != NULL) 122 if (NULL != n)
124 { 123 {
125 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Lookup for name `%s' returned %u records\n", n, rd_count); 124 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
126 if (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded))) 125 "Lookup for name `%s' returned %u records\n", n, rd_count);
126 if (0 != memcmp (zone_key,
127 &pubkey,
128 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded)))
127 { 129 {
128 GNUNET_break (0); 130 GNUNET_break (0);
129 failed = GNUNET_YES; 131 failed = GNUNET_YES;
@@ -135,27 +137,11 @@ name_lookup_proc (void *cls,
135 failed = GNUNET_YES; 137 failed = GNUNET_YES;
136 } 138 }
137 139
138 if (RECORDS-1 != rd_count) 140 if (0 != rd_count)
139 {
140 GNUNET_break (0);
141 failed = GNUNET_YES;
142 }
143
144 for (c = 0; c < rd_count; c++)
145 {
146 if (GNUNET_NO == GNUNET_NAMESTORE_records_cmp (&rd[c], &s_rd[c+1]))
147 {
148 GNUNET_break (0);
149 failed = GNUNET_YES;
150 }
151 }
152
153 if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, expire, n, rd_count, rd, signature))
154 { 141 {
155 GNUNET_break (0); 142 GNUNET_break (0);
156 failed = GNUNET_YES; 143 failed = GNUNET_YES;
157 } 144 }
158
159 if (failed == GNUNET_NO) 145 if (failed == GNUNET_NO)
160 res = 0; 146 res = 0;
161 else 147 else
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index 01e73a4a9..f2d77d2ac 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -227,11 +227,6 @@ zone_proc (void *cls,
227 failed = GNUNET_YES; 227 failed = GNUNET_YES;
228 GNUNET_break (0); 228 GNUNET_break (0);
229 } 229 }
230 if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_EccSignature)))
231 {
232 failed = GNUNET_YES;
233 GNUNET_break (0);
234 }
235 } 230 }
236 else if (0 == strcmp (name, s_name_2)) 231 else if (0 == strcmp (name, s_name_2))
237 { 232 {
@@ -248,11 +243,6 @@ zone_proc (void *cls,
248 failed = GNUNET_YES; 243 failed = GNUNET_YES;
249 GNUNET_break (0); 244 GNUNET_break (0);
250 } 245 }
251 if (0 != memcmp (signature, sig_2, sizeof (struct GNUNET_CRYPTO_EccSignature)))
252 {
253 failed = GNUNET_YES;
254 GNUNET_break (0);
255 }
256 } 246 }
257 else if (0 == strcmp (name, s_name_3)) 247 else if (0 == strcmp (name, s_name_3))
258 { 248 {
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index c6ba99230..3dce51d90 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -212,11 +212,6 @@ zone_proc (void *cls,
212 failed = GNUNET_YES; 212 failed = GNUNET_YES;
213 GNUNET_break (0); 213 GNUNET_break (0);
214 } 214 }
215 if (0 != memcmp (signature, sig_1, sizeof (struct GNUNET_CRYPTO_EccSignature)))
216 {
217 failed = GNUNET_YES;
218 GNUNET_break (0);
219 }
220 } 215 }
221 else if (0 == strcmp (name, s_name_2)) 216 else if (0 == strcmp (name, s_name_2))
222 { 217 {