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 | |
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
20 files changed, 123 insertions, 84 deletions
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c index 9ba303e66..9dd09c0bf 100644 --- a/src/gnsrecord/test_gnsrecord_crypto.c +++ b/src/gnsrecord/test_gnsrecord_crypto.c | |||
@@ -23,11 +23,12 @@ | |||
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_dnsparser_lib.h" | ||
26 | #include "gnunet_gnsrecord_lib.h" | 27 | #include "gnunet_gnsrecord_lib.h" |
27 | 28 | ||
28 | #define RECORDS 5 | 29 | #define RECORDS 5 |
29 | 30 | ||
30 | #define TEST_RECORD_TYPE 1234 | 31 | #define TEST_RECORD_TYPE GNUNET_DNSPARSER_TYPE_TXT |
31 | 32 | ||
32 | #define TEST_RECORD_DATALEN 123 | 33 | #define TEST_RECORD_DATALEN 123 |
33 | 34 | ||
diff --git a/src/gnsrecord/test_gnsrecord_serialization.c b/src/gnsrecord/test_gnsrecord_serialization.c index 3edd2bc48..a43bf2efa 100644 --- a/src/gnsrecord/test_gnsrecord_serialization.c +++ b/src/gnsrecord/test_gnsrecord_serialization.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_gnsrecord_lib.h" | 26 | #include "gnunet_gnsrecord_lib.h" |
27 | #include "gnunet_dnsparser_lib.h" | ||
27 | 28 | ||
28 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) | 29 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 100) |
29 | 30 | ||
@@ -31,7 +32,9 @@ static int res; | |||
31 | 32 | ||
32 | 33 | ||
33 | static void | 34 | static void |
34 | run (void *cls, char *const *args, const char *cfgfile, | 35 | run (void *cls, |
36 | char *const *args, | ||
37 | const char *cfgfile, | ||
35 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 38 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
36 | { | 39 | { |
37 | size_t len; | 40 | size_t len; |
@@ -46,7 +49,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
46 | data_len = 0; | 49 | data_len = 0; |
47 | for (c = 0; c < rd_count; c++) | 50 | for (c = 0; c < rd_count; c++) |
48 | { | 51 | { |
49 | src[c].record_type = c+1; | 52 | src[c].record_type = GNUNET_DNSPARSER_TYPE_TXT; |
50 | src[c].data_size = data_len; | 53 | src[c].data_size = data_len; |
51 | src[c].data = GNUNET_malloc (data_len); | 54 | src[c].data = GNUNET_malloc (data_len); |
52 | 55 | ||
@@ -69,58 +72,61 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
69 | (unsigned int) len); | 72 | (unsigned int) len); |
70 | 73 | ||
71 | GNUNET_assert (rd_ser != NULL); | 74 | GNUNET_assert (rd_ser != NULL); |
72 | |||
73 | struct GNUNET_GNSRECORD_Data dst[rd_count]; | ||
74 | GNUNET_assert (GNUNET_OK == | ||
75 | GNUNET_GNSRECORD_records_deserialize (len, | ||
76 | rd_ser, | ||
77 | rd_count, | ||
78 | dst)); | ||
79 | |||
80 | GNUNET_assert (dst != NULL); | ||
81 | |||
82 | for (c = 0; c < rd_count; c++) | ||
83 | { | 75 | { |
84 | if (src[c].data_size != dst[c].data_size) | 76 | struct GNUNET_GNSRECORD_Data dst[rd_count]; |
85 | { | 77 | GNUNET_assert (GNUNET_OK == |
86 | GNUNET_break (0); | 78 | GNUNET_GNSRECORD_records_deserialize (len, |
87 | res = 1; | 79 | rd_ser, |
88 | } | 80 | rd_count, |
89 | if (src[c].expiration_time != dst[c].expiration_time) | 81 | dst)); |
90 | { | ||
91 | GNUNET_break (0); | ||
92 | res = 1; | ||
93 | } | ||
94 | if (src[c].flags != dst[c].flags) | ||
95 | { | ||
96 | GNUNET_break (0); | ||
97 | res = 1; | ||
98 | } | ||
99 | if (src[c].record_type != dst[c].record_type) | ||
100 | { | ||
101 | GNUNET_break (0); | ||
102 | res = 1; | ||
103 | } | ||
104 | 82 | ||
105 | size_t data_size = src[c].data_size; | 83 | GNUNET_assert (dst != NULL); |
106 | char data[data_size]; | 84 | |
107 | memset (data, 'a', data_size); | 85 | for (c = 0; c < rd_count; c++) |
108 | if (0 != memcmp (data, dst[c].data, data_size)) | ||
109 | { | ||
110 | GNUNET_break (0); | ||
111 | res = 1; | ||
112 | } | ||
113 | if (0 != memcmp (data, src[c].data, data_size)) | ||
114 | { | ||
115 | GNUNET_break (0); | ||
116 | res = 1; | ||
117 | } | ||
118 | if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size)) | ||
119 | { | 86 | { |
120 | GNUNET_break (0); | 87 | if (src[c].data_size != dst[c].data_size) |
121 | res = 1; | 88 | { |
89 | GNUNET_break (0); | ||
90 | res = 1; | ||
91 | } | ||
92 | if (src[c].expiration_time != dst[c].expiration_time) | ||
93 | { | ||
94 | GNUNET_break (0); | ||
95 | res = 1; | ||
96 | } | ||
97 | if (src[c].flags != dst[c].flags) | ||
98 | { | ||
99 | GNUNET_break (0); | ||
100 | res = 1; | ||
101 | } | ||
102 | if (src[c].record_type != dst[c].record_type) | ||
103 | { | ||
104 | GNUNET_break (0); | ||
105 | res = 1; | ||
106 | } | ||
107 | |||
108 | { | ||
109 | size_t data_size = src[c].data_size; | ||
110 | char data[data_size]; | ||
111 | |||
112 | memset (data, 'a', data_size); | ||
113 | if (0 != memcmp (data, dst[c].data, data_size)) | ||
114 | { | ||
115 | GNUNET_break (0); | ||
116 | res = 1; | ||
117 | } | ||
118 | if (0 != memcmp (data, src[c].data, data_size)) | ||
119 | { | ||
120 | GNUNET_break (0); | ||
121 | res = 1; | ||
122 | } | ||
123 | if (0 != memcmp (src[c].data, dst[c].data, src[c].data_size)) | ||
124 | { | ||
125 | GNUNET_break (0); | ||
126 | res = 1; | ||
127 | } | ||
128 | } | ||
122 | } | 129 | } |
123 | |||
124 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c); | 130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Element [%i]: EQUAL\n", c); |
125 | } | 131 | } |
126 | 132 | ||
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c index 7b0e6e318..f70388c2a 100644 --- a/src/namecache/test_namecache_api_cache_block.c +++ b/src/namecache/test_namecache_api_cache_block.c | |||
@@ -24,8 +24,9 @@ | |||
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_namecache_service.h" | 25 | #include "gnunet_namecache_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 | ||
@@ -108,7 +109,7 @@ rd_decrypt_cb (void *cls, | |||
108 | 109 | ||
109 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
110 | "Block was decrypted successfully \n"); | 111 | "Block was decrypted successfully \n"); |
111 | 112 | ||
112 | GNUNET_SCHEDULER_add_now (&end, NULL); | 113 | GNUNET_SCHEDULER_add_now (&end, NULL); |
113 | } | 114 | } |
114 | 115 | ||
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)); |