aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_gns_simple_mx_lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/test_gns_simple_mx_lookup.c')
-rw-r--r--src/gns/test_gns_simple_mx_lookup.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/src/gns/test_gns_simple_mx_lookup.c b/src/gns/test_gns_simple_mx_lookup.c
index a2fc311d4..812a157db 100644
--- a/src/gns/test_gns_simple_mx_lookup.c
+++ b/src/gns/test_gns_simple_mx_lookup.c
@@ -32,15 +32,9 @@
32#include "gnunet_dnsparser_lib.h" 32#include "gnunet_dnsparser_lib.h"
33#include "gnunet_gns_service.h" 33#include "gnunet_gns_service.h"
34 34
35/* DEFINES */
36#define VERBOSE GNUNET_YES
37
38/* Timeout for entire testcase */ 35/* Timeout for entire testcase */
39#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20) 36#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20)
40 37
41/* If number of peers not in config file, use this number */
42#define DEFAULT_NUM_PEERS 2
43
44/* test records to resolve */ 38/* test records to resolve */
45#define TEST_DOMAIN "bob.gads" 39#define TEST_DOMAIN "bob.gads"
46#define TEST_IP "127.0.0.1" 40#define TEST_IP "127.0.0.1"
@@ -52,11 +46,8 @@
52 46
53#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey" 47#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"
54 48
55/* Globals */
56
57
58/* Task handle to use to schedule test failure */ 49/* Task handle to use to schedule test failure */
59GNUNET_SCHEDULER_TaskIdentifier die_task; 50static GNUNET_SCHEDULER_TaskIdentifier die_task;
60 51
61/* Global return value (0 for success, anything else for failure) */ 52/* Global return value (0 for success, anything else for failure) */
62static int ok; 53static int ok;
@@ -65,7 +56,7 @@ static struct GNUNET_NAMESTORE_Handle *namestore_handle;
65 56
66static struct GNUNET_GNS_Handle *gns_handle; 57static struct GNUNET_GNS_Handle *gns_handle;
67 58
68const struct GNUNET_CONFIGURATION_Handle *cfg; 59static const struct GNUNET_CONFIGURATION_Handle *cfg;
69 60
70 61
71/** 62/**
@@ -93,6 +84,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
93 ok = 1; 84 ok = 1;
94} 85}
95 86
87
96static void 88static void
97end_badly_now () 89end_badly_now ()
98{ 90{
@@ -101,14 +93,16 @@ end_badly_now ()
101} 93}
102 94
103 95
104static void shutdown_task (void *cls, 96static void
105 const struct GNUNET_SCHEDULER_TaskContext *tc) 97shutdown_task (void *cls,
98 const struct GNUNET_SCHEDULER_TaskContext *tc)
106{ 99{
107 GNUNET_GNS_disconnect(gns_handle); 100 GNUNET_GNS_disconnect(gns_handle);
108 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n"); 101 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n");
109 GNUNET_SCHEDULER_shutdown (); 102 GNUNET_SCHEDULER_shutdown ();
110} 103}
111 104
105
112static void 106static void
113on_lookup_result(void *cls, uint32_t rd_count, 107on_lookup_result(void *cls, uint32_t rd_count,
114 const struct GNUNET_NAMESTORE_RecordData *rd) 108 const struct GNUNET_NAMESTORE_RecordData *rd)
@@ -297,13 +291,8 @@ int
297main (int argc, char *argv[]) 291main (int argc, char *argv[])
298{ 292{
299 ok = 1; 293 ok = 1;
300
301 GNUNET_log_setup ("test-gns-simple-mx-lookup", 294 GNUNET_log_setup ("test-gns-simple-mx-lookup",
302#if VERBOSE
303 "DEBUG",
304#else
305 "WARNING", 295 "WARNING",
306#endif
307 NULL); 296 NULL);
308 GNUNET_TESTING_peer_run ("test-gns-simple-mx-lookup", "test_gns_simple_lookup.conf", &do_check, NULL); 297 GNUNET_TESTING_peer_run ("test-gns-simple-mx-lookup", "test_gns_simple_lookup.conf", &do_check, NULL);
309 return ok; 298 return ok;