diff options
Diffstat (limited to 'src/namestore/test_plugin_namestore.c')
-rw-r--r-- | src/namestore/test_plugin_namestore.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index 6bccd1706..9d21ad16a 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2012 GNUnet e.V. | 3 | Copyright (C) 2012 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 it |
6 | it under the terms of the GNU General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation; either version 3, or (at your | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with GNUnet; see the file COPYING. If not, write to the | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 17 | */ |
20 | /* | 18 | /* |
21 | * @file namestore/test_plugin_namestore.c | 19 | * @file namestore/test_plugin_namestore.c |
@@ -26,7 +24,9 @@ | |||
26 | #include "gnunet_util_lib.h" | 24 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_namestore_plugin.h" | 25 | #include "gnunet_namestore_plugin.h" |
28 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
29 | 28 | ||
29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
30 | 30 | ||
31 | static int ok; | 31 | static int ok; |
32 | 32 | ||
@@ -110,7 +110,7 @@ test_record (void *cls, | |||
110 | { | 110 | { |
111 | GNUNET_assert (rd[i].data_size == id % 10); | 111 | GNUNET_assert (rd[i].data_size == id % 10); |
112 | GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10)); | 112 | GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10)); |
113 | GNUNET_assert (rd[i].record_type == 1 + (id % 13)); | 113 | GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE); |
114 | GNUNET_assert (rd[i].flags == 0); | 114 | GNUNET_assert (rd[i].flags == 0); |
115 | } | 115 | } |
116 | memset (&tzone_private_key, | 116 | memset (&tzone_private_key, |
@@ -154,7 +154,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, | |||
154 | rd[i].data = "Hello World"; | 154 | rd[i].data = "Hello World"; |
155 | rd[i].data_size = id % 10; | 155 | rd[i].data_size = id % 10; |
156 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; | 156 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; |
157 | rd[i].record_type = 1 + (id % 13); | 157 | rd[i].record_type = TEST_RECORD_TYPE; |
158 | rd[i].flags = 0; | 158 | rd[i].flags = 0; |
159 | } | 159 | } |
160 | memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); | 160 | memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); |
@@ -215,6 +215,8 @@ main (int argc, | |||
215 | sizeof (cfg_name), | 215 | sizeof (cfg_name), |
216 | "test_plugin_namestore_%s.conf", | 216 | "test_plugin_namestore_%s.conf", |
217 | plugin_name); | 217 | plugin_name); |
218 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
219 | "GNUNET_TMP"); | ||
218 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, | 220 | GNUNET_PROGRAM_run ((sizeof (xargv) / sizeof (char *)) - 1, |
219 | xargv, | 221 | xargv, |
220 | "test-plugin-namestore", | 222 | "test-plugin-namestore", |
@@ -222,6 +224,8 @@ main (int argc, | |||
222 | options, | 224 | options, |
223 | &run, | 225 | &run, |
224 | NULL); | 226 | NULL); |
227 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
228 | "GNUNET_TMP"); | ||
225 | if (ok != 0) | 229 | if (ok != 0) |
226 | FPRINTF (stderr, | 230 | FPRINTF (stderr, |
227 | "Missed some testcases: %d\n", | 231 | "Missed some testcases: %d\n", |