diff options
Diffstat (limited to 'src/peerstore')
-rw-r--r-- | src/peerstore/test_peerstore_api_data.conf | 3 | ||||
-rw-r--r-- | src/peerstore/test_peerstore_api_sync.c | 29 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/peerstore/test_peerstore_api_data.conf b/src/peerstore/test_peerstore_api_data.conf index 3ebda50eb..614d0cf5b 100644 --- a/src/peerstore/test_peerstore_api_data.conf +++ b/src/peerstore/test_peerstore_api_data.conf | |||
@@ -5,8 +5,9 @@ GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-peerstore | |||
5 | START_ON_DEMAND = YES | 5 | START_ON_DEMAND = YES |
6 | BINARY = gnunet-service-peerstore | 6 | BINARY = gnunet-service-peerstore |
7 | UNIXPATH = $GNUNET_TMP/gnunet-service-peerstore.sock | 7 | UNIXPATH = $GNUNET_TMP/gnunet-service-peerstore.sock |
8 | HOME = $SERVICEHOME | ||
9 | DATABASE = sqlite | 8 | DATABASE = sqlite |
9 | UNIX_MATCH_UID = NO | ||
10 | UNIX_MATCH_GID = YES | ||
10 | #PREFIX = xterm -e gdb --args | 11 | #PREFIX = xterm -e gdb --args |
11 | 12 | ||
12 | [peerstore-sqlite] | 13 | [peerstore-sqlite] |
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index b2ac860b7..503cb2f1e 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c | |||
@@ -109,7 +109,6 @@ iterate_cb (void *cls, | |||
109 | static void | 109 | static void |
110 | test_cont (void *cls) | 110 | test_cont (void *cls) |
111 | { | 111 | { |
112 | h = GNUNET_PEERSTORE_connect (cfg); | ||
113 | GNUNET_PEERSTORE_iterate (h, | 112 | GNUNET_PEERSTORE_iterate (h, |
114 | subsystem, | 113 | subsystem, |
115 | &pid, key, | 114 | &pid, key, |
@@ -117,6 +116,19 @@ test_cont (void *cls) | |||
117 | NULL); | 116 | NULL); |
118 | } | 117 | } |
119 | 118 | ||
119 | static void | ||
120 | store_cont (void *cls, int success) | ||
121 | { | ||
122 | ok = success; | ||
123 | /* We need to wait a little bit to give the disconnect | ||
124 | a chance to actually finish the operation; otherwise, | ||
125 | the test may fail non-deterministically if the new | ||
126 | connection is faster than the cleanup routine of the | ||
127 | old one. */ | ||
128 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
129 | &test_cont, | ||
130 | NULL); | ||
131 | } | ||
120 | 132 | ||
121 | /** | 133 | /** |
122 | * Actually run the test. | 134 | * Actually run the test. |
@@ -132,18 +144,7 @@ test1 () | |||
132 | val, strlen (val) + 1, | 144 | val, strlen (val) + 1, |
133 | GNUNET_TIME_UNIT_FOREVER_ABS, | 145 | GNUNET_TIME_UNIT_FOREVER_ABS, |
134 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 146 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
135 | NULL, NULL); | 147 | &store_cont, NULL); |
136 | GNUNET_PEERSTORE_disconnect (h, | ||
137 | GNUNET_YES); | ||
138 | h = NULL; | ||
139 | /* We need to wait a little bit to give the disconnect | ||
140 | a chance to actually finish the operation; otherwise, | ||
141 | the test may fail non-deterministically if the new | ||
142 | connection is faster than the cleanup routine of the | ||
143 | old one. */ | ||
144 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | ||
145 | &test_cont, | ||
146 | NULL); | ||
147 | } | 148 | } |
148 | 149 | ||
149 | 150 | ||
@@ -171,7 +172,7 @@ main (int argc, char *argv[]) | |||
171 | if (0 != | 172 | if (0 != |
172 | GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", | 173 | GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", |
173 | "peerstore", | 174 | "peerstore", |
174 | "test_peerstore_api_data.conf", | 175 | "peerstore.conf", |
175 | &run, NULL)) | 176 | &run, NULL)) |
176 | return 1; | 177 | return 1; |
177 | if (0 != ok) | 178 | if (0 != ok) |