diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-06-05 00:37:06 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-06-05 00:37:06 +0200 |
commit | 1f083a4593b1f07dcf24549853963dedde7f4d02 (patch) | |
tree | e57137969a8a0cfd5af064cd063177936c6b894a /src/namestore | |
parent | 324f6168c2374d7bb71c3632fb6521860d8fdfa1 (diff) | |
download | gnunet-1f083a4593b1f07dcf24549853963dedde7f4d02.tar.gz gnunet-1f083a4593b1f07dcf24549853963dedde7f4d02.zip |
use real GNS record types in tests to avoid failures in new extra serialization/deserialization checking
Diffstat (limited to 'src/namestore')
17 files changed, 62 insertions, 31 deletions
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c index 55d6fafa0..e73c61ea2 100644 --- a/src/namestore/perf_namestore_api_zone_iteration.c +++ b/src/namestore/perf_namestore_api_zone_iteration.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include "gnunet_namestore_service.h" | 26 | #include "gnunet_namestore_service.h" |
27 | #include "gnunet_testing_lib.h" | 27 | #include "gnunet_testing_lib.h" |
28 | #include "namestore.h" | 28 | #include "namestore.h" |
29 | #include "gnunet_dnsparser_lib.h" | ||
30 | |||
31 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
29 | 32 | ||
30 | /** | 33 | /** |
31 | * A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably | 34 | * A #BENCHMARK_SIZE of 1000 takes less than a minute on a reasonably |
@@ -141,7 +144,7 @@ create_record (unsigned int count) | |||
141 | 144 | ||
142 | rd = GNUNET_malloc (count + sizeof (struct GNUNET_GNSRECORD_Data)); | 145 | rd = GNUNET_malloc (count + sizeof (struct GNUNET_GNSRECORD_Data)); |
143 | rd->expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 146 | rd->expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
144 | rd->record_type = count; | 147 | rd->record_type = TEST_RECORD_TYPE; |
145 | rd->data_size = count; | 148 | rd->data_size = count; |
146 | rd->data = (void *) &rd[1]; | 149 | rd->data = (void *) &rd[1]; |
147 | rd->flags = 0; | 150 | rd->flags = 0; |
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index b9ae93bf2..acb30e79d 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
27 | 28 | ||
28 | #define TEST_RECORD_TYPE 1234 | 29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
29 | 30 | ||
30 | #define TEST_RECORD_DATALEN 123 | 31 | #define TEST_RECORD_DATALEN 123 |
31 | 32 | ||
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index 689e73a2e..3557e71fa 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
27 | 28 | ||
28 | #define TEST_RECORD_TYPE 1234 | 29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
29 | 30 | ||
30 | #define TEST_RECORD_DATALEN 123 | 31 | #define TEST_RECORD_DATALEN 123 |
31 | 32 | ||
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index 28a68daf9..f17bb6fc8 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c | |||
@@ -25,8 +25,9 @@ | |||
25 | #include "gnunet_namecache_service.h" | 25 | #include "gnunet_namecache_service.h" |
26 | #include "gnunet_namestore_service.h" | 26 | #include "gnunet_namestore_service.h" |
27 | #include "gnunet_testing_lib.h" | 27 | #include "gnunet_testing_lib.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
28 | 29 | ||
29 | #define TEST_RECORD_TYPE 1234 | 30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
30 | 31 | ||
31 | #define TEST_RECORD_DATALEN 123 | 32 | #define TEST_RECORD_DATALEN 123 |
32 | 33 | ||
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index 39ce4e564..1cab0a9f6 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c | |||
@@ -27,8 +27,9 @@ | |||
27 | #include "gnunet_namecache_service.h" | 27 | #include "gnunet_namecache_service.h" |
28 | #include "gnunet_namestore_service.h" | 28 | #include "gnunet_namestore_service.h" |
29 | #include "gnunet_testing_lib.h" | 29 | #include "gnunet_testing_lib.h" |
30 | #include "gnunet_dnsparser_lib.h" | ||
30 | 31 | ||
31 | #define TEST_RECORD_TYPE 1234 | 32 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
32 | 33 | ||
33 | #define TEST_RECORD_DATALEN 123 | 34 | #define TEST_RECORD_DATALEN 123 |
34 | 35 | ||
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index 09fd8ce07..0ccdf1f4b 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c | |||
@@ -28,9 +28,11 @@ | |||
28 | #include "gnunet_namecache_service.h" | 28 | #include "gnunet_namecache_service.h" |
29 | #include "gnunet_namestore_service.h" | 29 | #include "gnunet_namestore_service.h" |
30 | #include "gnunet_testing_lib.h" | 30 | #include "gnunet_testing_lib.h" |
31 | #include "gnunet_dnsparser_lib.h" | ||
32 | |||
33 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
31 | 34 | ||
32 | #define TEST_NAME "dummy.dummy.gnunet" | 35 | #define TEST_NAME "dummy.dummy.gnunet" |
33 | #define TEST_RECORD_TYPE 1234 | ||
34 | #define TEST_RECORD_DATALEN 123 | 36 | #define TEST_RECORD_DATALEN 123 |
35 | #define TEST_RECORD_DATA 'a' | 37 | #define TEST_RECORD_DATA 'a' |
36 | #define TEST_SHADOW_RECORD_DATA 'b' | 38 | #define TEST_SHADOW_RECORD_DATA 'b' |
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index de202d535..7c8ee27d7 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c | |||
@@ -25,6 +25,10 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
29 | |||
30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
31 | |||
28 | 32 | ||
29 | 33 | ||
30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | 34 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) |
@@ -244,14 +248,14 @@ put_cont (void *cls, | |||
244 | static struct GNUNET_GNSRECORD_Data * | 248 | static struct GNUNET_GNSRECORD_Data * |
245 | create_record (unsigned int count) | 249 | create_record (unsigned int count) |
246 | { | 250 | { |
247 | unsigned int c; | 251 | struct GNUNET_GNSRECORD_Data *rd; |
248 | struct GNUNET_GNSRECORD_Data * rd; | ||
249 | 252 | ||
250 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); | 253 | rd = GNUNET_new_array (count, |
251 | for (c = 0; c < count; c++) | 254 | struct GNUNET_GNSRECORD_Data); |
255 | for (unsigned int c = 0; c < count; c++) | ||
252 | { | 256 | { |
253 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 257 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
254 | rd[c].record_type = 1111; | 258 | rd[c].record_type = TEST_RECORD_TYPE; |
255 | rd[c].data_size = 50; | 259 | rd[c].data_size = 50; |
256 | rd[c].data = GNUNET_malloc(50); | 260 | rd[c].data = GNUNET_malloc(50); |
257 | rd[c].flags = 0; | 261 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 449b36d65..89fd9c8e9 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
29 | |||
30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
28 | 31 | ||
29 | 32 | ||
30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 33 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
@@ -292,7 +295,7 @@ create_record (unsigned int count) | |||
292 | for (unsigned int c = 0; c < count; c++) | 295 | for (unsigned int c = 0; c < count; c++) |
293 | { | 296 | { |
294 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 297 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
295 | rd[c].record_type = 1111; | 298 | rd[c].record_type = TEST_RECORD_TYPE; |
296 | rd[c].data_size = 50; | 299 | rd[c].data_size = 50; |
297 | rd[c].data = GNUNET_malloc(50); | 300 | rd[c].data = GNUNET_malloc(50); |
298 | rd[c].flags = 0; | 301 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index c9e2802bd..8f7782300 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
27 | 28 | ||
28 | #define TEST_RECORD_TYPE 1234 | 29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
29 | 30 | ||
30 | #define TEST_RECORD_DATALEN 123 | 31 | #define TEST_RECORD_DATALEN 123 |
31 | 32 | ||
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 4abcfa4d3..5112126c1 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
27 | 28 | ||
28 | #define TEST_RECORD_TYPE 1234 | 29 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
29 | 30 | ||
30 | #define TEST_RECORD_DATALEN 123 | 31 | #define TEST_RECORD_DATALEN 123 |
31 | 32 | ||
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 7b13cd9c5..d636018af 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c | |||
@@ -27,15 +27,14 @@ | |||
27 | #include "gnunet_namecache_service.h" | 27 | #include "gnunet_namecache_service.h" |
28 | #include "gnunet_namestore_service.h" | 28 | #include "gnunet_namestore_service.h" |
29 | #include "gnunet_testing_lib.h" | 29 | #include "gnunet_testing_lib.h" |
30 | #include "gnunet_dnsparser_lib.h" | ||
30 | 31 | ||
31 | #define TEST_RECORD_TYPE 1234 | 32 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
32 | 33 | ||
33 | #define TEST_RECORD_DATALEN 123 | 34 | #define TEST_RECORD_DATALEN 123 |
34 | 35 | ||
35 | #define TEST_RECORD_DATA 'a' | 36 | #define TEST_RECORD_DATA 'a' |
36 | 37 | ||
37 | #define TEST_RECORD_TYPE2 4321 | ||
38 | |||
39 | #define TEST_RECORD_DATALEN2 234 | 38 | #define TEST_RECORD_DATALEN2 234 |
40 | 39 | ||
41 | #define TEST_RECORD_DATA2 'b' | 40 | #define TEST_RECORD_DATA2 'b' |
@@ -149,7 +148,7 @@ rd_decrypt_cb (void *cls, | |||
149 | 148 | ||
150 | rd_new.flags = GNUNET_GNSRECORD_RF_NONE; | 149 | rd_new.flags = GNUNET_GNSRECORD_RF_NONE; |
151 | rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; | 150 | rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us + 1000000000; |
152 | rd_new.record_type = TEST_RECORD_TYPE2; | 151 | rd_new.record_type = TEST_RECORD_TYPE; |
153 | rd_new.data_size = TEST_RECORD_DATALEN2; | 152 | rd_new.data_size = TEST_RECORD_DATALEN2; |
154 | rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); | 153 | rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); |
155 | memset ((char *) rd_new.data, | 154 | memset ((char *) rd_new.data, |
@@ -172,7 +171,7 @@ rd_decrypt_cb (void *cls, | |||
172 | memset (rd_cmp_data, | 171 | memset (rd_cmp_data, |
173 | TEST_RECORD_DATA2, | 172 | TEST_RECORD_DATA2, |
174 | TEST_RECORD_DATALEN2); | 173 | TEST_RECORD_DATALEN2); |
175 | GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); | 174 | GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); |
176 | GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); | 175 | GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); |
177 | GNUNET_assert (0 == memcmp (&rd_cmp_data, | 176 | GNUNET_assert (0 == memcmp (&rd_cmp_data, |
178 | rd[0].data, | 177 | rd[0].data, |
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 68c3de9b8..00b65a576 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
29 | |||
30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
28 | 31 | ||
29 | 32 | ||
30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | 33 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) |
@@ -322,7 +325,7 @@ create_record (unsigned int count) | |||
322 | for (unsigned int c = 0; c < count; c++) | 325 | for (unsigned int c = 0; c < count; c++) |
323 | { | 326 | { |
324 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 327 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
325 | rd[c].record_type = 1111; | 328 | rd[c].record_type = TEST_RECORD_TYPE; |
326 | rd[c].data_size = 50; | 329 | rd[c].data_size = 50; |
327 | rd[c].data = GNUNET_malloc(50); | 330 | rd[c].data = GNUNET_malloc(50); |
328 | rd[c].flags = 0; | 331 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index d950b7e69..ff1b3d402 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
29 | |||
30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
28 | 31 | ||
29 | #define ZONE_NICK_1 "nick1" | 32 | #define ZONE_NICK_1 "nick1" |
30 | #define ZONE_NICK_2 "nick2" | 33 | #define ZONE_NICK_2 "nick2" |
@@ -322,7 +325,7 @@ create_record (unsigned int count) | |||
322 | for (unsigned int c = 0; c < count; c++) | 325 | for (unsigned int c = 0; c < count; c++) |
323 | { | 326 | { |
324 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 327 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
325 | rd[c].record_type = 1111; | 328 | rd[c].record_type = TEST_RECORD_TYPE; |
326 | rd[c].data_size = 50; | 329 | rd[c].data_size = 50; |
327 | rd[c].data = GNUNET_malloc(50); | 330 | rd[c].data = GNUNET_malloc(50); |
328 | rd[c].flags = 0; | 331 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 0b137cc62..a86184297 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include "gnunet_namestore_service.h" | 26 | #include "gnunet_namestore_service.h" |
27 | #include "gnunet_testing_lib.h" | 27 | #include "gnunet_testing_lib.h" |
28 | #include "namestore.h" | 28 | #include "namestore.h" |
29 | #include "gnunet_dnsparser_lib.h" | ||
30 | |||
31 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
29 | 32 | ||
30 | 33 | ||
31 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | 34 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) |
@@ -299,7 +302,7 @@ create_record (unsigned int count) | |||
299 | for (unsigned int c = 0; c < count; c++) | 302 | for (unsigned int c = 0; c < count; c++) |
300 | { | 303 | { |
301 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 304 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
302 | rd[c].record_type = 1111; | 305 | rd[c].record_type = TEST_RECORD_TYPE; |
303 | rd[c].data_size = 50; | 306 | rd[c].data_size = 50; |
304 | rd[c].data = GNUNET_malloc(50); | 307 | rd[c].data = GNUNET_malloc(50); |
305 | rd[c].flags = 0; | 308 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index c7358fc6e..98514885c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -25,7 +25,9 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
28 | 29 | ||
30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
29 | 31 | ||
30 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | 32 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) |
31 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) | 33 | #define WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) |
@@ -349,14 +351,14 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
349 | static struct GNUNET_GNSRECORD_Data * | 351 | static struct GNUNET_GNSRECORD_Data * |
350 | create_record (unsigned int count) | 352 | create_record (unsigned int count) |
351 | { | 353 | { |
352 | unsigned int c; | 354 | struct GNUNET_GNSRECORD_Data *rd; |
353 | struct GNUNET_GNSRECORD_Data * rd; | ||
354 | 355 | ||
355 | rd = GNUNET_malloc (count * sizeof (struct GNUNET_GNSRECORD_Data)); | 356 | rd = GNUNET_new_array (count, |
356 | for (c = 0; c < count; c++) | 357 | struct GNUNET_GNSRECORD_Data); |
358 | for (unsigned int c = 0; c < count; c++) | ||
357 | { | 359 | { |
358 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; | 360 | rd[c].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_HOURS).abs_value_us; |
359 | rd[c].record_type = 1111; | 361 | rd[c].record_type = TEST_RECORD_TYPE; |
360 | rd[c].data_size = 50; | 362 | rd[c].data_size = 50; |
361 | rd[c].data = GNUNET_malloc(50); | 363 | rd[c].data = GNUNET_malloc(50); |
362 | rd[c].flags = 0; | 364 | rd[c].flags = 0; |
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 292d8f701..4ce940114 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -25,10 +25,11 @@ | |||
25 | #include "gnunet_namestore_service.h" | 25 | #include "gnunet_namestore_service.h" |
26 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
27 | #include "namestore.h" | 27 | #include "namestore.h" |
28 | #include "gnunet_dnsparser_lib.h" | ||
28 | 29 | ||
29 | #define RECORDS 5 | 30 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
30 | 31 | ||
31 | #define TEST_RECORD_TYPE 1234 | 32 | #define RECORDS 5 |
32 | 33 | ||
33 | #define TEST_RECORD_DATALEN 123 | 34 | #define TEST_RECORD_DATALEN 123 |
34 | 35 | ||
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index 8732acbcb..5c8f5e6f7 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c | |||
@@ -26,7 +26,9 @@ | |||
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | #include "gnunet_namestore_plugin.h" | 27 | #include "gnunet_namestore_plugin.h" |
28 | #include "gnunet_testing_lib.h" | 28 | #include "gnunet_testing_lib.h" |
29 | #include "gnunet_dnsparser_lib.h" | ||
29 | 30 | ||
31 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT | ||
30 | 32 | ||
31 | static int ok; | 33 | static int ok; |
32 | 34 | ||
@@ -110,7 +112,7 @@ test_record (void *cls, | |||
110 | { | 112 | { |
111 | GNUNET_assert (rd[i].data_size == id % 10); | 113 | GNUNET_assert (rd[i].data_size == id % 10); |
112 | GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10)); | 114 | GNUNET_assert (0 == memcmp ("Hello World", rd[i].data, id % 10)); |
113 | GNUNET_assert (rd[i].record_type == 1 + (id % 13)); | 115 | GNUNET_assert (rd[i].record_type == TEST_RECORD_TYPE); |
114 | GNUNET_assert (rd[i].flags == 0); | 116 | GNUNET_assert (rd[i].flags == 0); |
115 | } | 117 | } |
116 | memset (&tzone_private_key, | 118 | memset (&tzone_private_key, |
@@ -154,7 +156,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, | |||
154 | rd[i].data = "Hello World"; | 156 | rd[i].data = "Hello World"; |
155 | rd[i].data_size = id % 10; | 157 | rd[i].data_size = id % 10; |
156 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; | 158 | rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; |
157 | rd[i].record_type = 1 + (id % 13); | 159 | rd[i].record_type = TEST_RECORD_TYPE; |
158 | rd[i].flags = 0; | 160 | rd[i].flags = 0; |
159 | } | 161 | } |
160 | memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); | 162 | memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); |