gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r1048 - GNUnet/src/util


From: grothoff
Subject: [GNUnet-SVN] r1048 - GNUnet/src/util
Date: Sun, 26 Jun 2005 04:33:07 -0700 (PDT)

Author: grothoff
Date: 2005-06-26 04:33:02 -0700 (Sun, 26 Jun 2005)
New Revision: 1048

Added:
   GNUnet/src/util/daemontest.c
Modified:
   GNUnet/src/util/Makefile.am
   GNUnet/src/util/bloomtest.c
   GNUnet/src/util/daemon.c
Log:
daemontestcase

Modified: GNUnet/src/util/Makefile.am
===================================================================
--- GNUnet/src/util/Makefile.am 2005-06-26 10:40:46 UTC (rev 1047)
+++ GNUnet/src/util/Makefile.am 2005-06-26 11:33:02 UTC (rev 1048)
@@ -31,7 +31,8 @@
 SUBDIRS = $(WINSUBDIRS) $(CYGSUBDIRS) .
 
 EXTRA_DIST = generate \
-  testconfig.conf
+  testconfig.conf \
+  check.conf
 
 libgnunetutil_la_LDFLAGS = \
  -export-dynamic $(LIBLTDL) $(LIBGCRYPT_LIBS) $(SOLFLAGS) $(WINFLAGS) $(LIBS) 
-lgmp \
@@ -96,6 +97,7 @@
  crctest \
  crontest \
  configtest \
+ daemontest \
  hashtest \
  hashingtest \
  hostkeytest \
@@ -119,6 +121,11 @@
 xmalloctest_LDADD = \
  $(top_builddir)/src/util/libgnunetutil.la  
 
+daemontest_SOURCES = \
+ daemontest.c 
+daemontest_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la  
+
 statetest_SOURCES = \
  statetest.c
 statetest_LDADD = \

Modified: GNUnet/src/util/bloomtest.c
===================================================================
--- GNUnet/src/util/bloomtest.c 2005-06-26 10:40:46 UTC (rev 1047)
+++ GNUnet/src/util/bloomtest.c 2005-06-26 11:33:02 UTC (rev 1048)
@@ -1,3 +1,22 @@
+/*
+     This file is part of GNUnet.
+     (C) 2004 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 test/bloomtest.c
  * @brief Testcase for the bloomfilter.

Modified: GNUnet/src/util/daemon.c
===================================================================
--- GNUnet/src/util/daemon.c    2005-06-26 10:40:46 UTC (rev 1047)
+++ GNUnet/src/util/daemon.c    2005-06-26 11:33:02 UTC (rev 1048)
@@ -100,8 +100,14 @@
        cp[i+1] = '\0';
        path = MALLOC(i+1+strlen("gnunetd"));
        strcpy(path, cp);
-       strcat(path, "gnunetd");      
-       args[0] = path;
+       strcat(path, "gnunetd");
+       if (ACCESS(path, X_OK) == 0) {
+         args[0] = path;
+       } else {
+         FREE(path);
+         path = NULL;
+         args[0] = "gnunetd";
+       }
        FREE(cp);
       } else {
        args[0] = "gnunetd";

Added: GNUnet/src/util/daemontest.c
===================================================================
--- GNUnet/src/util/daemontest.c        2005-06-26 10:40:46 UTC (rev 1047)
+++ GNUnet/src/util/daemontest.c        2005-06-26 11:33:02 UTC (rev 1048)
@@ -0,0 +1,61 @@
+/*
+     This file is part of GNUnet.
+     (C) 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 test/daemontest.c
+ * @brief Testcase for the daemon functions
+ * @author Christian Grothoff
+ */
+
+#include "gnunet_util.h"
+#include "platform.h"
+static int parseCommandLine(int argc,
+                           char * argv[]) {
+  FREENONNULL(setConfigurationString("GNUNETD",
+                                    "_MAGIC_",
+                                    "NO"));
+  FREENONNULL(setConfigurationString("GNUNETD",
+                                    "LOGFILE",
+                                    NULL));
+  FREENONNULL(setConfigurationString("GNUNET",
+                                    "LOGLEVEL",
+                                    "WARNING"));
+  FREENONNULL(setConfigurationString("GNUNET",
+                                    "GNUNETD-CONFIG",
+                                    "check.conf"));
+  return OK;
+}
+
+int main(int argc, char *argv[]) {
+  int daemon;
+
+  if (OK != initUtil(argc, 
+                    argv, 
+                    &parseCommandLine))
+    return -1;  
+  daemon = startGNUnetDaemon(NO);
+  GNUNET_ASSERT(daemon > 0);
+  GNUNET_ASSERT(OK == waitForGNUnetDaemonRunning(30 * cronSECONDS));
+  GNUNET_ASSERT(OK == stopGNUnetDaemon());
+  GNUNET_ASSERT(OK == waitForGNUnetDaemonTermination(daemon));
+  doneUtil();
+  return 0;
+}
+
+/* end of deamontest.c */





reply via email to

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