gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3330 - in GNUnet: . src/applications/fs/lib


From: grothoff
Subject: [GNUnet-SVN] r3330 - in GNUnet: . src/applications/fs/lib
Date: Sat, 26 Aug 2006 22:04:50 -0700 (PDT)

Author: grothoff
Date: 2006-08-26 22:04:46 -0700 (Sat, 26 Aug 2006)
New Revision: 3330

Added:
   GNUnet/src/applications/fs/lib/peer.conf
Modified:
   GNUnet/src/applications/fs/lib/Makefile.am
   GNUnet/src/applications/fs/lib/check.conf
   GNUnet/src/applications/fs/lib/fslibtest.c
   GNUnet/todo
Log:
making fs/lib test compile

Modified: GNUnet/src/applications/fs/lib/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/lib/Makefile.am  2006-08-27 04:52:20 UTC (rev 
3329)
+++ GNUnet/src/applications/fs/lib/Makefile.am  2006-08-27 05:04:46 UTC (rev 
3330)
@@ -19,7 +19,12 @@
   fslibtest.c
 fslibtest_LDADD = \
   $(top_builddir)/src/applications/fs/lib/libgnunetfs.la \
+  $(top_builddir)/src/util/cron/libgnunetutil_cron.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
+  check.conf \
+  peer.conf

Modified: GNUnet/src/applications/fs/lib/check.conf
===================================================================
--- GNUnet/src/applications/fs/lib/check.conf   2006-08-27 04:52:20 UTC (rev 
3329)
+++ GNUnet/src/applications/fs/lib/check.conf   2006-08-27 05:04:46 UTC (rev 
3330)
@@ -1,52 +1,12 @@
-# This is the configuration for the GNUnet daemon when running
-# the test in this directory (make check).
+# General settings
+[GNUNET]
+GNUNET_HOME = "/tmp/gnunet-session-test-driver"
+LOGLEVEL = "WARNING"
+LOGFILE = ""
+PROCESS-PRIORITY = "NORMAL"
 
-[GNUNETD]
-GNUNETD_HOME     = /tmp/gnunet-check-fslib
-VALGRIND        = 300
-HELLOEXPIRES     = 60
-LOGLEVEL        = ERROR
-LOGFILE         = $GNUNETD_HOME/logs
-KEEPLOG         = 0
-PIDFILE         = $GNUNETD_HOME/gnunetd.pid
-HOSTS          = $GNUNETD_HOME/data/hosts/
-APPLICATIONS = "fs stats"
-# TRANSPORTS = -- no transports!
-
-[MODULES]
-sqstore = "sqstore_sqlite"
-# you can also use sqstore_mysql here if 
-# that DB is available...
-topology = "topology_default"
-
+# Network options for the clients
 [NETWORK]
-PORT = 2087
-INTERFACE = eth0
-HELOEXCHANGE = NO
-TRUSTED = 127.0.0.0/8;
+CLIENT-PORT = 2087
+HOST = "localhost"
 
-[LOAD]
-INTERFACES      = eth0
-BASICLIMITING = YES
-MAXNETUPBPSTOTAL       = 50000
-MAXNETDOWNBPSTOTAL     = 50000
-MAXCPULOAD             = 100
-
-[FS]
-QUOTA  = 1024
-ACTIVEMIGRATION = NO
-DIR          = /tmp/gnunet-fslib-test/
-INDEX-DIRECTORY = $GNUNETD_HOME/data/shared/
-INDEX-QUOTA = 8192
-
-[MYSQL]
-DELAYED = NO
-DATABASE = gnunetcheck
-
-[GAP]
-TABLESIZE = 65536
-
-[DHT]
-BUCKETCOUNT = 160
-MASTER-TABLE-SIZE = 65536
-

Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c  2006-08-27 04:52:20 UTC (rev 
3329)
+++ GNUnet/src/applications/fs/lib/fslibtest.c  2006-08-27 05:04:46 UTC (rev 
3330)
@@ -25,28 +25,16 @@
 
 #include "platform.h"
 #include "gnunet_util.h"
+#include "gnunet_util_cron.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
 #include "gnunet_fs_lib.h"
 #include "gnunet_protocols.h"
 #include "ecrs_core.h"
 
-#define CHECK(a) if (!(a)) { ok = NO; GE_BREAK(ectx, 0); goto FAILURE; }
+#define CHECK(a) if (!(a)) { ok = NO; GE_BREAK(NULL, 0); goto FAILURE; }
 
-static int parseCommandLine(int argc,
-                           char * argv[]) {
-  FREENONNULL(setConfigurationString("GNUNETD",
-                                    "_MAGIC_",
-                                    "NO"));
-  FREENONNULL(setConfigurationString("GNUNETD",
-                                    "LOGFILE",
-                                    NULL));
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "LOGLEVEL",
-                                    "ERROR"));
-  FREENONNULL(setConfigurationString("GNUNET",
-                                    "GNUNETD-CONFIG",
-                                    "check.conf"));
-  return OK;
-}
+static struct CronManager * cron;
 
 static cron_t now;
 
@@ -106,12 +94,13 @@
 
 
 typedef struct {
-  Semaphore * sem;
+  struct SEMAPHORE * sem;
   int found;
   int i;
 } TSC;
 
-static void abortSem(Semaphore * sem) {
+static void abortSem(void * cls) {
+  struct SEMAPHORE * sem = cls;
   SEMAPHORE_UP(sem);
 }
 
@@ -143,11 +132,11 @@
   fileBlockGetQuery((DBlock*) &blk[1],
                    ntohl(blk->size) - sizeof(Datastore_Value),
                    &ekey);
-  GE_ASSERT(ectx, OK ==
-               fileBlockEncode((DBlock*) &blk[1],
-                               ntohl(blk->size) - sizeof(Datastore_Value),
-                               &ekey,
-                               &eblk));
+  GE_ASSERT(NULL, OK ==
+           fileBlockEncode((DBlock*) &blk[1],
+                           ntohl(blk->size) - sizeof(Datastore_Value),
+                           &ekey,
+                           &eblk));
   if ( (equalsHashCode512(&ekey,
                          key)) &&
        (value->size == blk->size) &&
@@ -158,7 +147,7 @@
     SEMAPHORE_UP(cls->sem);
     ret = SYSERR;
   } else {
-    GE_BREAK(ectx, 0);
+    GE_BREAK(NULL, 0);
     printf("Received unexpected result.\n");
     ret = OK;
   }
@@ -195,16 +184,18 @@
                           now + 30 * cronSECONDS,
                           (Datum_Iterator)&searchResultCB,
                           &closure);
-  addCronJob((CronJob) &abortSem,
-            30 * cronSECONDS,
-            0,
-            closure.sem);
-  SEMAPHORE_DOWN(closure.sem);
+  cron_add_job(cron,
+              &abortSem,
+              30 * cronSECONDS,
+              0,
+              closure.sem);
+  SEMAPHORE_DOWN(closure.sem, YES);
   FS_stop_search(ctx,
                 handle);
-  suspendCron();
-  delCronJob((CronJob) &abortSem, 0, closure.sem);
-  resumeCron();
+  cron_suspend(cron, NO);
+  cron_del_job(cron,
+              &abortSem, 0, closure.sem);
+  cron_resume_jobs(cron, NO);
   SEMAPHORE_DESTROY(closure.sem);
   return closure.found;
 }
@@ -215,7 +206,7 @@
   int ok;
   struct FS_SEARCH_CONTEXT * ctx = NULL;
   struct FS_SEARCH_HANDLE * hnd;
-  Mutex lock;
+  struct MUTEX * lock;
   struct ClientServerConnection * sock;
   Datastore_Value * block;
   Datastore_Value * eblock;
@@ -224,22 +215,34 @@
   int i;
   char * tmpName;
   int fd;
+  struct GC_Configuration * cfg;
 
+  cfg = GC_create_C_impl();
+  if (-1 == GC_parse_configuration(cfg,
+                                  "check.conf")) {
+    GC_free(cfg);
+    return -1;  
+  }
   now = get_time();
-  if (OK != initUtil(argc,
-                    argv,
-                    &parseCommandLine))
-    return -1;
-  daemon = startGNUnetDaemon(NO);
-  GE_ASSERT(ectx, daemon > 0);
+  cron = cron_create(NULL);
+  daemon = os_daemon_start(NULL,
+                          cfg,
+                          "peer.conf",
+                          NO);
+  GE_ASSERT(NULL, daemon > 0);
   ok = YES;
-  startCron();
-  MUTEX_CREATE(&lock);
-  GE_ASSERT(ectx, OK == waitForGNUnetDaemonRunning(60 * cronSECONDS));
+  cron_start(cron);
+  lock = MUTEX_CREATE(NO);
+  GE_ASSERT(NULL, 
+           OK == connection_wait_for_running(NULL,
+                                             cfg,
+                                             60 * cronSECONDS));
   PTHREAD_SLEEP(5 * cronSECONDS); /* give apps time to start */
-  sock = getClientSocket();
+  sock = client_connection_create(NULL, cfg);
   CHECK(sock != NULL);
-  ctx = FS_SEARCH_makeContext(&lock);
+  ctx = FS_SEARCH_makeContext(NULL,
+                             cfg,
+                             lock);
   CHECK(ctx != NULL);
 
   /* ACTUAL TEST CODE */
@@ -276,7 +279,7 @@
     CHECK(-1 != WRITE(fd,
                      &((DBlock*)&block[1])[1],
                      ntohl(block->size) - sizeof(Datastore_Value) - 
sizeof(DBlock)));
-    closefile(fd);
+    CLOSE(fd);
     CHECK(FS_initIndex(sock,
                       &hc,
                       tmpName) == YES);
@@ -355,11 +358,10 @@
     FS_SEARCH_destroyContext(ctx);
   if (sock != NULL)
     connection_destroy(sock);
-  MUTEX_DESTROY(&lock);
-  stopCron();
-  GE_ASSERT(ectx, OK == stopGNUnetDaemon());
-  GE_ASSERT(ectx, OK == waitForGNUnetDaemonTermination(daemon));
-  doneUtil();
+  MUTEX_DESTROY(lock);
+  cron_stop(cron);
+  cron_destroy(cron);
+  GE_ASSERT(NULL, OK == os_daemon_stop(NULL, daemon));
   return (ok == YES) ? 0 : 1;
 }
 

Copied: GNUnet/src/applications/fs/lib/peer.conf (from rev 3322, 
GNUnet/src/applications/fs/lib/check.conf)

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-08-27 04:52:20 UTC (rev 3329)
+++ GNUnet/todo 2006-08-27 05:04:46 UTC (rev 3330)
@@ -20,10 +20,10 @@
     + use new loggers in for CS error reporting
   * make testcases compile & pass again:
     + util/network_client/ 
+    + fs/lib -- compiles, but fails!
     + session -- compiles, but fails!
     + gap
     + fs/ecrs
-    + fs/lib
     + fs/namespace
     + fs/fsui
     + kvstore_sqlite      





reply via email to

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