- Allocate buffer large enough to contain UNIX_PATH_MAX size pathnames in case of...
[oweals/gnunet.git] / src / util / test_resolver_api.c
index b9ca81b0f517a15794992f4c95e28a1609cb428b..c949904156bd4b229d83a65d122081c6d0f73469 100644 (file)
  * @brief testcase for resolver_api.c
  */
 #include "platform.h"
-#include "gnunet_common.h"
-#include "gnunet_getopt_lib.h"
-#include "gnunet_os_lib.h"
-#include "gnunet_program_lib.h"
-#include "gnunet_scheduler_lib.h"
+#include "gnunet_util_lib.h"
 #include "gnunet_resolver_service.h"
 #include "resolver.h"
 
@@ -203,7 +199,9 @@ check_rootserver_name (void *cls, const char *hostname)
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Received invalid rootserver hostname `%s'.\n", hostname);
+                "Received invalid rootserver hostname `%s', expected `%s'\n",
+                hostname,
+                ROOTSERVER_NAME);
     GNUNET_break (0);
   }
 }
@@ -296,11 +294,11 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   rootserver =
       gethostbyaddr (&rootserver_addr, sizeof (rootserver_addr), AF_INET);
-  if (rootserver == NULL)
+  if (NULL == rootserver)
   {
     /* Error: resolving IP addresses does not work */
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                _("gethostbyaddr() could not lookup hostname: %s\n"),
+                "gethostbyaddr() could not lookup hostname: %s\n",
                 hstrerror (h_errno));
     GNUNET_break (0);
   }
@@ -356,9 +354,8 @@ main (int argc, char *argv[])
 {
   int ok = 1 + 2 + 4 + 8;
   char *fn;
-  char *pfx;
   struct GNUNET_OS_Process *proc;
-  char *const argvx[] = { 
+  char *const argvx[] = {
     "test-resolver-api", "-c", "test_resolver_api_data.conf", NULL
   };
   struct GNUNET_GETOPT_CommandLineOption options[] =
@@ -367,10 +364,11 @@ main (int argc, char *argv[])
   GNUNET_log_setup ("test-resolver-api",
                     "WARNING",
                     NULL);
-  pfx = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_BINDIR);
-  GNUNET_asprintf (&fn, "%s%cgnunet-service-resolver", pfx, DIR_SEPARATOR);
-  GNUNET_free (pfx);
-  proc = GNUNET_OS_start_process (GNUNET_YES, GNUNET_OS_INHERIT_STD_OUT_AND_ERR, NULL, NULL, fn, "gnunet-service-resolver",
+  fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+  proc = GNUNET_OS_start_process (GNUNET_YES,
+                                 GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
+                                 NULL, NULL, fn,
+                                 "gnunet-service-resolver",
                                   "-c", "test_resolver_api_data.conf", NULL);
   GNUNET_assert (NULL != proc);
   GNUNET_free (fn);
@@ -378,7 +376,7 @@ main (int argc, char *argv[])
                  GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
                                      argvx, "test-resolver-api", "nohelp",
                                      options, &run, &ok));
-  if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
+  if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
   {
     GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
     ok = 1;