summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-12-06 13:52:01 +0900
committerMartin Schanzenbach <schanzen@gnunet.org>2022-12-06 13:52:01 +0900
commit69e6c0b893b0b642f969ac8a134d043a51e393a3 (patch)
tree80c00ce5b69f9eb8728fb8dda39abac953412574
parent5abbc294229cca582d0b104b86be534de2be66ea (diff)
downloadgnunet-69e6c0b893b0b642f969ac8a134d043a51e393a3.tar.gz
gnunet-69e6c0b893b0b642f969ac8a134d043a51e393a3.zip
-fix more test issues
-rw-r--r--src/namestore/test_namestore_api_edit_records.c9
-rw-r--r--src/transport/Makefile.am1
-rw-r--r--src/util/test_bio.c110
3 files changed, 7 insertions, 113 deletions
diff --git a/src/namestore/test_namestore_api_edit_records.c b/src/namestore/test_namestore_api_edit_records.c
index ee05f498a..fb588f0e1 100644
--- a/src/namestore/test_namestore_api_edit_records.c
+++ b/src/namestore/test_namestore_api_edit_records.c
@@ -24,7 +24,6 @@
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_namestore_service.h" 25#include "gnunet_namestore_service.h"
26#include "gnunet_testing_lib.h" 26#include "gnunet_testing_lib.h"
27#include "gnunet_dnsparser_lib.h"
28 27
29#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT 28#define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT
30 29
@@ -187,7 +186,7 @@ commit_cont_a (void *cls,
187 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 186 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
188 "Name store added record for `%s': %s\n", 187 "Name store added record for `%s': %s\n",
189 name, 188 name,
190 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 189 (GNUNET_EC_NONE == ec) ? "SUCCESS" : "FAIL");
191 /** 190 /**
192 * Try again for B 191 * Try again for B
193 */ 192 */
@@ -263,7 +262,7 @@ begin_cont (void *cls,
263{ 262{
264 const char *name = cls; 263 const char *name = cls;
265 264
266 GNUNET_assert (success == GNUNET_YES); 265 GNUNET_assert (GNUNET_EC_NONE == ec);
267 nsqe = GNUNET_NAMESTORE_records_edit (nsh, 266 nsqe = GNUNET_NAMESTORE_records_edit (nsh,
268 &privkey, 267 &privkey,
269 name, 268 name,
@@ -288,7 +287,7 @@ preload_cont (void *cls,
288 GNUNET_break (0); 287 GNUNET_break (0);
289 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 288 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
290 "Namestore could not store record: `%s'\n", 289 "Namestore could not store record: `%s'\n",
291 GNUNET_ErroCode_get_hint (ec)); 290 GNUNET_ErrorCode_get_hint (ec));
292 if (endbadly_task != NULL) 291 if (endbadly_task != NULL)
293 GNUNET_SCHEDULER_cancel (endbadly_task); 292 GNUNET_SCHEDULER_cancel (endbadly_task);
294 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); 293 endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL);
@@ -298,7 +297,7 @@ preload_cont (void *cls,
298 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 297 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
299 "Name store added record for `%s': %s\n", 298 "Name store added record for `%s': %s\n",
300 name, 299 name,
301 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 300 (GNUNET_EC_NONE == ec) ? "SUCCESS" : "FAIL");
302 /* We start transaction for A */ 301 /* We start transaction for A */
303 nsqe = GNUNET_NAMESTORE_transaction_begin (nsh, begin_cont, (void *) name); 302 nsqe = GNUNET_NAMESTORE_transaction_begin (nsh, begin_cont, (void *) name);
304 303
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 363f8b199..9d372f184 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -1495,6 +1495,7 @@ test_transport_simple_send.sh \
1495test_transport_simple_send_broadcast.sh \ 1495test_transport_simple_send_broadcast.sh \
1496test_transport_udp_backchannel.sh \ 1496test_transport_udp_backchannel.sh \
1497test_transport_simple_send_dv_circle.sh \ 1497test_transport_simple_send_dv_circle.sh \
1498test_transport_simple_send_dv_inverse.sh \
1498gnunet-transport-certificate-creation.in \ 1499gnunet-transport-certificate-creation.in \
1499communicator-unix.conf \ 1500communicator-unix.conf \
1500test_plugin_hostkey \ 1501test_plugin_hostkey \
diff --git a/src/util/test_bio.c b/src/util/test_bio.c
index 0b76bbb43..90f0121d4 100644
--- a/src/util/test_bio.c
+++ b/src/util/test_bio.c
@@ -40,8 +40,6 @@ test_normal_rw (void)
40 void *buffer; 40 void *buffer;
41 size_t buffer_size = 0; 41 size_t buffer_size = 0;
42 char *filename = GNUNET_DISK_mktemp ("gnunet-bio"); 42 char *filename = GNUNET_DISK_mktemp ("gnunet-bio");
43 struct GNUNET_CONTAINER_MetaData *mdW;
44 struct GNUNET_CONTAINER_MetaData *mdR = NULL;
45 char *rString = NULL; 43 char *rString = NULL;
46 int64_t wNum = TESTNUMBER64; 44 int64_t wNum = TESTNUMBER64;
47 int64_t rNum = 0; 45 int64_t rNum = 0;
@@ -189,41 +187,6 @@ test_bigstring_rw (void)
189 187
190 188
191static int 189static int
192test_bigmeta_rw (void)
193{
194 static char meta[1024 * 1024 * 10];
195 struct GNUNET_BIO_WriteHandle *wh;
196 struct GNUNET_BIO_ReadHandle *rh;
197 char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
198 struct GNUNET_CONTAINER_MetaData *mdR = NULL;
199
200 memset (meta, 'b', sizeof (meta));
201 meta[sizeof (meta) - 1] = '\0';
202
203 wh = GNUNET_BIO_write_open_file (filename);
204 GNUNET_assert (NULL != wh);
205 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (wh,
206 "test-bigmeta-rw-int32",
207 sizeof (meta)));
208 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write (wh,
209 "test-bigmeta-rw-bytes",
210 meta,
211 sizeof (meta)));
212 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
213
214 rh = GNUNET_BIO_read_open_file (filename);
215 GNUNET_assert (NULL != rh);
216 GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
217
218 GNUNET_assert (NULL == mdR);
219
220 GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
221 GNUNET_free (filename);
222 return 0;
223}
224
225
226static int
227test_directory_r (void) 190test_directory_r (void)
228{ 191{
229#ifdef LINUX 192#ifdef LINUX
@@ -252,12 +215,12 @@ test_nullfile_rw (void)
252 memset (filename, 'a', sizeof (filename)); 215 memset (filename, 'a', sizeof (filename));
253 filename[sizeof (filename) - 1] = '\0'; 216 filename[sizeof (filename) - 1] = '\0';
254 217
255 GNUNET_log_skip (2, GNUNET_NO); 218 GNUNET_log_skip (1, GNUNET_NO);
256 wh = GNUNET_BIO_write_open_file (filename); 219 wh = GNUNET_BIO_write_open_file (filename);
257 GNUNET_log_skip (0, GNUNET_YES); 220 GNUNET_log_skip (0, GNUNET_YES);
258 GNUNET_assert (NULL == wh); 221 GNUNET_assert (NULL == wh);
259 222
260 GNUNET_log_skip (2, GNUNET_NO); 223 GNUNET_log_skip (1, GNUNET_NO);
261 rh = GNUNET_BIO_read_open_file (filename); 224 rh = GNUNET_BIO_read_open_file (filename);
262 GNUNET_log_skip (0, GNUNET_YES); 225 GNUNET_log_skip (0, GNUNET_YES);
263 GNUNET_assert (NULL == rh); 226 GNUNET_assert (NULL == rh);
@@ -275,8 +238,6 @@ test_fullfile_rw (void)
275 struct GNUNET_BIO_ReadHandle *rh; 238 struct GNUNET_BIO_ReadHandle *rh;
276 char *rString = NULL; 239 char *rString = NULL;
277 char rResult[200]; 240 char rResult[200];
278 struct GNUNET_CONTAINER_MetaData *mdW;
279 struct GNUNET_CONTAINER_MetaData *mdR = NULL;
280 241
281 struct GNUNET_BIO_WriteSpec ws[] = { 242 struct GNUNET_BIO_WriteSpec ws[] = {
282 GNUNET_BIO_write_spec_object ("test-fullfile-rw-bytes", 243 GNUNET_BIO_write_spec_object ("test-fullfile-rw-bytes",
@@ -308,7 +269,6 @@ test_fullfile_rw (void)
308 GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL)); 269 GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
309 270
310 GNUNET_assert (NULL == rString); 271 GNUNET_assert (NULL == rString);
311 GNUNET_assert (NULL == mdR);
312#endif 272#endif
313 return 0; 273 return 0;
314} 274}
@@ -346,61 +306,6 @@ test_fakestring_rw (void)
346 306
347 307
348static int 308static int
349test_fakemeta_rw (void)
350{
351 struct GNUNET_BIO_WriteHandle *wh;
352 struct GNUNET_BIO_ReadHandle *rh;
353 char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
354 struct GNUNET_CONTAINER_MetaData *mdR = NULL;
355
356 wh = GNUNET_BIO_write_open_file (filename);
357 GNUNET_assert (NULL != wh);
358 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (wh,
359 "test-fakestring-rw-int32",
360 2));
361 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
362
363 rh = GNUNET_BIO_read_open_file (filename);
364 GNUNET_assert (NULL != rh);
365 GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
366
367 GNUNET_assert (NULL == mdR);
368
369 GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
370 GNUNET_free (filename);
371 return 0;
372}
373
374
375static int
376test_fakebigmeta_rw (void)
377{
378 struct GNUNET_BIO_WriteHandle *wh;
379 struct GNUNET_BIO_ReadHandle *rh;
380 char *filename = GNUNET_DISK_mktemp ("gnunet_bio");
381 struct GNUNET_CONTAINER_MetaData *mdR = NULL;
382 int32_t wNum = 1024 * 1024 * 10;
383
384 wh = GNUNET_BIO_write_open_file (filename);
385 GNUNET_assert (NULL != wh);
386 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_int32 (wh,
387 "test-fakebigmeta-rw-int32",
388 wNum));
389 GNUNET_assert (GNUNET_OK == GNUNET_BIO_write_close (wh, NULL));
390
391 rh = GNUNET_BIO_read_open_file (filename);
392 GNUNET_assert (NULL != rh);
393 GNUNET_assert (GNUNET_SYSERR == GNUNET_BIO_read_close (rh, NULL));
394
395 GNUNET_assert (NULL == mdR);
396
397 GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
398 GNUNET_free (filename);
399 return 0;
400}
401
402
403static int
404check_string_rw (void) 309check_string_rw (void)
405{ 310{
406 GNUNET_assert (0 == test_nullstring_rw ()); 311 GNUNET_assert (0 == test_nullstring_rw ());
@@ -412,16 +317,6 @@ check_string_rw (void)
412 317
413 318
414static int 319static int
415check_metadata_rw (void)
416{
417 GNUNET_assert (0 == test_fakebigmeta_rw ());
418 GNUNET_assert (0 == test_fakemeta_rw ());
419 GNUNET_assert (0 == test_bigmeta_rw ());
420 return 0;
421}
422
423
424static int
425check_file_rw (void) 320check_file_rw (void)
426{ 321{
427 GNUNET_assert (0 == test_normal_rw ()); 322 GNUNET_assert (0 == test_normal_rw ());
@@ -437,7 +332,6 @@ main (int argc, char *argv[])
437{ 332{
438 GNUNET_log_setup ("test-bio", "WARNING", NULL); 333 GNUNET_log_setup ("test-bio", "WARNING", NULL);
439 GNUNET_assert (0 == check_file_rw ()); 334 GNUNET_assert (0 == check_file_rw ());
440 GNUNET_assert (0 == check_metadata_rw ());
441 GNUNET_assert (0 == check_string_rw ()); 335 GNUNET_assert (0 == check_string_rw ());
442 return 0; 336 return 0;
443} 337}