aboutsummaryrefslogtreecommitdiff
path: root/src/gns/test_gns_revocation.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/test_gns_revocation.c')
-rw-r--r--src/gns/test_gns_revocation.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/gns/test_gns_revocation.c b/src/gns/test_gns_revocation.c
index a538ab3e7..691d8c124 100644
--- a/src/gns/test_gns_revocation.c
+++ b/src/gns/test_gns_revocation.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 "www.bob.gads" 39#define TEST_DOMAIN "www.bob.gads"
46#define TEST_IP "127.0.0.1" 40#define TEST_IP "127.0.0.1"
@@ -50,10 +44,8 @@
50 44
51#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey" 45#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"
52 46
53/* Globals */
54
55/* Task handle to use to schedule test failure */ 47/* Task handle to use to schedule test failure */
56GNUNET_SCHEDULER_TaskIdentifier die_task; 48static GNUNET_SCHEDULER_TaskIdentifier die_task;
57 49
58/* Global return value (0 for success, anything else for failure) */ 50/* Global return value (0 for success, anything else for failure) */
59static int ok; 51static int ok;
@@ -62,7 +54,8 @@ static struct GNUNET_NAMESTORE_Handle *namestore_handle;
62 54
63static struct GNUNET_GNS_Handle *gns_handle; 55static struct GNUNET_GNS_Handle *gns_handle;
64 56
65const struct GNUNET_CONFIGURATION_Handle *cfg; 57static const struct GNUNET_CONFIGURATION_Handle *cfg;
58
66 59
67/** 60/**
68 * Check if the get_handle is being used, if so stop the request. Either 61 * Check if the get_handle is being used, if so stop the request. Either
@@ -89,6 +82,7 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
89 ok = 1; 82 ok = 1;
90} 83}
91 84
85
92static void 86static void
93end_badly_now () 87end_badly_now ()
94{ 88{
@@ -96,14 +90,17 @@ end_badly_now ()
96 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL); 90 die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
97} 91}
98 92
99static void shutdown_task (void *cls, 93
100 const struct GNUNET_SCHEDULER_TaskContext *tc) 94static void
95shutdown_task (void *cls,
96 const struct GNUNET_SCHEDULER_TaskContext *tc)
101{ 97{
102 GNUNET_GNS_disconnect(gns_handle); 98 GNUNET_GNS_disconnect(gns_handle);
103 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n"); 99 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Shutting down peer!\n");
104 GNUNET_SCHEDULER_shutdown (); 100 GNUNET_SCHEDULER_shutdown ();
105} 101}
106 102
103
107static void 104static void
108on_lookup_result(void *cls, uint32_t rd_count, 105on_lookup_result(void *cls, uint32_t rd_count,
109 const struct GNUNET_NAMESTORE_RecordData *rd) 106 const struct GNUNET_NAMESTORE_RecordData *rd)
@@ -272,18 +269,13 @@ do_check (void *cls,
272} 269}
273 270
274 271
275
276int 272int
277main (int argc, char *argv[]) 273main (int argc, char *argv[])
278{ 274{
279 ok = 1; 275 ok = 1;
280 276
281 GNUNET_log_setup ("test-gns-revocation", 277 GNUNET_log_setup ("test-gns-revocation",
282#if VERBOSE
283 "DEBUG",
284#else
285 "WARNING", 278 "WARNING",
286#endif
287 NULL); 279 NULL);
288 GNUNET_TESTING_peer_run ("test-gns-revocation", "test_gns_simple_lookup.conf", &do_check, NULL); 280 GNUNET_TESTING_peer_run ("test-gns-revocation", "test_gns_simple_lookup.conf", &do_check, NULL);
289 return ok; 281 return ok;