gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r4849 - in GNUnet: . src/applications/advertising src/appli


From: gnunet
Subject: [GNUnet-SVN] r4849 - in GNUnet: . src/applications/advertising src/applications/dht/tools src/applications/fs src/applications/fs/ecrs src/applications/fs/fsui src/applications/gap src/util/boot src/util/getopt
Date: Mon, 28 May 2007 21:22:17 -0600 (MDT)

Author: grothoff
Date: 2007-05-28 21:22:17 -0600 (Mon, 28 May 2007)
New Revision: 4849

Added:
   GNUnet/src/applications/advertising/advertising_test.c
   GNUnet/src/applications/advertising/check.conf
   GNUnet/src/applications/gap/gaptest2.c
Modified:
   GNUnet/src/applications/advertising/Makefile.am
   GNUnet/src/applications/dht/tools/dhttest.c
   GNUnet/src/applications/dht/tools/dhttest2.c
   GNUnet/src/applications/fs/Makefile.am
   GNUnet/src/applications/fs/ecrs/directorytest.c
   GNUnet/src/applications/fs/ecrs/metatest.c
   GNUnet/src/applications/fs/ecrs/namespace.c
   GNUnet/src/applications/fs/ecrs_core_test.c
   GNUnet/src/applications/fs/fsui/fsuitest.c
   GNUnet/src/applications/gap/Makefile.am
   GNUnet/src/applications/gap/gaptest.c
   GNUnet/src/util/boot/startup.c
   GNUnet/src/util/getopt/printhelp.c
   GNUnet/todo
Log:
improved and extended set of testcases

Modified: GNUnet/src/applications/advertising/Makefile.am
===================================================================
--- GNUnet/src/applications/advertising/Makefile.am     2007-05-29 02:37:00 UTC 
(rev 4848)
+++ GNUnet/src/applications/advertising/Makefile.am     2007-05-29 03:22:17 UTC 
(rev 4849)
@@ -15,3 +15,22 @@
  $(top_builddir)/src/util/cron/libgnunetutil_cron.la
 libgnunetmodule_advertising_la_LDFLAGS = \
   -export-dynamic -avoid-version -module
+
+check_PROGRAMS = \
+  advertising_test
+
+TESTS = $(check_PROGRAMS)
+
+advertising_test_SOURCES = \
+  advertising_test.c 
+advertising_test_LDADD = \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la \
+  $(top_builddir)/src/applications/testing/libgnunettesting_api.la \
+  $(top_builddir)/src/util/config_impl/libgnunetutil_config.la \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+
+
+EXTRA_DIST = \
+  check.conf 

Added: GNUnet/src/applications/advertising/advertising_test.c
===================================================================
--- GNUnet/src/applications/advertising/advertising_test.c                      
        (rev 0)
+++ GNUnet/src/applications/advertising/advertising_test.c      2007-05-29 
03:22:17 UTC (rev 4849)
@@ -0,0 +1,136 @@
+/*
+     This file is part of GNUnet.
+     (C) 2007 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+     Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/advertising/advertising_test.c
+ * @brief testcase to show advertising works
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_testing_lib.h"
+#include "gnunet_stats_lib.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
+
+#define NUM_PEERS 12
+
+#define NUM_ROUNDS 30
+
+static int countConnections(const char * name,
+                           unsigned long long value,
+                           void * cls) {
+  int * num = cls;
+  if (0 == strcmp(_("# of connected peers"),
+                 name)) {
+    *num = value;
+    return SYSERR;
+  }
+  return OK;
+}
+
+#define CHECK(a) do { if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; } 
} while(0)
+
+/**
+ * Testcase to test advertising
+ * @return 0: ok, -1: error
+ */
+int main(int argc,
+        const char ** argv) {
+  struct DaemonContext * peers;
+  int ret = 0;
+  struct GE_Context * ectx;
+  struct GC_Configuration * cfg;
+  struct ClientServerConnection * sock;
+  int i;
+  int k;
+  int have;
+  int found;
+  char buf[128];
+  int min;
+ 
+  ectx = NULL;
+  cfg = GC_create_C_impl();
+  if (-1 == GC_parse_configuration(cfg,
+                                  "check.conf")) {
+    GC_free(cfg);
+    return -1;
+  }
+  peers = gnunet_testing_start_daemons("tcp",
+                                      "advertising stats",
+                                      "/tmp/gnunet-advertising-test",
+                                      2087,
+                                      10,
+                                      NUM_PEERS);
+  if (peers == NULL) {
+    GC_free(cfg);
+    return -1;
+  }
+  /* do circular connect */
+  for (i=0;i<NUM_PEERS;i++) {
+    if (OK != gnunet_testing_connect_daemons(2087 + 10*i,
+                                            2087 + 10* ( (i+1) % NUM_PEERS))) {
+      gnunet_testing_stop_daemons(peers);
+      fprintf(stderr,
+             "Failed to connect the peers!\n");
+      GC_free(cfg);
+      return -1;    
+    }
+  }
+
+  /* check loops */
+  for (k=0;k<NUM_ROUNDS;k++) {
+    found = 0;
+    min = NUM_PEERS;
+    for (i=0;i<NUM_PEERS;i++) {
+      SNPRINTF(buf,
+              128,
+              "localhost:%u",
+              2087 + i * 10);
+      GC_set_configuration_value_string(cfg,
+                                       ectx,
+                                       "NETWORK",
+                                       "HOST",
+                                       buf);
+      sock = client_connection_create(NULL,
+                                     cfg);
+      STATS_getStatistics(NULL,
+                         sock,
+                         &countConnections,
+                         &have);
+      connection_destroy(sock);
+      found += have;
+      if (have < min)
+       min = have;
+    }
+    fprintf(stderr,
+           "Have %d connections total in round %d, minimum number was %d\n",
+           found, 
+           k,
+           min);
+    PTHREAD_SLEEP(15 * cronSECONDS);
+  }
+  gnunet_testing_stop_daemons(peers);
+  GC_free(cfg);
+  return ret;
+}
+
+/* end of dhttest.c */


Property changes on: GNUnet/src/applications/advertising/advertising_test.c
___________________________________________________________________
Name: svn:eol-style
   + native

Added: GNUnet/src/applications/advertising/check.conf
===================================================================
--- GNUnet/src/applications/advertising/check.conf                              
(rev 0)
+++ GNUnet/src/applications/advertising/check.conf      2007-05-29 03:22:17 UTC 
(rev 4849)
@@ -0,0 +1,11 @@
+# General settings
+[GNUNET]
+GNUNET_HOME = "/tmp/gnunet-dht-test-driver"
+LOGLEVEL = "WARNING"
+LOGFILE = ""
+PROCESS-PRIORITY = "NORMAL"
+
+# Network options for the clients
+[NETWORK]
+HOST = "localhost:2087"
+

Modified: GNUnet/src/applications/dht/tools/dhttest.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest.c 2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/dht/tools/dhttest.c 2007-05-29 03:22:17 UTC (rev 
4849)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2005, 2006, 2007 Christian Grothoff (and other contributing authors)
+     (C) 2007 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
@@ -54,7 +54,7 @@
 #define CHECK(a) do { if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; } 
} while(0)
 
 /**
- * Testcase to test gap routing (2 peers only).
+ * Testcase to test DHT routing (many peers).
  * @return 0: ok, -1: error
  */
 int main(int argc,
@@ -148,7 +148,7 @@
                            ectx,
                            &key,
                            DHT_STRING2STRING_BLOCK,
-                           get_time() + 15 * cronMINUTES,
+                           get_time() + 15 * cronMINUTES * NUM_ROUNDS * 
NUM_PEERS * NUM_PEERS,
                            value));
   }
 
@@ -177,7 +177,7 @@
                            ectx,
                            DHT_STRING2STRING_BLOCK,
                             &key,
-                           5 * cronSECONDS,
+                           (NUM_ROUNDS - k) * cronSECONDS,
                            NULL,
                            NULL)) {
          fprintf(stderr,

Modified: GNUnet/src/applications/dht/tools/dhttest2.c
===================================================================
--- GNUnet/src/applications/dht/tools/dhttest2.c        2007-05-29 02:37:00 UTC 
(rev 4848)
+++ GNUnet/src/applications/dht/tools/dhttest2.c        2007-05-29 03:22:17 UTC 
(rev 4849)
@@ -54,7 +54,7 @@
 #define CHECK(a) do { if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; } 
} while(0)
 
 /**
- * Testcase to test gap routing (2 peers only).
+ * Testcase to test DHT routing (2 peers only).
  * @return 0: ok, -1: error
  */
 int main(int argc,

Modified: GNUnet/src/applications/fs/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/Makefile.am      2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/fs/Makefile.am      2007-05-29 03:22:17 UTC (rev 
4849)
@@ -20,6 +20,7 @@
 ecrs_core_test_SOURCES = \
   ecrs_core_test.c 
 ecrs_core_test_LDADD = \
+  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
   $(top_builddir)/src/util/config_impl/libgnunetutil_config.la \
   $(top_builddir)/src/applications/fs/libecrs_core.la 
 

Modified: GNUnet/src/applications/fs/ecrs/directorytest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/directorytest.c     2007-05-29 02:37:00 UTC 
(rev 4848)
+++ GNUnet/src/applications/fs/ecrs/directorytest.c     2007-05-29 03:22:17 UTC 
(rev 4849)
@@ -138,6 +138,7 @@
     goto END;
   }
  END:
+  FREE(data);
   ECRS_freeMetaData(meta);
   ECRS_freeMetaData(meta2);
   for (p=0;p<i;p++) {

Modified: GNUnet/src/applications/fs/ecrs/metatest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/metatest.c  2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/fs/ecrs/metatest.c  2007-05-29 03:22:17 UTC (rev 
4849)
@@ -84,8 +84,10 @@
             j);
     if (OK != ECRS_addToMetaData(m,
                                 EXTRACTOR_UNKNOWN,
-                                val))
+                                val)) {
+      FREE(val);
       ABORT(m);
+    }
   }
   FREE(val);
   if (i != ECRS_getMetaData(m, NULL, NULL))

Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2007-05-29 03:22:17 UTC (rev 
4849)
@@ -233,6 +233,7 @@
                       &nb->identifier,
                       &nb->signature));
   if (OK != FS_insert(sock, value)) {
+    GE_BREAK(ectx, 0);
     FREE(rootURI);
     FREE(value);
     connection_destroy(sock);

Modified: GNUnet/src/applications/fs/ecrs_core_test.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core_test.c 2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/fs/ecrs_core_test.c 2007-05-29 03:22:17 UTC (rev 
4849)
@@ -25,12 +25,44 @@
  */
 
 #include "platform.h"
-#include <extractor.h>
 #include "ecrs_core.h"
+#include "gnunet_protocols.h"
 
-#define CHECK(a) { if (! (a)) { fprintf(stderr, "Error at %s:%d\n", __FILE__, 
__LINE__); return 1; } }
+#define CHECK(a,b) { if (! (a)) { fprintf(stderr, "Error at %s:%d\n", 
__FILE__, __LINE__); FREENONNULL(b); return 1; } }
 
 static int testEC() {
+  DBlock * data;
+  Datastore_Value * value;
+  HashCode512 query;
+  HashCode512 key;
+  unsigned int len;
+  
+  len = sizeof(DBlock) + 42;
+  data = MALLOC(len);
+  memset(&data[1], rand(), len - sizeof(DBlock));
+  data->type = htonl(D_BLOCK);
+  CHECK(D_BLOCK == getTypeOfBlock(len,
+                                 data), 
+       data);
+  fileBlockGetKey(data, len, &key);
+  fileBlockGetQuery(data, len, &query);
+  CHECK(OK == fileBlockEncode(data, 
+                             len,
+                             &query,
+                             &value),
+       data);
+  memcpy(data,
+        &value[1],
+        len);
+  FREE(value);
+  CHECK(YES == isDatumApplicable(D_BLOCK,
+                                len,
+                                data,
+                                &query,
+                                1,
+                                &query),
+       data);
+  FREE(data);
   return 0;
 }
 

Modified: GNUnet/src/applications/fs/fsui/fsuitest.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest.c  2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/fs/fsui/fsuitest.c  2007-05-29 03:22:17 UTC (rev 
4849)
@@ -222,6 +222,9 @@
     if (GNUNET_SHUTDOWN_TEST() == YES)
       break;
   }
+  if (lastEvent != FSUI_unindex_completed) 
+    FSUI_abortUnindex(ctx, unindex);
+  FSUI_stopUnindex(ctx, unindex);
 
 
   /* END OF TEST CODE */

Modified: GNUnet/src/applications/gap/Makefile.am
===================================================================
--- GNUnet/src/applications/gap/Makefile.am     2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/gap/Makefile.am     2007-05-29 03:22:17 UTC (rev 
4849)
@@ -21,7 +21,7 @@
 
 
 check_PROGRAMS = \
-  gaptest 
+  gaptest gaptest2
 
 TESTS = $(check_PROGRAMS)
 
@@ -37,5 +37,17 @@
   $(top_builddir)/src/util/libgnunetutil.la 
 
 
+gaptest2_SOURCES = \
+  gaptest2.c 
+gaptest2_LDADD = \
+  $(top_builddir)/src/applications/testing/libgnunettesting_api.la \
+  $(top_builddir)/src/applications/stats/libgnunetstats_api.la \
+  $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+  $(top_builddir)/src/util/config_impl/libgnunetutil_config.la  \
+  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la  \
+  $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la  \
+  $(top_builddir)/src/util/libgnunetutil.la 
+
+
 EXTRA_DIST = \
   check.conf

Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c       2007-05-29 02:37:00 UTC (rev 
4848)
+++ GNUnet/src/applications/gap/gaptest.c       2007-05-29 03:22:17 UTC (rev 
4849)
@@ -34,9 +34,6 @@
 #include "gnunet_util_network_client.h"
 #include "gnunet_stats_lib.h"
 
-static PeerIdentity peer1;
-static PeerIdentity peer2;
-
 static struct GE_Context * ectx;
 
 static struct GC_Configuration * cfg;
@@ -272,8 +269,6 @@
     return -1;
   }
 #endif
-  peer1 = peers->peer;
-  peer2 = peers->next->peer;
   if (OK != gnunet_testing_connect_daemons(2087,
                                           12087)) {
     gnunet_testing_stop_daemons(peers);

Added: GNUnet/src/applications/gap/gaptest2.c
===================================================================
--- GNUnet/src/applications/gap/gaptest2.c                              (rev 0)
+++ GNUnet/src/applications/gap/gaptest2.c      2007-05-29 03:22:17 UTC (rev 
4849)
@@ -0,0 +1,317 @@
+/*
+     This file is part of GNUnet.
+     (C) 2005, 2006, 2007 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
+     by the Free Software Foundation; either version 2, or (at your
+     option) any later version.
+
+     GNUnet is distributed in the hope that it will be useful, but
+     WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+     General Public License for more details.
+
+     You should have received a copy of the GNU General Public License
+     along with GNUnet; see the file COPYING.  If not, write to the
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
+*/
+
+/**
+ * @file applications/gap/gaptest.c
+ * @brief GAP routing testcase
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_protocols.h"
+#include "gnunet_ecrs_lib.h"
+#include "gnunet_testing_lib.h"
+#include "gnunet_stats_lib.h"
+#include "gnunet_util_crypto.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
+#include "gnunet_stats_lib.h"
+
+static struct GE_Context * ectx;
+
+static struct GC_Configuration * cfg;
+
+static int testTerminate(void * unused) {
+  return OK;
+}
+
+static char * makeName(unsigned int i) {
+  char * fn;
+
+  fn = MALLOC(strlen("/tmp/gnunet-gaptest/GAPTEST") + 14);
+  SNPRINTF(fn,
+          strlen("/tmp/gnunet-gaptest/GAPTEST") + 14,
+          "/tmp/gnunet-gaptest/GAPTEST%u",
+          i);
+  disk_directory_create_for_file(NULL, fn);
+  return fn;
+}
+
+static struct ECRS_URI * uploadFile(unsigned int size) {
+  int ret;
+  char * name;
+  int fd;
+  char * buf;
+  struct ECRS_URI * uri;
+  int i;
+
+  name = makeName(size);
+  fd = disk_file_open(ectx,
+                     name,
+                     O_WRONLY|O_CREAT, S_IWUSR|S_IRUSR);
+  buf = MALLOC(size);
+  memset(buf, size + size / 253, size);
+  for (i=0;i<(int) (size - 42 - sizeof(HashCode512));i+=sizeof(HashCode512))
+    hash(&buf[i+sizeof(HashCode512)],
+        42,
+        (HashCode512*) &buf[i]);
+  WRITE(fd, buf, size);
+  FREE(buf);
+  disk_file_close(ectx, name, fd);
+  ret = ECRS_uploadFile(ectx,
+                       cfg,
+                       name,
+                       YES, /* index */
+                       0, /* anon */
+                       0, /* prio */
+                       get_time() + 10 * cronMINUTES, /* expire */
+                       NULL, /* progress */
+                       NULL,
+                       &testTerminate,
+                       NULL,
+                       &uri);
+  if (ret != SYSERR) {
+    struct ECRS_MetaData * meta;
+    struct ECRS_URI * key;
+    const char * keywords[2];
+
+    keywords[0] = name;
+    keywords[1] = NULL;
+
+    meta = ECRS_createMetaData();
+    key = ECRS_keywordsToUri(keywords);
+    ret = ECRS_addToKeyspace(ectx,
+                            cfg,
+                            key,
+                            0,
+                            0,
+                            get_time() + 10 * cronMINUTES, /* expire */
+                            uri,
+                            meta);
+    ECRS_freeMetaData(meta);
+    ECRS_freeUri(uri);
+    FREE(name);
+    if (ret == OK) {
+      return key;
+    } else {
+      ECRS_freeUri(key);
+      return NULL;
+    }
+  } else {
+    FREE(name);
+    return NULL;
+  }
+}
+
+static int searchCB(const ECRS_FileInfo * fi,
+                   const HashCode512 * key,
+                   int isRoot,
+                   void * closure) {
+  struct ECRS_URI ** my = closure;
+  char * tmp;
+
+  tmp = ECRS_uriToString(fi->uri);
+  GE_LOG(ectx, GE_DEBUG | GE_REQUEST | GE_USER,
+      "Search found URI `%s'\n",
+      tmp);
+  FREE(tmp);
+  GE_ASSERT(ectx, NULL == *my);
+  *my = ECRS_dupUri(fi->uri);
+  return SYSERR; /* abort search */
+}
+
+/**
+ * @param *uri In: keyword URI, out: file URI
+ * @return OK on success
+ */
+static int searchFile(struct ECRS_URI ** uri) {
+  int ret;
+  struct ECRS_URI * myURI;
+
+  myURI = NULL;
+  ret = ECRS_search(ectx,
+                   cfg,
+                   *uri,
+                   0,
+                   15 * cronSECONDS,
+                   &searchCB,
+                   &myURI,
+                   &testTerminate,
+                   NULL);
+  ECRS_freeUri(*uri);
+  *uri = myURI;
+  if ( (ret != SYSERR) &&
+       (myURI != NULL) )
+    return OK;
+  else
+    return SYSERR;
+}
+
+static int downloadFile(unsigned int size,
+                       const struct ECRS_URI * uri) {
+  int ret;
+  char * tmpName;
+  int fd;
+  char * buf;
+  char * in;
+  int i;
+  char * tmp;
+
+  tmp = ECRS_uriToString(uri);
+  GE_LOG(ectx,
+        GE_DEBUG | GE_REQUEST | GE_USER,
+        "Starting download of `%s'\n",
+        tmp);
+  FREE(tmp);
+  tmpName = makeName(0);
+  ret = SYSERR;
+  if (OK == ECRS_downloadFile(ectx,
+                             cfg,
+                             uri,
+                             tmpName,
+                             0,
+                             NULL,
+                             NULL,
+                             &testTerminate,
+                             NULL)) {
+
+    fd = disk_file_open(ectx,
+                       tmpName,
+                       O_RDONLY);
+    buf = MALLOC(size);
+    in = MALLOC(size);
+    memset(buf, size + size / 253, size);
+    for (i=0;i<(int) (size - 42 - sizeof(HashCode512));i+=sizeof(HashCode512))
+      hash(&buf[i+sizeof(HashCode512)],
+          42,
+          (HashCode512*) &buf[i]);
+    if (size != READ(fd, in, size))
+      ret = SYSERR;
+    else if (0 == memcmp(buf,
+                        in,
+                        size))
+      ret = OK;
+    FREE(buf);
+    FREE(in);
+    disk_file_close(ectx, tmpName, fd);
+  }
+  UNLINK(tmpName);
+  FREE(tmpName);
+  return ret;
+}
+
+static int unindexFile(unsigned int size) {
+  int ret;
+  char * name;
+
+  name = makeName(size);
+  ret = ECRS_unindexFile(ectx,
+                        cfg,
+                        name,
+                        NULL,
+                        NULL,
+                        &testTerminate,
+                        NULL);
+  if (0 != UNLINK(name))
+    ret = SYSERR;
+  FREE(name);
+  return ret;
+}
+
+#define CHECK(a) if (!(a)) { ret = 1; GE_BREAK(ectx, 0); goto FAILURE; }
+
+#define START_PEERS 1
+
+/**
+ * Testcase to test gap routing (2 peers only).
+ * @return 0: ok, -1: error
+ */
+int main(int argc, char ** argv) {
+  struct DaemonContext * peers;
+  int ret;
+  struct ECRS_URI * uri;
+
+  ret = 0;
+  cfg = GC_create_C_impl();
+  if (-1 == GC_parse_configuration(cfg,
+                                  "check.conf")) {
+    GC_free(cfg);
+    return -1;
+  }
+#if START_PEERS
+  peers = gnunet_testing_start_daemons("tcp",
+                                      "advertising topology fs stats",
+                                      "/tmp/gnunet-gap-test",
+                                      2087,
+                                      5000,
+                                      8);
+  if (peers == NULL) {
+    fprintf(stderr,
+           "Failed to start the gnunetd daemons!\n");
+    GC_free(cfg);
+    return -1;
+  }
+#endif
+  if ( (OK != gnunet_testing_connect_daemons(2087,
+                                            7087)) ||
+       (OK != gnunet_testing_connect_daemons(7087,
+                                            12087)) ||
+       (OK != gnunet_testing_connect_daemons(12087, 
+                                            17087)) || 
+       (OK != gnunet_testing_connect_daemons(17087, 
+                                            22087)) || 
+       (OK != gnunet_testing_connect_daemons(22087, 
+                                            27087)) || 
+       (OK != gnunet_testing_connect_daemons(27087,
+                                            32087)) ) {
+    gnunet_testing_stop_daemons(peers);
+    fprintf(stderr,
+           "Failed to connect the peers!\n");
+    GC_free(cfg);
+    return -1;
+  }
+
+  uri = uploadFile(12345);
+  CHECK(NULL != uri);
+  GC_set_configuration_value_string(cfg,
+                                   ectx,
+                                   "NETWORK",
+                                   "HOSTNAME",
+                                   "localhost:32087");
+  CHECK(OK == searchFile(&uri));
+  CHECK(OK == downloadFile(12345, uri));
+  ECRS_freeUri(uri);
+  GC_set_configuration_value_string(cfg,
+                                   ectx,
+                                   "NETWORK",
+                                   "HOSTNAME",
+                                   "localhost:2087");
+  CHECK(OK == unindexFile(12345));
+
+ FAILURE:
+#if START_PEERS
+  gnunet_testing_stop_daemons(peers);
+#endif
+
+  GC_free(cfg);
+  return ret;
+}
+
+/* end of gaptest2.c */


Property changes on: GNUnet/src/applications/gap/gaptest2.c
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: GNUnet/src/util/boot/startup.c
===================================================================
--- GNUnet/src/util/boot/startup.c      2007-05-29 02:37:00 UTC (rev 4848)
+++ GNUnet/src/util/boot/startup.c      2007-05-29 03:22:17 UTC (rev 4849)
@@ -188,7 +188,8 @@
     SNPRINTF(run,
             max,
             "gnunet-setup -c %s generate-defaults");
-    if (0 != system(run)) 
+    ret = system(run);
+    if (0 != ret) 
       GE_LOG(*ectx,
             GE_ERROR | GE_USER | GE_IMMEDIATE,
             _("Failed to run %s: %s %d\n"),

Modified: GNUnet/src/util/getopt/printhelp.c
===================================================================
--- GNUnet/src/util/getopt/printhelp.c  2007-05-29 02:37:00 UTC (rev 4848)
+++ GNUnet/src/util/getopt/printhelp.c  2007-05-29 03:22:17 UTC (rev 4849)
@@ -27,7 +27,6 @@
 #include "gnunet_util_string.h"
 #include "gnunet_util_getopt.h"
 #include "platform.h"
-#include <ctype.h>
 
 #define BORDER 29
 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2007-05-29 02:37:00 UTC (rev 4848)
+++ GNUnet/todo 2007-05-29 03:22:17 UTC (rev 4849)
@@ -16,9 +16,7 @@
   * XFS -- TEST more! [RC] 
   * HTTP transport (libcurl, libmicrohttpd)
 - testcases (fix, add):
-  * ecrs_core -- implement actual testcase, harness is there! [RC]
   * gap (incl. economy) [RC]
-  * advertising [RC]
 
 
 0.7.3 [6'07] (aka "features"):





reply via email to

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