[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13728 - gnunet/src/core
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13728 - gnunet/src/core |
Date: |
Wed, 17 Nov 2010 16:58:30 +0100 |
Author: wachs
Date: 2010-11-17 16:58:30 +0100 (Wed, 17 Nov 2010)
New Revision: 13728
Modified:
gnunet/src/core/Makefile.am
gnunet/src/core/core.h
gnunet/src/core/test_core_api.c
gnunet/src/core/test_core_quota_compliance.c
gnunet/src/core/test_core_quota_peer1.conf
gnunet/src/core/test_core_quota_peer2.conf
Log:
Quota compliance testcases should ready to be commited...
Modified: gnunet/src/core/Makefile.am
===================================================================
--- gnunet/src/core/Makefile.am 2010-11-17 15:16:57 UTC (rev 13727)
+++ gnunet/src/core/Makefile.am 2010-11-17 15:58:30 UTC (rev 13728)
@@ -36,12 +36,14 @@
$(top_builddir)/src/transport/libgnunettransport.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
-
-
+
check_PROGRAMS = \
test_core_api_start_only \
test_core_api \
- test_core_api_reliability
+ test_core_api_reliability \
+ test_core_quota_compliance_symmetric \
+ test_core_quota_compliance_asymmetric_send_limited \
+ test_core_quota_compliance_asymmetric_recv_limited
if !DISABLE_TEST_RUN
TESTS = $(check_PROGRAMS)
@@ -65,9 +67,32 @@
test_core_api_start_only.c
test_core_api_start_only_LDADD = \
$(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/util/libgnunetutil.la
+ $(top_builddir)/src/util/libgnunetutil.la
+
+test_core_quota_compliance_symmetric_SOURCES = \
+ test_core_quota_compliance.c
+test_core_quota_compliance_symmetric_LDADD = \
+ $(top_builddir)/src/core/libgnunetcore.la \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la
+test_core_quota_compliance_asymmetric_send_limited_SOURCES = \
+ test_core_quota_compliance.c
+test_core_quota_compliance_asymmetric_send_limited_LDADD = \
+ $(top_builddir)/src/core/libgnunetcore.la \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la
+test_core_quota_compliance_asymmetric_recv_limited_SOURCES = \
+ test_core_quota_compliance.c
+test_core_quota_compliance_asymmetric_recv_limited_LDADD = \
+ $(top_builddir)/src/core/libgnunetcore.la \
+ $(top_builddir)/src/transport/libgnunettransport.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/statistics/libgnunetstatistics.la
+
EXTRA_DIST = \
test_core_api_data.conf \
test_core_api_peer1.conf \
Modified: gnunet/src/core/core.h
===================================================================
--- gnunet/src/core/core.h 2010-11-17 15:16:57 UTC (rev 13727)
+++ gnunet/src/core/core.h 2010-11-17 15:58:30 UTC (rev 13728)
@@ -41,12 +41,12 @@
/**
* General core debugging.
*/
-#define DEBUG_CORE GNUNET_YES
+#define DEBUG_CORE GNUNET_NO
/**
* Debugging interaction core-clients.
*/
-#define DEBUG_CORE_CLIENT GNUNET_YES
+#define DEBUG_CORE_CLIENT GNUNET_NO
/**
* Definition of bits in the InitMessage's options field that specify
Modified: gnunet/src/core/test_core_api.c
===================================================================
--- gnunet/src/core/test_core_api.c 2010-11-17 15:16:57 UTC (rev 13727)
+++ gnunet/src/core/test_core_api.c 2010-11-17 15:58:30 UTC (rev 13728)
@@ -35,7 +35,6 @@
#include "gnunet_transport_service.h"
#define VERBOSE GNUNET_NO
-
#define START_ARM GNUNET_YES
#define MTYPE 12345
@@ -319,7 +318,6 @@
GNUNET_YES, &outbound_notify, GNUNET_YES, handlers);
}
-
static void
stop_arm (struct PeerContext *p)
{
Modified: gnunet/src/core/test_core_quota_compliance.c
===================================================================
--- gnunet/src/core/test_core_quota_compliance.c 2010-11-17 15:16:57 UTC
(rev 13727)
+++ gnunet/src/core/test_core_quota_compliance.c 2010-11-17 15:58:30 UTC
(rev 13728)
@@ -34,8 +34,9 @@
#include "gnunet_program_lib.h"
#include "gnunet_scheduler_lib.h"
#include "gnunet_transport_service.h"
+#include "gnunet_statistics_service.h"
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
#define DEBUG_TRANSMISSION GNUNET_NO
#define SYMMETRIC 0
@@ -84,6 +85,7 @@
struct GNUNET_PeerIdentity id;
struct GNUNET_TRANSPORT_Handle *th;
struct GNUNET_MessageHeader *hello;
+ struct GNUNET_STATISTICS_Handle *stats;
int connect_status;
#if START_ARM
struct GNUNET_OS_Process *arm_proc;
@@ -151,6 +153,37 @@
ok = 42;
}
+
+/**
+ * Callback function to process statistic values.
+ *
+ * @param cls closure
+ * @param subsystem name of subsystem that created the statistic
+ * @param name the name of the datum
+ * @param value the current value
+ * @param is_persistent GNUNET_YES if the value is persistent, GNUNET_NO if not
+ * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration
+ */
+static int
+print_stat (void *cls,
+ const char *subsystem,
+ const char *name,
+ uint64_t value,
+ int is_persistent)
+{
+ if (cls==&p1)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer1 %50s = %12llu\n",
+ name,
+ (unsigned long long) value);
+ if (cls==&p2)
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Peer2 %50s = %12llu\n",
+ name,
+ (unsigned long long) value);
+ return GNUNET_OK;
+}
+
static void
measurement_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
@@ -185,33 +218,86 @@
quota_delta = max_quota_out / 10;
if ((throughput_out < (max_quota_out/1024)) && (throughput_out <
(max_quota_in/1024)))
- {
ok = 0;
- }
else
+ ok = 1;
+
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded CORE_SEND requests",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p1);
+
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded CORE_SEND request bytes",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p1);
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded lower priority CORE_SEND requests",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, NULL);
+ GNUNET_STATISTICS_get (p1.stats,
+ "core",
+ "# discarded lower priority CORE_SEND request bytes",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p1);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded CORE_SEND requests",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p2);
+
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded CORE_SEND request bytes",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p2);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded lower priority CORE_SEND requests",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p2);
+ GNUNET_STATISTICS_get (p2.stats,
+ "core",
+ "# discarded lower priority CORE_SEND request bytes",
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ NULL,
+ &print_stat, &p2);
+
+ enum GNUNET_ErrorType kind = GNUNET_ERROR_TYPE_DEBUG;
+ if (ok==1)
{
- ok = 1;
+ kind = GNUNET_ERROR_TYPE_ERROR;
}
switch (test)
{
case SYMMETRIC:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Core quota compliance test with
symmetric quotas\n");
+ GNUNET_log (kind,"Core quota compliance test with symmetric quotas:
%s\n", (ok==0)?"PASSED":"FAILED");
break;
case ASYMMETRIC_SEND_LIMITED:
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Core quota compliance test with
limited sender quota\n",throughput_in,total_bytes_recv, delta/1000);
+ GNUNET_log (kind,"Core quota compliance test with limited sender
quota: %s\n", (ok==0)?"PASSED":"FAILED");
break;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Core quota compliance test with
limited receiver quota\n",throughput_in,total_bytes_recv, delta/1000);
case ASYMMETRIC_RECV_LIMITED:
+ GNUNET_log (kind,"Core quota compliance test with limited receiver
quota: %s\n", (ok==0)?"PASSED":"FAILED");
break;
};
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Peer 1 send rate: %llu kB/s (%llu
Bytes in %u sec.)\n",throughput_out,total_bytes_sent, delta/1000);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Peer 2 receive rate: %llu kB/s (%llu
Bytes in %u sec.)\n",throughput_in,total_bytes_recv, delta/1000);
-
-
+ GNUNET_log (kind,"Peer 1 send rate: %llu kB/s (%llu Bytes in %u
sec.)\n",throughput_out,total_bytes_sent, delta/1000);
+ GNUNET_log (kind,"Peer 1 send quota: %llu kB/s\n",current_quota_p1_out /
1024);
+ GNUNET_log (kind,"Peer 2 receive rate: %llu kB/s (%llu Bytes in %u
sec.)\n",throughput_in,total_bytes_recv, delta/1000);
+ GNUNET_log (kind,"Peer 2 receive quota: %llu kB/s\n",current_quota_p2_in /
1024);
+/*
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. inbound quota allowed: %llu
kB/s\n",max_quota_in /1024);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Max. outbound quota allowed: %llu
kB/s\n",max_quota_out/1024);
-
+*/
GNUNET_SCHEDULER_cancel (err_task);
GNUNET_SCHEDULER_add_now (&terminate_task, NULL);
@@ -293,6 +379,7 @@
"Asking core (1) for transmission to peer `%4s'\n",
GNUNET_i2s (&p2.id));
#endif
+ if (err_task != GNUNET_SCHEDULER_NO_TASK) GNUNET_SCHEDULER_cancel
(err_task);
err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
&terminate_task_error,
NULL);
@@ -515,6 +602,8 @@
"-c", cfgname, NULL);
#endif
GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
+ p->stats = GNUNET_STATISTICS_create ("core",p->cfg);
+ GNUNET_assert (p->stats!=NULL);
p->th = GNUNET_TRANSPORT_connect (p->cfg, NULL, p, NULL, NULL, NULL);
GNUNET_assert (p->th != NULL);
GNUNET_TRANSPORT_get_hello (p->th, &process_hello, p);
@@ -529,6 +618,9 @@
{
GNUNET_assert (ok == 1);
OKPP;
+ err_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &terminate_task_error,
+ NULL);
if (test == SYMMETRIC)
{
setup_peer (&p1, "test_core_quota_peer1.conf");
@@ -640,8 +732,6 @@
"WARNING",
#endif
NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "argv[0] %s",argv[0]);
ret = check ();
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");
Modified: gnunet/src/core/test_core_quota_peer1.conf
===================================================================
--- gnunet/src/core/test_core_quota_peer1.conf 2010-11-17 15:16:57 UTC (rev
13727)
+++ gnunet/src/core/test_core_quota_peer1.conf 2010-11-17 15:58:30 UTC (rev
13728)
@@ -1,6 +1,6 @@
[PATHS]
-SERVICEHOME = /tmp/test-gnunet-core-peer-1/
-DEFAULTCONFIG = test_core_api_peer1.conf
+SERVICEHOME = /tmp/test-gnunet-core-quote-peer-1/
+DEFAULTCONFIG = test_core_quota_peer1.conf
[resolver]
PORT = 12464
@@ -50,8 +50,7 @@
#OPTIONS = -l log-core-1
#PREFIX = xterm -e xterm -T core1 -e gdb --args
#PREFIX = xterm -T core1 -e
-#DEBUG = YES
-#BINARY=/home/grothoff/bin/gnunet-service-core
+DEBUG = NO
[testing]
WEAKRANDOM = YES
Modified: gnunet/src/core/test_core_quota_peer2.conf
===================================================================
--- gnunet/src/core/test_core_quota_peer2.conf 2010-11-17 15:16:57 UTC (rev
13727)
+++ gnunet/src/core/test_core_quota_peer2.conf 2010-11-17 15:58:30 UTC (rev
13728)
@@ -1,5 +1,5 @@
[PATHS]
-SERVICEHOME = /tmp/test-gnunet-core-peer-2/
+SERVICEHOME = /tmp/test-gnunet-core-quote-peer-2/
DEFAULTCONFIG = test_core_api_peer2.conf
[resolver]
@@ -49,7 +49,7 @@
UNIXPATH = /tmp/gnunet-p2-service-core.sock
#PREFIX = xterm -T core2 -e
#PREFIX = valgrind --tool=memcheck
-#DEBUG = YES
+DEBUG = NO
#BINARY=/home/grothoff/bin/gnunet-service-core
[testing]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13728 - gnunet/src/core,
gnunet <=