M testbed/testbed.h
[oweals/gnunet.git] / src / gns / test_gns_proxy.c
index 35350e8bb64fe49c0333cb4862469d4f0df82bce..1b904cec973793a4f9eaec5902ac81d2678e304e 100644 (file)
 #include <microhttpd.h>
 #include "gnunet_namestore_service.h"
 #include "gnunet_gns_service.h"
-#include "gnunet_testing_lib-new.h"
+#include "gnunet_testing_lib.h"
 #include "gnunet_os_lib.h"
 
 #define PORT 8080
-#define TEST_DOMAIN "www.gnunet"
+#define TEST_DOMAIN "www.gads"
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300)
 
@@ -135,11 +135,21 @@ do_shutdown ()
   GNUNET_free_non_null (url);
 
   if (NULL != tmp_cfgfile)
-    remove (tmp_cfgfile);
-
+    {
+      if (0 != remove (tmp_cfgfile))
+       GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "remove", tmp_cfgfile);
+      GNUNET_free (tmp_cfgfile);
+      tmp_cfgfile = NULL;
+    }
   if (NULL != proxy_proc)
-    GNUNET_OS_process_kill (proxy_proc, 9);
+    {
+      (void) GNUNET_OS_process_kill (proxy_proc, SIGKILL);
+      GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (proxy_proc));
+      GNUNET_OS_process_destroy (proxy_proc);
+      proxy_proc = NULL;
+    }
   url = NULL;
+  GNUNET_SCHEDULER_shutdown ();
 }
 
 
@@ -434,14 +444,23 @@ run (void *cls,
 int
 main (int argc, char *const *argv)
 {
+  char *binary;
 
   if (GNUNET_SYSERR == GNUNET_OS_check_helper_binary ("gnunet-gns-proxy"))
   {
     fprintf (stderr, "Proxy binary not in PATH... skipping!\n");
     return 0;
   }
+  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-helper-dns");
+  if (GNUNET_YES != GNUNET_OS_check_helper_binary (binary))
+  {
+    fprintf (stderr, "DNS helper binary has wrong permissions... skipping!\n");
+    GNUNET_free (binary);
+    return 0;
+  }
+    GNUNET_free (binary);
 
-  GNUNET_CRYPTO_setup_hostkey ("test_gns_proxy.conf");
+  GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_proxy.conf");
   
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
   {