gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3947 - GNUnet/src/applications/fs/collection


From: grothoff
Subject: [GNUnet-SVN] r3947 - GNUnet/src/applications/fs/collection
Date: Sat, 16 Dec 2006 18:15:18 -0800 (PST)

Author: grothoff
Date: 2006-12-16 18:15:15 -0800 (Sat, 16 Dec 2006)
New Revision: 3947

Added:
   GNUnet/src/applications/fs/collection/check.conf
   GNUnet/src/applications/fs/collection/collectiontest.c
   GNUnet/src/applications/fs/collection/peer.conf
Modified:
   GNUnet/src/applications/fs/collection/Makefile.am
Log:
additional testcase

Modified: GNUnet/src/applications/fs/collection/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/collection/Makefile.am   2006-12-17 02:02:10 UTC 
(rev 3946)
+++ GNUnet/src/applications/fs/collection/Makefile.am   2006-12-17 02:15:15 UTC 
(rev 3947)
@@ -11,6 +11,17 @@
  $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \
  $(top_builddir)/src/util/libgnunetutil.la 
 
+check_PROGRAMS = \
+  collectiontest 
 
+TESTS = $(check_PROGRAMS)
 
+collectiontest_SOURCES = \
+  collectiontest.c 
+collectiontest_LDADD = \
+  $(top_builddir)/src/util/config_impl/libgnunetutil_config.la  \
+  $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la  \
+  $(top_builddir)/src/applications/fs/collection/libgnunetcollection.la 
 
+EXTRA_DIST = \
+  check.conf peer.conf

Added: GNUnet/src/applications/fs/collection/check.conf
===================================================================
--- GNUnet/src/applications/fs/collection/check.conf    2006-12-17 02:02:10 UTC 
(rev 3946)
+++ GNUnet/src/applications/fs/collection/check.conf    2006-12-17 02:15:15 UTC 
(rev 3947)
@@ -0,0 +1,12 @@
+# General settings
+[GNUNET]
+GNUNET_HOME = "/tmp/gnunet-collection-test-driver"
+LOGLEVEL = "WARNING"
+LOGFILE = ""
+PROCESS-PRIORITY = "NORMAL"
+
+# Network options for the clients
+[NETWORK]
+CLIENT-PORT = 2087
+HOST = "localhost"
+

Added: GNUnet/src/applications/fs/collection/collectiontest.c
===================================================================
--- GNUnet/src/applications/fs/collection/collectiontest.c      2006-12-17 
02:02:10 UTC (rev 3946)
+++ GNUnet/src/applications/fs/collection/collectiontest.c      2006-12-17 
02:15:15 UTC (rev 3947)
@@ -0,0 +1,108 @@
+/*
+     This file is part of GNUnet.
+     (C) 2006 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/collection/collectiontest.c
+ * @brief testcase for collection library
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "gnunet_collection_lib.h"
+#include "gnunet_util_config_impl.h"
+#include "gnunet_util_network_client.h"
+
+#define CHECK(a) if (!(a)) { ok = NO; GE_BREAK(NULL, 0); goto FAILURE; }
+
+
+int main(int argc,
+        char * argv[]){
+  struct GC_Configuration * cfg;
+  pid_t daemon;
+  int ok;
+  struct ClientServerConnection * sock;
+  struct ECRS_MetaData * meta;
+  ECRS_FileInfo fi;
+  char * have;
+
+  cfg = GC_create_C_impl();
+  if (-1 == GC_parse_configuration(cfg,
+                                  "check.conf")) {
+    GC_free(cfg);
+    return -1;
+  }
+  daemon  = os_daemon_start(NULL,
+                           cfg,
+                           "peer.conf",
+                           NO);
+  GE_ASSERT(NULL, daemon > 0);
+  GE_ASSERT(NULL, OK == connection_wait_for_running(NULL,
+                                                   cfg,
+                                                   30 * cronSECONDS));
+  ok = YES;
+  PTHREAD_SLEEP(5 * cronSECONDS); /* give apps time to start */
+  meta = ECRS_createMetaData();
+  ECRS_addToMetaData(meta,
+                    EXTRACTOR_MIMETYPE,
+                    "test/foo");
+  sock = client_connection_create(NULL, cfg);
+  CHECK(sock != NULL);
+  CO_init(NULL, cfg);
+
+  /* ACTUAL TEST CODE */
+  CO_stopCollection();
+  CHECK(NULL == CO_getCollection());
+  CHECK(OK == CO_startCollection(1,
+                                100,
+                                60, /* 60s */
+                                "test-collection",
+                                meta));
+  have = CO_getCollection();
+  CHECK(NULL != have);
+  CHECK(0 == strcmp(have, "test-collection"));
+  FREE(have);
+  fi.meta = meta;
+  fi.uri = ECRS_stringToUri(NULL, 
"gnunet://ecrs/chk/0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0");
+  CO_publishToCollection(&fi);
+  ECRS_freeUri(fi.uri);
+  CO_done();
+  CO_init(NULL, cfg);
+  have = CO_getCollection();
+  CHECK(NULL != have);
+  CHECK(0 == strcmp(have, "test-collection"));
+  FREE(have);
+  CO_publishCollectionNow();
+  CO_stopCollection();
+  CHECK(NULL == CO_getCollection());
+       
+  /* END OF TEST CODE */
+ FAILURE:
+  if (sock != NULL) {
+    CO_done();
+    connection_destroy(sock);
+  }
+  ECRS_freeMetaData(meta);
+  GE_ASSERT(NULL, OK == os_daemon_stop(NULL, daemon));
+  GC_free(cfg);
+  return (ok == YES) ? 0 : 1;
+}
+
+/* end of collectiontest.c */


Property changes on: GNUnet/src/applications/fs/collection/collectiontest.c
___________________________________________________________________
Name: svn:eol-style
   + native

Added: GNUnet/src/applications/fs/collection/peer.conf
===================================================================
--- GNUnet/src/applications/fs/collection/peer.conf     2006-12-17 02:02:10 UTC 
(rev 3946)
+++ GNUnet/src/applications/fs/collection/peer.conf     2006-12-17 02:15:15 UTC 
(rev 3947)
@@ -0,0 +1,50 @@
+# This is the configuration for the GNUnet daemon when running
+# the test in this directory (make check).
+
+GNUNETD_HOME     = /tmp/gnunet-check-collection
+
+[GNUNETD]
+GNUNETD_HOME     = /tmp/gnunet-check-collection
+# VALGRIND        = 300
+HELLOEXPIRES     = 60
+LOGLEVEL        = NOTHING
+LOGFILE         = $GNUNETD_HOME/logs
+KEEPLOG         = 0
+PIDFILE         = $GNUNETD_HOME/gnunetd.pid
+HOSTS          = $GNUNETD_HOME/data/hosts/
+APPLICATIONS = "fs getoption stats"
+# TRANSPORTS = -- no transports!
+
+[MODULES]
+sqstore = "sqstore_sqlite"
+# you can also use sqstore_mysql here if 
+# that DB is available...
+topology = "topology_default"
+
+[NETWORK]
+PORT = 2087
+INTERFACE = eth0
+HELOEXCHANGE = NO
+TRUSTED = 127.0.0.0/8;
+
+[LOAD]
+INTERFACES      = eth0
+BASICLIMITING = YES
+MAXNETUPBPSTOTAL       = 50000
+MAXNETDOWNBPSTOTAL     = 50000
+MAXCPULOAD             = 100
+
+[FS]
+QUOTA  = 1024
+ACTIVEMIGRATION = NO
+DIR          = /tmp/gnunet-collection-test/
+INDEX-DIRECTORY = $GNUNETD_HOME/data/shared/
+INDEX-QUOTA = 8192
+
+[MYSQL]
+DELAYED = NO
+DATABASE = gnunetcheck
+
+[GAP]
+TABLESIZE = 65536
+





reply via email to

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