[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4821 - GNUnet/src/applications/gap
From: |
gnunet |
Subject: |
[GNUnet-SVN] r4821 - GNUnet/src/applications/gap |
Date: |
Sun, 27 May 2007 22:24:07 -0600 (MDT) |
Author: grothoff
Date: 2007-05-27 22:24:07 -0600 (Sun, 27 May 2007)
New Revision: 4821
Removed:
GNUnet/src/applications/gap/peer1.conf
GNUnet/src/applications/gap/peer1/
GNUnet/src/applications/gap/peer2.conf
GNUnet/src/applications/gap/peer2/
Modified:
GNUnet/src/applications/gap/Makefile.am
GNUnet/src/applications/gap/gaptest.c
Log:
bye
Modified: GNUnet/src/applications/gap/Makefile.am
===================================================================
--- GNUnet/src/applications/gap/Makefile.am 2007-05-28 03:48:00 UTC (rev
4820)
+++ GNUnet/src/applications/gap/Makefile.am 2007-05-28 04:24:07 UTC (rev
4821)
@@ -28,6 +28,7 @@
gaptest_SOURCES = \
gaptest.c
gaptest_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 \
@@ -37,8 +38,4 @@
EXTRA_DIST = \
- peer1.conf \
- peer2.conf \
- peer1/.hostkey \
- peer2/.hostkey \
check.conf
Modified: GNUnet/src/applications/gap/gaptest.c
===================================================================
--- GNUnet/src/applications/gap/gaptest.c 2007-05-28 03:48:00 UTC (rev
4820)
+++ GNUnet/src/applications/gap/gaptest.c 2007-05-28 04:24:07 UTC (rev
4821)
@@ -27,32 +27,20 @@
#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"
-/**
- * Identity of peer 2 (hardwired).
- */
+static PeerIdentity peer1;
static PeerIdentity peer2;
static struct GE_Context * ectx;
static struct GC_Configuration * cfg;
-static int waitForConnect(const char * name,
- unsigned long long value,
- void * cls) {
- if ( (value > 0) &&
- (0 == strcmp(_("# of connected peers"),
- name)) )
- return SYSERR;
- return OK;
-}
-
-
static int testTerminate(void * unused) {
return OK;
}
@@ -259,17 +247,10 @@
* @return 0: ok, -1: error
*/
int main(int argc, char ** argv) {
- pid_t daemon1;
- pid_t daemon2;
+ struct DaemonContext * peers;
int ret;
- struct ClientServerConnection * sock;
- int left;
struct ECRS_URI * uri;
- enc2hash("BV3AS3KMIIBVIFCGEG907N6NTDTH26B7T6FODUSLSGK"
- "5B2Q58IEU1VF5FTR838449CSHVBOAHLDVQAOA33O77F"
- "OPDA8F1VIKESLSNBO",
- &peer2.hashPubKey);
cfg = GC_create_C_impl();
if (-1 == GC_parse_configuration(cfg,
"check.conf")) {
@@ -277,66 +258,28 @@
return -1;
}
#if START_PEERS
- daemon1 = os_daemon_start(NULL,
- cfg,
- "peer1.conf",
- NO);
- daemon2 = os_daemon_start(NULL,
- cfg,
- "peer2.conf",
- NO);
-#endif
- /* in case existing hellos have expired */
- PTHREAD_SLEEP(30 * cronSECONDS);
- system("cp peer1/data/hosts/* peer2/data/hosts/");
- system("cp peer2/data/hosts/* peer1/data/hosts/");
- ret = 0;
-#if START_PEERS
- if (daemon1 != -1) {
- if (os_daemon_stop(NULL, daemon1) != YES)
- ret = 1;
+ peers = gnunet_testing_start_daemons("tcp",
+ "advertising topology fs stats",
+ "/tmp/gnunet-gap-test",
+ 2087,
+ 10000,
+ 2);
+ if (peers == NULL) {
+ GC_free(cfg);
+ return -1;
}
- if (daemon2 != -1) {
- if (os_daemon_stop(NULL, daemon2) != YES)
- ret = 1;
- }
- if (ret != 0)
- return 1;
- daemon1 = os_daemon_start(NULL,
- cfg,
- "peer1.conf",
- NO);
- daemon2 = os_daemon_start(NULL,
- cfg,
- "peer2.conf",
- NO);
#endif
- if (OK == connection_wait_for_running(NULL,
- cfg,
- 30 * cronSECONDS)) {
- sock = client_connection_create(NULL,
- cfg);
- left = 30; /* how many iterations should we wait? */
- while (OK == STATS_getStatistics(NULL,
- sock,
- &waitForConnect,
- NULL)) {
- printf("Waiting for peers to connect (%u iterations left)...\n",
- left);
- sleep(5);
- left--;
- if (left == 0) {
- ret = 1;
- break;
- }
- }
- connection_destroy(sock);
- } else {
- printf("Could not establish connection with peer.\n");
- ret = 1;
+ peer1 = peers->peer;
+ peer2 = peers->next->peer;
+ if (OK != gnunet_testing_connect_daemons(2087,
+ 12087)) {
+ gnunet_testing_stop_daemons(peers);
+ fprintf(stderr,
+ "Failed to connect the peers!\n");
+ GC_free(cfg);
+ return -1;
}
-
uri = uploadFile(12345);
CHECK(NULL != uri);
CHECK(OK == searchFile(&uri));
@@ -356,14 +299,7 @@
FAILURE:
#if START_PEERS
- if (daemon1 != -1) {
- if (os_daemon_stop(NULL, daemon1) != YES)
- ret = 1;
- }
- if (daemon2 != -1) {
- if (os_daemon_stop(NULL, daemon2) != YES)
- ret = 1;
- }
+ gnunet_testing_stop_daemons(peers);
#endif
GC_free(cfg);
Deleted: GNUnet/src/applications/gap/peer1.conf
===================================================================
--- GNUnet/src/applications/gap/peer1.conf 2007-05-28 03:48:00 UTC (rev
4820)
+++ GNUnet/src/applications/gap/peer1.conf 2007-05-28 04:24:07 UTC (rev
4821)
@@ -1,77 +0,0 @@
-# This is the configuration for the GNUnet daemon when running
-# the test in this directory (make check).
-[PATHS]
-GNUNETD_HOME = peer1
-
-[GNUNETD]
-GNUNETD_HOME = peer1
-# VALGRIND = 300
-HELLOEXPIRES = 60
-LOGLEVEL = WARNING
-LOGFILE = $GNUNETD_HOME/log
-KEEPLOG = 0
-PIDFILE = $GNUNETD_HOME/gnunetd.pid
-HOSTS = $GNUNETD_HOME/data/hosts/
-APPLICATIONS = "advertising topology fs stats"
-TRANSPORTS = "tcp"
-
-[MODULES]
-topology = "topology_default"
-sqstore = "sqstore_sqlite"
-
-[NETWORK]
-PORT = 2087
-INTERFACE = lo
-HELOEXCHANGE = NO
-TRUSTED = 127.0.0.0/8;
-
-[LOAD]
-INTERFACES = eth0
-BASICLIMITING = YES
-MAXNETUPBPSTOTAL = 50000
-MAXNETDOWNBPSTOTAL = 50000
-MAXCPULOAD = 100
-
-[TCP]
-PORT = 2086
-# BLACKLIST =
-
-[UDP]
-PORT = 2086
-# BLACKLIST =
-MTU = 1472
-
-[UDP6]
-# Default port is 2088 and MTU is 1452.
-PORT = 2088
-# BLACKLIST =
-MTU = 1452
-
-[TCP6]
-
-# Default port is 2088 and MTU is 1440.
-PORT = 2088
-# BLACKLIST =
-MTU = 1440
-
-[HTTP]
-# Default port is 1080 and MTU is 1400.
-PORT = 1080
-# BLACKLIST =
-
-
-
-[FS]
-QUOTA = 1024
-ACTIVEMIGRATION = NO
-DIR = /tmp/gnunet-gap-test-1/
-INDEX-DIRECTORY = $GNUNETD_HOME/data/shared/
-INDEX-QUOTA = 8192
-
-[MYSQL]
-DELAYED = NO
-DATABASE = gnunetcheck
-
-[GAP]
-TABLESIZE = 65536
-
Deleted: GNUnet/src/applications/gap/peer2.conf
===================================================================
--- GNUnet/src/applications/gap/peer2.conf 2007-05-28 03:48:00 UTC (rev
4820)
+++ GNUnet/src/applications/gap/peer2.conf 2007-05-28 04:24:07 UTC (rev
4821)
@@ -1,76 +0,0 @@
-# This is the configuration for the GNUnet daemon when running
-# the test in this directory (make check).
-[PATHS]
-GNUNETD_HOME = peer2
-
-[GNUNETD]
-GNUNETD_HOME = peer2
-# VALGRIND = 300
-HELLOEXPIRES = 60
-LOGLEVEL = WARNING
-LOGFILE = $GNUNETD_HOME/log
-KEEPLOG = 0
-PIDFILE = $GNUNETD_HOME/gnunetd.pid
-HOSTS = $GNUNETD_HOME/data/hosts/
-APPLICATIONS = "advertising topology fs stats"
-TRANSPORTS = "tcp"
-
-[MODULES]
-topology = "topology_default"
-sqstore = "sqstore_sqlite"
-
-[NETWORK]
-PORT = 12087
-INTERFACE = lo
-HELOEXCHANGE = NO
-TRUSTED = 127.0.0.0/8;
-
-[LOAD]
-INTERFACES = eth0
-BASICLIMITING = YES
-MAXNETUPBPSTOTAL = 50000
-MAXNETDOWNBPSTOTAL = 50000
-MAXCPULOAD = 100
-
-[TCP]
-PORT = 12086
-# BLACKLIST =
-
-[UDP]
-PORT = 12086
-# BLACKLIST =
-MTU = 1472
-
-[UDP6]
-# Default port is 2088 and MTU is 1452.
-PORT = 12088
-# BLACKLIST =
-MTU = 1452
-
-[TCP6]
-
-# Default port is 2088 and MTU is 1440.
-PORT = 12088
-# BLACKLIST =
-MTU = 1440
-
-[HTTP]
-# Default port is 1080 and MTU is 1400.
-PORT = 11080
-# BLACKLIST =
-
-
-
-[FS]
-QUOTA = 1024
-ACTIVEMIGRATION = NO
-DIR = /tmp/gnunet-gap-test-2/
-INDEX-DIRECTORY = $GNUNETD_HOME/data/shared/
-INDEX-QUOTA = 8192
-
-[MYSQL]
-DELAYED = NO
-DATABASE = gnunetcheck
-
-[GAP]
-TABLESIZE = 65536
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4821 - GNUnet/src/applications/gap,
gnunet <=