gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r6125 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r6125 - GNUnet/src/applications/testing
Date: Thu, 24 Jan 2008 17:05:04 -0700 (MST)

Author: nevans
Date: 2008-01-24 17:05:02 -0700 (Thu, 24 Jan 2008)
New Revision: 6125

Modified:
   GNUnet/src/applications/testing/Makefile.am
   GNUnet/src/applications/testing/remotetest.c
   GNUnet/src/applications/testing/testing.c
Log:
hopefully not broken

Modified: GNUnet/src/applications/testing/Makefile.am
===================================================================
--- GNUnet/src/applications/testing/Makefile.am 2008-01-24 09:06:29 UTC (rev 
6124)
+++ GNUnet/src/applications/testing/Makefile.am 2008-01-25 00:05:02 UTC (rev 
6125)
@@ -3,13 +3,21 @@
 plugindir = $(libdir)/GNUnet
 
 lib_LTLIBRARIES = \
-  libgnunettesting_api.la
+  libgnunettesting_api.la \
+  libgnunetremote_api.la
 
 libgnunettesting_api_la_SOURCES = \
   testing.c 
 libgnunettesting_api_la_LIBADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/applications/identity/libgnunetidentity_api.la 
+  
+libgnunetremote_api_la_SOURCES = \
+  remote.c 
+libgnunetremote_api_la_LIBADD = \
+  $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/applications/identity/libgnunetidentity_api.la 
+  
 
 
 check_PROGRAMS = \
@@ -29,7 +37,7 @@
  remotetest.c
 remotetest_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/applications/testing/libgnunettesting_api.la
+ $(top_builddir)/src/applications/testing/libgnunetremote_api.la
 
 
 testingtest_loop_SOURCES = \

Modified: GNUnet/src/applications/testing/remotetest.c
===================================================================
--- GNUnet/src/applications/testing/remotetest.c        2008-01-24 09:06:29 UTC 
(rev 6124)
+++ GNUnet/src/applications/testing/remotetest.c        2008-01-25 00:05:02 UTC 
(rev 6125)
@@ -20,13 +20,13 @@
 
 /**
  * @file applications/testing/remotetest.c
- * @brief testcase for testing library
- * @author Not Christian Grothoff
+ * @brief Testcase for remote library
+ * @author Nathan Evans
  */
 
 #include "platform.h"
 #include "gnunet_protocols.h"
-#include "gnunet_testing_lib.h"
+#include "gnunet_remote_lib.h"
 
 /**
  * Testcase
@@ -44,9 +44,9 @@
   struct GNUNET_GC_Configuration *hostConfig;
   
 
-static struct GNUNET_CommandLineOption gnunetstatsOptions[] = {
+static struct GNUNET_CommandLineOption gnunetRemoteOptions[] = {
   GNUNET_COMMAND_LINE_OPTION_CFG_FILE (&configFile),   /* -c */
-  GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Print statistics about 
GNUnet operations.")), /* -h */
+  GNUNET_COMMAND_LINE_OPTION_HELP (gettext_noop ("Set up multiple gnunetd 
daemons across multiple hosts.")), /* -h */
   GNUNET_COMMAND_LINE_OPTION_HOSTNAME,  /* -H */
   GNUNET_COMMAND_LINE_OPTION_LOGGING,   /* -L */
   GNUNET_COMMAND_LINE_OPTION_VERSION (PACKAGE_VERSION), /* -v */
@@ -58,7 +58,7 @@
   res = GNUNET_init (argc,
                      argv,
                      "testingtest",
-                     &configFile, gnunetstatsOptions, &ectx, &cfg);
+                     &configFile, gnunetRemoteOptions, &ectx, &cfg);
   if (res == -1)
   {
     GNUNET_fini (ectx, cfg);
@@ -73,23 +73,18 @@
     
   
     
-  if (GNUNET_OK != GNUNET_TESTING_remote_read_config (fullpath,&hostConfig))
+  if (GNUNET_OK != GNUNET_REMOTE_read_config (fullpath,&hostConfig))
   {
        printf("Problem with main host configuration file...\n");
        exit(1);        
   }
-    
-  if (GNUNET_TESTING_remote_check_config(&hostConfig) != GNUNET_OK)
-  {
-       printf("Problem with main host configuration file...\n");
-       exit(1);        
-  }
+   
                       
   //GNUNET_TESTING_remote_start_daemon(one,two,six,three,four,five);
        
-  GNUNET_TESTING_remote_start_daemons(&hostConfig);
+  GNUNET_REMOTE_start_daemons(&hostConfig);
        
   return GNUNET_OK;
 }
 
-/* end of testingtest.c */
+/* end of remotetest.c */

Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c   2008-01-24 09:06:29 UTC (rev 
6124)
+++ GNUnet/src/applications/testing/testing.c   2008-01-25 00:05:02 UTC (rev 
6125)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2007 Christian Grothoff (and other contributing authors)
+     (C) 2008 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -412,202 +412,6 @@
   return ret;
 }
 
-int GNUNET_TESTING_remote_read_config(const char *config_file,struct 
GNUNET_GC_Configuration **newcfg)
-{
-       struct GNUNET_GC_Configuration *cfg;
-               
-       if (config_file == NULL) 
-               return GNUNET_SYSERR;
-       
-       cfg = GNUNET_GC_create ();
-       if (-1 == GNUNET_GC_parse_configuration (cfg, config_file))
-       {
-         fprintf (stderr,
-                 "Failed to read configuration file `%s'\n", config_file);
-         GNUNET_GC_free (cfg);
-         return GNUNET_SYSERR;
-       }
-       
-       *newcfg = cfg;
-       
-       return GNUNET_OK;       
-}
 
-int GNUNET_TESTING_remote_check_config(struct GNUNET_GC_Configuration **newcfg)
-{
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","SSH_USERNAME"))
-               return GNUNET_SYSERR;
-               
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","CONTROL_HOST"))
-               return GNUNET_SYSERR;
-               
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","CLIENT_IPS"))
-               return GNUNET_SYSERR;
-               
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","STARTING_PORT"))
-               return GNUNET_SYSERR;
-       
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","PORT_INCREMENT"))
-               return GNUNET_SYSERR;
-               
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","NUMBER_OF_DAEMONS"))
-               return GNUNET_SYSERR;
-               
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","REMOTE_CONFIG_PATH"))
-               return GNUNET_SYSERR;
-       
-       if (GNUNET_NO == 
GNUNET_GC_have_configuration_value(*newcfg,"MULTIPLE_SERVER_TESTING","REMOTE_GNUNETD_PATH"))
-               return GNUNET_SYSERR;
-               
-       return GNUNET_OK;
-}
 
-/**
- * Starts a single gnunet daemon on a remote machine
- *
- * @param gnunetd_home directory where gnunetd is on remote machine
- * @param localConfigPath local configuration path for config file
- * @param remote_config_path remote path to copy local config to
- * @param configFileName  file to copy and use on remote machine
- * @param ip_address ip address of remote machine
- * @param username username to use for ssh (assumed to be used with ssh-agent)
- */
-int
-GNUNET_TESTING_remote_start_daemon (char *gnunetd_home,
-                             char *localConfigPath,char *configFileName,char 
*remote_config_path,char *ip_address,
-                             char *username)
-{
-       char *cmd;
-       char *newcmd;
-       
-       cmd = "scp ";
-       newcmd = GNUNET_malloc (strlen (cmd) + 128);
-       strcpy(newcmd,cmd);
-       //strcat(newcmd,(localConfigFile) " " (username) "@" (ip_address) ":" 
(remote_config_path));
-       strcat(newcmd,localConfigPath);
-       strcat(newcmd,configFileName);
-       strcat(newcmd," ");
-       strcat(newcmd,username);
-       strcat(newcmd,"@");
-       strcat(newcmd,ip_address);
-       strcat(newcmd,":");
-       strcat(newcmd,remote_config_path);
-       
-       printf("scp command is : %s \n",newcmd);
-       //system(newcmd);
-       
-       cmd = "ssh ";
-       GNUNET_free(newcmd);
-       newcmd = GNUNET_malloc (strlen (cmd) + 128);
-       strcpy(newcmd,cmd);
-       strcat(newcmd,username);
-       strcat(newcmd,"@");
-       strcat(newcmd,ip_address);
-       strcat(newcmd," ");
-       strcat(newcmd,gnunetd_home);
-       strcat(newcmd, DIR_SEPARATOR_STR "gnunetd -c ");
-       strcat(newcmd, remote_config_path);
-       strcat(newcmd, configFileName);
-       
-       printf("ssh command is : %s \n",newcmd);
-       
-       //system(newcmd);
-               
-       return GNUNET_OK;
-}
-
-int
-GNUNET_TESTING_remote_start_daemons(struct GNUNET_GC_Configuration **newcfg)
-{
-       const unsigned long long MIN_STARTING_PORT = 1001;
-       const unsigned long long MAX_STARTING_PORT = 30000;
-       const unsigned long long MIN_PORT_INCREMENT = 1;
-       const unsigned long long MAX_PORT_INCREMENT = 100;
-       const unsigned long long MIN_NUMBER_DAEMONS = 1;
-       const unsigned long long MAX_NUMBER_DAEMONS = 20000;
-       
-       char *ssh_username;
-       char *control_host;
-       char *remote_config_path;
-       char *remote_gnunetd_path;
-       unsigned long long starting_port;
-       unsigned long long port_increment;
-       unsigned long long number_of_daemons;
-       char *client_ips;
-       
-       unsigned int count = 0;
-       unsigned int length;
-       unsigned int temp[4];
-       unsigned int num_machines = 0;
-       unsigned int i;
-       unsigned int j;
-       unsigned int pos;
-       unsigned int cnt;
-       
-       
GNUNET_GC_get_configuration_value_string(*newcfg,"MULTIPLE_SERVER_TESTING","SSH_USERNAME",NULL,&ssh_username);
-       
GNUNET_GC_get_configuration_value_string(*newcfg,"MULTIPLE_SERVER_TESTING","CONTROL_HOST",NULL,&control_host);
-       
GNUNET_GC_get_configuration_value_string(*newcfg,"MULTIPLE_SERVER_TESTING","CLIENT_IPS",NULL,&client_ips);
-       
GNUNET_GC_get_configuration_value_number(*newcfg,"MULTIPLE_SERVER_TESTING","STARTING_PORT",MIN_STARTING_PORT,MAX_STARTING_PORT,0,&starting_port);
-       
GNUNET_GC_get_configuration_value_number(*newcfg,"MULTIPLE_SERVER_TESTING","PORT_INCREMENT",MIN_PORT_INCREMENT,MAX_PORT_INCREMENT,0,&port_increment);
-       
GNUNET_GC_get_configuration_value_number(*newcfg,"MULTIPLE_SERVER_TESTING","NUMBER_OF_DAEMONS",MIN_NUMBER_DAEMONS,MAX_NUMBER_DAEMONS,0,&number_of_daemons);
-       
GNUNET_GC_get_configuration_value_string(*newcfg,"MULTIPLE_SERVER_TESTING","REMOTE_CONFIG_PATH",NULL,&remote_config_path);
-       
GNUNET_GC_get_configuration_value_string(*newcfg,"MULTIPLE_SERVER_TESTING","REMOTE_GNUNETD_PATH",NULL,&remote_gnunetd_path);
-       
-       
-       printf("username : %s\n", ssh_username);
-       printf("control host : %s\n", control_host);
-       printf("client ip string : %s\n", client_ips);
-       printf("remote config path : %s\n", remote_config_path);
-       printf("remote gnunetd path : %s\n", remote_gnunetd_path);
-
-       printf("starting port : %lld\n", starting_port);
-       printf("port increment : %lld\n", port_increment);
-       printf("# of daemons : %lld\n", number_of_daemons);
-       
-       if (client_ips == NULL)
-               return GNUNET_SYSERR;
-               
-       length = strlen(client_ips);
-       
-       if (length == 0)
-       {
-               printf("No clients specified in config file!\n");       
-       }
-       
-       while(count < length)
-       {
-               if (client_ips[count] == ';')
-                       ++num_machines;
-               ++count;                
-       }
-       
-       i = 0;
-    pos = 0;
-    
-       while (i < num_machines)
-    {
-               cnt = sscanf (&client_ips[pos],
-                           "%u.%u.%u.%u;",
-                           &temp[0], &temp[1], &temp[2], &temp[3]);
-             if (cnt == 4)
-               {
-                 for (j = 0; j < 4; j++)
-                   if (temp[j] > 0xFF)
-                     {
-                       printf("Error with ip address in config file...\n");
-                       return NULL;
-                     }
-       
-               }
-               
-               while(client_ips[pos] != ';' && pos<length-1)
-                       pos++;
-               pos++;
-               i++;
-               
-        printf("ip address is %u.%u.%u.%u\n",temp[0],temp[1],temp[2],temp[3]);
-    }
-       
-               
-}
 /* end of testing.c */





reply via email to

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