gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r35356 - gnunet/src/arm


From: gnunet
Subject: [GNUnet-SVN] r35356 - gnunet/src/arm
Date: Sat, 7 Mar 2015 21:18:54 +0100

Author: grothoff
Date: 2015-03-07 21:18:54 +0100 (Sat, 07 Mar 2015)
New Revision: 35356

Modified:
   gnunet/src/arm/test_gnunet_service_arm.c
Log:
simplify test, log failure cause

Modified: gnunet/src/arm/test_gnunet_service_arm.c
===================================================================
--- gnunet/src/arm/test_gnunet_service_arm.c    2015-03-07 19:59:02 UTC (rev 
35355)
+++ gnunet/src/arm/test_gnunet_service_arm.c    2015-03-07 20:18:54 UTC (rev 
35356)
@@ -38,6 +38,7 @@
 
 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
 
+
 static int ret = 1;
 
 static int resolved_ok;
@@ -65,8 +66,11 @@
   GNUNET_break (status == GNUNET_ARM_REQUEST_SENT_OK);
   GNUNET_break (result == GNUNET_ARM_RESULT_STOPPED);
   if (result != GNUNET_ARM_RESULT_STOPPED)
+  {
+    GNUNET_break (0);
     ret = 4;
-  GNUNET_SCHEDULER_add_now (trigger_disconnect, NULL);
+  }
+  GNUNET_SCHEDULER_add_now (&trigger_disconnect, NULL);
 }
 
 
@@ -95,31 +99,40 @@
   }
 
  stop_arm:
-  GNUNET_ARM_request_service_stop (arm, "arm", TIMEOUT,
+  GNUNET_ARM_request_service_stop (arm,
+                                   "arm",
+                                   TIMEOUT,
                                    &arm_stop_cb, NULL);
 }
 
 
 static void
-hostNameResolveCB (void *cls,
+hostname_resolve_cb (void *cls,
                    const struct sockaddr *addr,
                    socklen_t addrlen)
 {
-  if ((ret == 0) || (ret == 4) || (resolved_ok == 1))
+  if ((0 == ret) || (4 == ret) || (1 == resolved_ok))
     return;
   if (NULL == addr)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Name not resolved!\n");
+    GNUNET_break (0);
     ret = 3;
-    GNUNET_ARM_request_service_stop (arm, "arm", TIMEOUT,
+    GNUNET_ARM_request_service_stop (arm,
+                                     "arm",
+                                     TIMEOUT,
                                      &arm_stop_cb, NULL);
+    return;
   }
-  else if (asked_for_a_list == 0)
+  if (0 == asked_for_a_list)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Resolved hostname, now checking the service list\n");
-    GNUNET_ARM_request_service_list (arm, TIMEOUT, service_list, NULL);
+    GNUNET_ARM_request_service_list (arm,
+                                     TIMEOUT,
+                                     &service_list,
+                                     NULL);
     asked_for_a_list = 1;
     resolved_ok = 1;
   }
@@ -139,10 +152,12 @@
   /* connect to the resolver service */
   if (NULL ==
       GNUNET_RESOLVER_hostname_resolve (AF_UNSPEC, TIMEOUT,
-                                        &hostNameResolveCB, NULL))
+                                        &hostname_resolve_cb,
+                                        NULL))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-        "Unable initiate connection to resolver service\n");
+                "Unable initiate connection to resolver service\n");
+    GNUNET_break (0);
     ret = 2;
     GNUNET_ARM_request_service_stop (arm,
                                      "arm", TIMEOUT,
@@ -157,21 +172,6 @@
      const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-  char *armconfig;
-
-  if (NULL != cfgfile)
-  {
-    if (GNUNET_OK !=
-        GNUNET_CONFIGURATION_get_value_filename (c, "arm", "CONFIG",
-                                                 &armconfig))
-    {
-      GNUNET_CONFIGURATION_set_value_string ((struct 
GNUNET_CONFIGURATION_Handle *) c,
-                                             "arm", "CONFIG",
-                                             cfgfile);
-    }
-    else
-      GNUNET_free (armconfig);
-  }
   arm = GNUNET_ARM_connect (c, NULL, NULL);
   GNUNET_ARM_request_service_start (arm, "arm",
                                     GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
@@ -185,7 +185,8 @@
 {
   static char *const argv[] = {
     "test-gnunet-service-arm",
-    "-c", "test_arm_api_data.conf",
+    "-c",
+    "test_arm_api_data.conf",
     NULL
   };
   static struct GNUNET_GETOPT_CommandLineOption options[] = {
@@ -217,6 +218,12 @@
                                    argv, "test-gnunet-service-arm",
                                    "nohelp", options,
                                     &run, NULL));
+  if (0 != ret)
+  {
+    fprintf (stderr,
+             "Test failed with error code %d\n",
+             ret);
+  }
   return ret;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]