aboutsummaryrefslogtreecommitdiff
path: root/src/peerstore/test_peerstore_api_store.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-18 20:38:04 +0000
committerChristian Grothoff <christian@grothoff.org>2016-06-18 20:38:04 +0000
commit9687e96fd44fd4ccfc99836f41117c9b808481d2 (patch)
treecef03ac9bec0046e02bf2fb548b292da2a73e034 /src/peerstore/test_peerstore_api_store.c
parent4c59a7e576e8ac8a287bba8f180c1ea87678230a (diff)
downloadgnunet-9687e96fd44fd4ccfc99836f41117c9b808481d2.tar.gz
gnunet-9687e96fd44fd4ccfc99836f41117c9b808481d2.zip
-fixing part of Martin's FTBFS
Diffstat (limited to 'src/peerstore/test_peerstore_api_store.c')
-rw-r--r--src/peerstore/test_peerstore_api_store.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/src/peerstore/test_peerstore_api_store.c b/src/peerstore/test_peerstore_api_store.c
index bf042415d..bfe1b5b55 100644
--- a/src/peerstore/test_peerstore_api_store.c
+++ b/src/peerstore/test_peerstore_api_store.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 3 Copyright (C) GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -22,9 +22,9 @@
22 * @brief testcase for peerstore store operation 22 * @brief testcase for peerstore store operation
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_testing_lib.h"
27#include "gnunet_peerstore_service.h" 25#include "gnunet_peerstore_service.h"
26#include "gnunet_testing_lib.h"
27
28 28
29static int ok = 1; 29static int ok = 1;
30 30
@@ -39,24 +39,24 @@ static char *val3 = "test_peerstore_api_store_val3--";
39 39
40static int count = 0; 40static int count = 0;
41 41
42static int 42static void
43test3_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, 43test3_cont2 (void *cls,
44 const struct GNUNET_PEERSTORE_Record *record,
44 const char *emsg) 45 const char *emsg)
45{ 46{
46 if (NULL != emsg) 47 if (NULL != emsg)
47 return GNUNET_NO; 48 return;
48 if (NULL != record) 49 if (NULL != record)
49 { 50 {
50 GNUNET_assert ((strlen (val3) + 1) == record->value_size); 51 GNUNET_assert ((strlen (val3) + 1) == record->value_size);
51 GNUNET_assert (0 == strcmp ((char *) val3, (char *) record->value)); 52 GNUNET_assert (0 == strcmp ((char *) val3, (char *) record->value));
52 count++; 53 count++;
53 return GNUNET_YES; 54 return;
54 } 55 }
55 GNUNET_assert (count == 1); 56 GNUNET_assert (count == 1);
56 ok = 0; 57 ok = 0;
57 GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); 58 GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
58 GNUNET_SCHEDULER_shutdown (); 59 GNUNET_SCHEDULER_shutdown ();
59 return GNUNET_YES;
60} 60}
61 61
62 62
@@ -66,7 +66,11 @@ test3_cont (void *cls, int success)
66 if (GNUNET_YES != success) 66 if (GNUNET_YES != success)
67 return; 67 return;
68 count = 0; 68 count = 0;
69 GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS, 69 GNUNET_PEERSTORE_iterate (h,
70 subsystem,
71 &pid,
72 key,
73 GNUNET_TIME_UNIT_SECONDS,
70 &test3_cont2, NULL); 74 &test3_cont2, NULL);
71} 75}
72 76
@@ -84,12 +88,13 @@ test3 ()
84} 88}
85 89
86 90
87static int 91static void
88test2_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, 92test2_cont2 (void *cls,
93 const struct GNUNET_PEERSTORE_Record *record,
89 const char *emsg) 94 const char *emsg)
90{ 95{
91 if (NULL != emsg) 96 if (NULL != emsg)
92 return GNUNET_NO; 97 return;
93 if (NULL != record) 98 if (NULL != record)
94 { 99 {
95 GNUNET_assert (((strlen (val1) + 1) == record->value_size) || 100 GNUNET_assert (((strlen (val1) + 1) == record->value_size) ||
@@ -97,12 +102,11 @@ test2_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record,
97 GNUNET_assert ((0 == strcmp ((char *) val1, (char *) record->value)) || 102 GNUNET_assert ((0 == strcmp ((char *) val1, (char *) record->value)) ||
98 (0 == strcmp ((char *) val2, (char *) record->value))); 103 (0 == strcmp ((char *) val2, (char *) record->value)));
99 count++; 104 count++;
100 return GNUNET_YES; 105 return;
101 } 106 }
102 GNUNET_assert (count == 2); 107 GNUNET_assert (count == 2);
103 count = 0; 108 count = 0;
104 test3 (); 109 test3 ();
105 return GNUNET_YES;
106} 110}
107 111
108 112
@@ -112,7 +116,10 @@ test2_cont (void *cls, int success)
112 if (GNUNET_YES != success) 116 if (GNUNET_YES != success)
113 return; 117 return;
114 count = 0; 118 count = 0;
115 GNUNET_PEERSTORE_iterate (h, subsystem, &pid, key, GNUNET_TIME_UNIT_SECONDS, 119 GNUNET_PEERSTORE_iterate (h,
120 subsystem,
121 &pid, key,
122 GNUNET_TIME_UNIT_SECONDS,
116 &test2_cont2, NULL); 123 &test2_cont2, NULL);
117} 124}
118 125
@@ -130,23 +137,23 @@ test2 ()
130} 137}
131 138
132 139
133static int 140static void
134test1_cont2 (void *cls, const struct GNUNET_PEERSTORE_Record *record, 141test1_cont2 (void *cls,
142 const struct GNUNET_PEERSTORE_Record *record,
135 const char *emsg) 143 const char *emsg)
136{ 144{
137 if (NULL != emsg) 145 if (NULL != emsg)
138 return GNUNET_NO; 146 return;
139 if (NULL != record) 147 if (NULL != record)
140 { 148 {
141 GNUNET_assert ((strlen (val1) + 1) == record->value_size); 149 GNUNET_assert ((strlen (val1) + 1) == record->value_size);
142 GNUNET_assert (0 == strcmp ((char *) val1, (char *) record->value)); 150 GNUNET_assert (0 == strcmp ((char *) val1, (char *) record->value));
143 count++; 151 count++;
144 return GNUNET_YES; 152 return;
145 } 153 }
146 GNUNET_assert (count == 1); 154 GNUNET_assert (count == 1);
147 count = 0; 155 count = 0;
148 test2 (); 156 test2 ();
149 return GNUNET_YES;
150} 157}
151 158
152 159