projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
unset XDG environment variable during testcases, as they can screw things up badly
[oweals/gnunet.git]
/
src
/
peerstore
/
test_peerstore_api_store.c
diff --git
a/src/peerstore/test_peerstore_api_store.c
b/src/peerstore/test_peerstore_api_store.c
index 794a2b04867e9da412d9e8e37d59306d1e767fa6..bfe1b5b55dfb362616e0ef8e3f83c94465f9ccde 100644
(file)
--- a/
src/peerstore/test_peerstore_api_store.c
+++ b/
src/peerstore/test_peerstore_api_store.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet.
/*
This file is part of GNUnet.
- (C)
+ Copyright (C) GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-14,17
+14,17
@@
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 5
9 Temple Place - Suite 330
,
- Boston, MA 0211
1-1307
, USA.
+ Free Software Foundation, Inc., 5
1 Franklin Street, Fifth Floor
,
+ Boston, MA 0211
0-1301
, USA.
*/
/**
* @file peerstore/test_peerstore_api_store.c
* @brief testcase for peerstore store operation
*/
#include "platform.h"
*/
/**
* @file peerstore/test_peerstore_api_store.c
* @brief testcase for peerstore store operation
*/
#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testing_lib.h"
#include "gnunet_peerstore_service.h"
#include "gnunet_peerstore_service.h"
+#include "gnunet_testing_lib.h"
+
static int ok = 1;
static int ok = 1;
@@
-39,25
+39,24
@@
static char *val3 = "test_peerstore_api_store_val3--";
static int count = 0;
static int count = 0;
-static
int
+static
void
test3_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
test3_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
- return
GNUNET_NO
;
+ return;
if (NULL != record)
{
GNUNET_assert ((strlen (val3) + 1) == record->value_size);
GNUNET_assert (0 == strcmp ((char *) val3, (char *) record->value));
count++;
if (NULL != record)
{
GNUNET_assert ((strlen (val3) + 1) == record->value_size);
GNUNET_assert (0 == strcmp ((char *) val3, (char *) record->value));
count++;
- return
GNUNET_YES
;
+ return;
}
GNUNET_assert (count == 1);
ok = 0;
GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
GNUNET_SCHEDULER_shutdown ();
}
GNUNET_assert (count == 1);
ok = 0;
GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
GNUNET_SCHEDULER_shutdown ();
- return GNUNET_YES;
}
}
@@
-67,7
+66,11
@@
test3_cont (void *cls, int success)
if (GNUNET_YES != success)
return;
count = 0;
if (GNUNET_YES != success)
return;
count = 0;
- GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS,
+ GNUNET_PEERSTORE_iterate (h,
+ subsystem,
+ &pid,
+ key,
+ GNUNET_TIME_UNIT_SECONDS,
&test3_cont2, NULL);
}
&test3_cont2, NULL);
}
@@
-85,13
+88,13
@@
test3 ()
}
}
-static
int
+static
void
test2_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
test2_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
- return
GNUNET_NO
;
+ return;
if (NULL != record)
{
GNUNET_assert (((strlen (val1) + 1) == record->value_size) ||
if (NULL != record)
{
GNUNET_assert (((strlen (val1) + 1) == record->value_size) ||
@@
-99,12
+102,11
@@
test2_cont2 (void *cls,
GNUNET_assert ((0 == strcmp ((char *) val1, (char *) record->value)) ||
(0 == strcmp ((char *) val2, (char *) record->value)));
count++;
GNUNET_assert ((0 == strcmp ((char *) val1, (char *) record->value)) ||
(0 == strcmp ((char *) val2, (char *) record->value)));
count++;
- return
GNUNET_YES
;
+ return;
}
GNUNET_assert (count == 2);
count = 0;
test3 ();
}
GNUNET_assert (count == 2);
count = 0;
test3 ();
- return GNUNET_YES;
}
}
@@
-114,7
+116,10
@@
test2_cont (void *cls, int success)
if (GNUNET_YES != success)
return;
count = 0;
if (GNUNET_YES != success)
return;
count = 0;
- GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS,
+ GNUNET_PEERSTORE_iterate (h,
+ subsystem,
+ &pid, key,
+ GNUNET_TIME_UNIT_SECONDS,
&test2_cont2, NULL);
}
&test2_cont2, NULL);
}
@@
-132,24
+137,23
@@
test2 ()
}
}
-static
int
+static
void
test1_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
test1_cont2 (void *cls,
const struct GNUNET_PEERSTORE_Record *record,
const char *emsg)
{
if (NULL != emsg)
- return
GNUNET_NO
;
+ return;
if (NULL != record)
{
GNUNET_assert ((strlen (val1) + 1) == record->value_size);
GNUNET_assert (0 == strcmp ((char *) val1, (char *) record->value));
count++;
if (NULL != record)
{
GNUNET_assert ((strlen (val1) + 1) == record->value_size);
GNUNET_assert (0 == strcmp ((char *) val1, (char *) record->value));
count++;
- return
GNUNET_YES
;
+ return;
}
GNUNET_assert (count == 1);
count = 0;
test2 ();
}
GNUNET_assert (count == 1);
count = 0;
test2 ();
- return GNUNET_YES;
}
}
@@
-178,8
+182,7
@@
test1 ()
static void
static void
-run (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg,
+run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TESTING_Peer *peer)
{
h = GNUNET_PEERSTORE_connect (cfg);
struct GNUNET_TESTING_Peer *peer)
{
h = GNUNET_PEERSTORE_connect (cfg);