gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r414 - in GNUnet: . src/applications/fs/lib
Date: Tue, 8 Mar 2005 05:38:55 -0800 (PST)

Author: grothoff
Date: 2005-03-08 05:38:54 -0800 (Tue, 08 Mar 2005)
New Revision: 414

Modified:
   GNUnet/src/applications/fs/lib/fslibtest.c
   GNUnet/todo
Log:
fslib multiple results test

Modified: GNUnet/src/applications/fs/lib/fslibtest.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslibtest.c  2005-03-08 12:46:18 UTC (rev 
413)
+++ GNUnet/src/applications/fs/lib/fslibtest.c  2005-03-08 13:38:54 UTC (rev 
414)
@@ -1,3 +1,22 @@
+/*
+     This file is part of GNUnet.
+     (C) 2004, 2005 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/fs/lib/fslibtest.c
  * @brief testcase for fslib
@@ -49,6 +68,41 @@
   return block;
 }
 
+static Datastore_Value * makeKBlock(unsigned int i,
+                                   const HashCode512 * key,
+                                   HashCode512 * query) {
+  Datastore_Value * block;
+  KBlock * db;
+  struct PrivateKey * kkey;
+
+  block = MALLOC(sizeof(Datastore_Value) +
+                sizeof(KBlock) + i);
+  block->size = htonl(sizeof(Datastore_Value) +
+                     sizeof(KBlock) + i);
+  block->type = htonl(K_BLOCK);
+  block->prio = htonl(0);
+  block->anonymityLevel = htonl(0);
+  block->expirationTime = htonll(now + 1 * cronHOURS);
+  db = (KBlock*) &block[1];
+  db->type = htonl(K_BLOCK);
+  memset(&db[1],
+        i + (i /253),
+        i);
+  kkey = makeKblockKey(key);
+  sign(kkey,
+       i,
+       &db[1],
+       &db->signature);
+  getPublicKey(kkey,
+              &db->keyspace);
+  hash(&db->keyspace,
+       sizeof(PublicKey),
+       query);
+  freePrivateKey(kkey);  
+  return block;
+}
+
+
 typedef struct {
   Semaphore * sem;
   int found; 
@@ -59,6 +113,18 @@
   SEMAPHORE_UP(sem);
 }
 
+/**
+ * Search result callback that just counts down
+ * a counter.
+ */
+static int countCallback(const HashCode512 * key,
+                        const Datastore_Value * value,
+                        int * cnt) {
+  (*cnt)--;
+  return OK;
+}
+
+
 static int searchResultCB(const HashCode512 * key,
                          const Datastore_Value * value,
                          TSC * cls) {
@@ -146,6 +212,7 @@
   int status;
   int ok;
   struct FS_SEARCH_CONTEXT * ctx;
+  struct FS_SEARCH_HANDLE * hnd;
   Mutex lock;
   GNUNET_TCP_SOCKET * sock;
   Datastore_Value * block;
@@ -163,8 +230,6 @@
     if (0 != execlp("gnunetd", /* what binary to execute, must be in $PATH! */
                    "gnunetd", /* arg0, path to gnunet binary */
                    "-d",  /* do not daemonize so we can easily kill you */
-                   "-L", 
-                   "NOTHING",  /* gnunetd loglevel */
                    "-c",
                    "check.conf", /* configuration file */
                    NULL)) {
@@ -184,7 +249,7 @@
   CHECK(sock != NULL);
   ctx = FS_SEARCH_makeContext(&lock);
   CHECK(ctx != NULL);
-  
+
   /* ACTUAL TEST CODE */
   for (i=1;i<32;i++) {
     block = makeBlock(i);
@@ -243,6 +308,32 @@
     FREE(block);
   }
 
+  /* multiple search results test */
+  makeRandomId(&hc);
+  block = makeKBlock(40, &hc, &query);
+  CHECK(OK == FS_insert(sock,
+                       block));
+  FREE(block);
+  block = makeKBlock(60, &hc, &query);
+  CHECK(OK == FS_insert(sock,
+                       block));
+  FREE(block);
+  i = 2;
+  hnd = FS_start_search(ctx,
+                       ANY_BLOCK,
+                       1,
+                       &query,
+                       0,
+                       0,
+                       10 * cronSECONDS,
+                       (Datum_Iterator) &countCallback,
+                       &i);
+  CHECK(hnd != NULL);
+  gnunet_util_sleep(10 * cronSECONDS);
+  FS_stop_search(ctx, hnd);
+  CHECK(i == 0);
+                
+
   /* just to check if it crashes... */
   FS_getAveragePriority(sock);
 

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-08 12:46:18 UTC (rev 413)
+++ GNUnet/todo 2005-03-08 13:38:54 UTC (rev 414)
@@ -6,23 +6,21 @@
 - 593??? [ gnunet-setup ]
 
 0.7.0pre1 [4'05] (aka "preview"):
-- testing:
-  * tbench:
-    + CAN TEST: http transport (after MTU change)
-  * sqlite-tests: test concurrency with iterators
+- uni-peer testing:
+  * sqlite: test concurrency with iterators
   * gnunet-pseudonym
-  * gnunet-search: multiple search results don't work (yet); test on FSLIB and 
ECRS levels!
+  * gnunet-search: multiple search results don't work (yet); test on ECRS 
level!
+- multi-peer testing: (see sessiontest.c and tbenchtest.c for templates)
+  * gap
+  * dht / gnunet-dht-join and gnunet-dht-query 
+  * fs
 - FSUI:
   * download: various details wrt generated events
   * namespace updates
   * collections
   * testing
-- multi-peer testing: (see sessiontest.c and tbenchtest.c for templates)
-  * gap
-  * dht / gnunet-dht-join and gnunet-dht-query 
-  * fs
 - transport refactoring:
-  * UPDATE: HTTP: MTU change!
+  * HTTP: MTU change! => test with tbench!
   * port knocking support? [ tricky ]
 - UI features:
   * date feature (Mantis #789)
@@ -38,7 +36,7 @@
   * fsui download: limit parallelism (currently unlimited, old gnunet-download 
allowed
     user to specify maximum amount of parallelism) [ tricky ]
 - Need testing:
-  * gnunet-tracekit, -tbench, -chat
+  * gnunet-tracekit
 - Documentation changes (to be documented):
   * ECRS block format changes (dramatic!)
   * gnunet-directory (no more categories) and gnunet-pseudonym (no passwords)





reply via email to

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