diff options
Diffstat (limited to 'src/namestore/test_namestore_api_remove_not_existing_record.c')
-rw-r--r-- | src/namestore/test_namestore_api_remove_not_existing_record.c | 55 |
1 files changed, 20 insertions, 35 deletions
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index 2f20c3636..a5bd6c8c2 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -2,20 +2,18 @@ | |||
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2013 GNUnet e.V. | 3 | Copyright (C) 2013 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_namestore_api_remove_not_existing_record.c | 19 | * @file namestore/test_namestore_api_remove_not_existing_record.c |
@@ -46,7 +44,6 @@ static int res; | |||
46 | 44 | ||
47 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; | 45 | static struct GNUNET_NAMESTORE_QueueEntry *nsqe; |
48 | 46 | ||
49 | static char *directory; | ||
50 | 47 | ||
51 | static void | 48 | static void |
52 | cleanup () | 49 | cleanup () |
@@ -92,7 +89,9 @@ end (void *cls) | |||
92 | 89 | ||
93 | 90 | ||
94 | static void | 91 | static void |
95 | put_cont (void *cls, int32_t success, const char *emsg) | 92 | put_cont (void *cls, |
93 | int32_t success, | ||
94 | const char *emsg) | ||
96 | { | 95 | { |
97 | GNUNET_assert (NULL != cls); | 96 | GNUNET_assert (NULL != cls); |
98 | nsqe = NULL; | 97 | nsqe = NULL; |
@@ -101,8 +100,8 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
101 | GNUNET_SCHEDULER_cancel (endbadly_task); | 100 | GNUNET_SCHEDULER_cancel (endbadly_task); |
102 | endbadly_task = NULL; | 101 | endbadly_task = NULL; |
103 | } | 102 | } |
104 | 103 | switch (success) | |
105 | switch (success) { | 104 | { |
106 | case GNUNET_NO: | 105 | case GNUNET_NO: |
107 | /* We expected GNUNET_NO, since record was not found */ | 106 | /* We expected GNUNET_NO, since record was not found */ |
108 | GNUNET_SCHEDULER_add_now (&end, NULL); | 107 | GNUNET_SCHEDULER_add_now (&end, NULL); |
@@ -129,25 +128,12 @@ run (void *cls, | |||
129 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 128 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
130 | struct GNUNET_TESTING_Peer *peer) | 129 | struct GNUNET_TESTING_Peer *peer) |
131 | { | 130 | { |
132 | char *hostkey_file; | ||
133 | const char * name = "dummy.dummy.gnunet"; | 131 | const char * name = "dummy.dummy.gnunet"; |
134 | 132 | ||
135 | directory = NULL; | ||
136 | GNUNET_assert (GNUNET_OK == | ||
137 | GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", "GNUNET_TEST_HOME", &directory)); | ||
138 | GNUNET_DISK_directory_remove (directory); | ||
139 | |||
140 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 133 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
141 | &endbadly, NULL); | 134 | &endbadly, |
142 | GNUNET_asprintf (&hostkey_file, | 135 | NULL); |
143 | "zonefiles%s%s", | 136 | privkey = GNUNET_CRYPTO_ecdsa_key_create (); |
144 | DIR_SEPARATOR_STR, | ||
145 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
146 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
147 | "Using zonekey file `%s' \n", | ||
148 | hostkey_file); | ||
149 | privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); | ||
150 | GNUNET_free (hostkey_file); | ||
151 | GNUNET_assert (privkey != NULL); | 137 | GNUNET_assert (privkey != NULL); |
152 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); | 138 | GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); |
153 | 139 | ||
@@ -174,6 +160,8 @@ main (int argc, char *argv[]) | |||
174 | GNUNET_asprintf (&cfg_name, | 160 | GNUNET_asprintf (&cfg_name, |
175 | "test_namestore_api_%s.conf", | 161 | "test_namestore_api_%s.conf", |
176 | plugin_name); | 162 | plugin_name); |
163 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
164 | "GNUNET_TEST_HOME"); | ||
177 | res = 1; | 165 | res = 1; |
178 | if (0 != | 166 | if (0 != |
179 | GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record", | 167 | GNUNET_TESTING_peer_run ("test-namestore-api-remove-non-existing-record", |
@@ -183,12 +171,9 @@ main (int argc, char *argv[]) | |||
183 | { | 171 | { |
184 | res = 1; | 172 | res = 1; |
185 | } | 173 | } |
174 | GNUNET_DISK_purge_cfg_dir (cfg_name, | ||
175 | "GNUNET_TEST_HOME"); | ||
186 | GNUNET_free (cfg_name); | 176 | GNUNET_free (cfg_name); |
187 | if (NULL != directory) | ||
188 | { | ||
189 | GNUNET_DISK_directory_remove (directory); | ||
190 | GNUNET_free (directory); | ||
191 | } | ||
192 | return res; | 177 | return res; |
193 | } | 178 | } |
194 | 179 | ||