aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-10-28 19:52:25 +0000
committerChristian Grothoff <christian@grothoff.org>2009-10-28 19:52:25 +0000
commitcbf2a3e7cf2d7acda1d115198671eaccf2616fc4 (patch)
tree8eddbd89fa0f3a5fec1b387b5d2cdbab5789d6b8 /src/testing
parent359e97be5e33493691d53aa6a51f1b364f46dab9 (diff)
downloadgnunet-cbf2a3e7cf2d7acda1d115198671eaccf2616fc4.tar.gz
gnunet-cbf2a3e7cf2d7acda1d115198671eaccf2616fc4.zip
getting testing to work
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/test_testing.c5
-rw-r--r--src/testing/test_testing_data.conf2
-rw-r--r--src/testing/testing.c36
3 files changed, 31 insertions, 12 deletions
diff --git a/src/testing/test_testing.c b/src/testing/test_testing.c
index 886427402..f56ebe2c0 100644
--- a/src/testing/test_testing.c
+++ b/src/testing/test_testing.c
@@ -24,7 +24,7 @@
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_testing_lib.h" 25#include "gnunet_testing_lib.h"
26 26
27#define VERBOSE GNUNET_YES 27#define VERBOSE GNUNET_NO
28 28
29static int ok; 29static int ok;
30 30
@@ -48,7 +48,8 @@ static void my_cb(void *cls,
48 GNUNET_assert (id != NULL); 48 GNUNET_assert (id != NULL);
49#if VERBOSE 49#if VERBOSE
50 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 50 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
51 "Daemon started, will now stop it.\n"); 51 "Daemon `%s' started, will now stop it.\n",
52 GNUNET_i2s (id));
52#endif 53#endif
53 GNUNET_TESTING_daemon_stop (d, &end_cb, NULL); 54 GNUNET_TESTING_daemon_stop (d, &end_cb, NULL);
54} 55}
diff --git a/src/testing/test_testing_data.conf b/src/testing/test_testing_data.conf
index f326e72bd..f314028d4 100644
--- a/src/testing/test_testing_data.conf
+++ b/src/testing/test_testing_data.conf
@@ -8,6 +8,8 @@ PORT = 2564
8[transport] 8[transport]
9PORT = 2565 9PORT = 2565
10PLUGINS = tcp 10PLUGINS = tcp
11#PREFIX = xterm -e xterm -T transport -e gdb -x cmd --args
12#PREFIX = valgrind --tool=memcheck --log-file=logs%p
11 13
12[arm] 14[arm]
13PORT = 2566 15PORT = 2566
diff --git a/src/testing/testing.c b/src/testing/testing.c
index e4cc74827..35a872619 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -40,13 +40,13 @@
40#include "gnunet_testing_lib.h" 40#include "gnunet_testing_lib.h"
41#include "gnunet_transport_service.h" 41#include "gnunet_transport_service.h"
42 42
43#define DEBUG_TESTING GNUNET_YES 43#define DEBUG_TESTING GNUNET_NO
44 44
45/** 45/**
46 * How long do we wait after starting gnunet-service-arm 46 * How long do we wait after starting gnunet-service-arm
47 * for the core service to be alive? 47 * for the core service to be alive?
48 */ 48 */
49#define ARM_START_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) 49#define ARM_START_WAIT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
50 50
51/** 51/**
52 * How many times are we willing to try to wait for "scp" or 52 * How many times are we willing to try to wait for "scp" or
@@ -632,8 +632,13 @@ GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
632 ret->username = username; 632 ret->username = username;
633 633
634 /* 2) copy file to remote host */ 634 /* 2) copy file to remote host */
635 if (NULL != hostname) 635 if (NULL != hostname)
636 { 636 {
637#if DEBUG_TESTING
638 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
639 "Copying configuration file to host `%s'.\n",
640 hostname);
641#endif
637 ret->phase = SP_COPYING; 642 ret->phase = SP_COPYING;
638 if (NULL != username) 643 if (NULL != username)
639 GNUNET_asprintf (&arg, 644 GNUNET_asprintf (&arg,
@@ -732,7 +737,6 @@ void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
732 "arm", 737 "arm",
733 d->cfg); 738 d->cfg);
734 GNUNET_CLIENT_service_shutdown (cc); 739 GNUNET_CLIENT_service_shutdown (cc);
735 GNUNET_CLIENT_disconnect (cc);
736 740
737 /* state clean up and notifications */ 741 /* state clean up and notifications */
738 if (0 != UNLINK (d->cfgfile)) 742 if (0 != UNLINK (d->cfgfile))
@@ -741,6 +745,11 @@ void GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d,
741 d->cfgfile); 745 d->cfgfile);
742 if (d->hostname != NULL) 746 if (d->hostname != NULL)
743 { 747 {
748#if DEBUG_TESTING
749 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
750 "Removing configuration file on remote host `%s'.\n",
751 d->hostname);
752#endif
744 if (NULL != d->username) 753 if (NULL != d->username)
745 GNUNET_asprintf (&dst, 754 GNUNET_asprintf (&dst,
746 "%s@%s", 755 "%s@%s",
@@ -832,6 +841,11 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
832 cb (cb_cls, NULL); 841 cb (cb_cls, NULL);
833 return; 842 return;
834 } 843 }
844#if DEBUG_TESTING
845 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
846 "Copying updated configuration file to remote host `%s'.\n",
847 d->hostname);
848#endif
835 d->phase = SP_CONFIG_UPDATE; 849 d->phase = SP_CONFIG_UPDATE;
836 if (NULL != d->username) 850 if (NULL != d->username)
837 GNUNET_asprintf (&arg, 851 GNUNET_asprintf (&arg,
@@ -873,28 +887,30 @@ void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
873 d); 887 d);
874} 888}
875 889
890
876/** 891/**
877 * FIXME. 892 * Data kept for each pair of peers that we try
893 * to connect.
878 */ 894 */
879struct ConnectContext 895struct ConnectContext
880{ 896{
881 /** 897 /**
882 * FIXME. 898 * Testing handle to the first daemon.
883 */ 899 */
884 struct GNUNET_TESTING_Daemon *d1; 900 struct GNUNET_TESTING_Daemon *d1;
885 901
886 /** 902 /**
887 * FIXME. 903 * Testing handle to the second daemon.
888 */ 904 */
889 struct GNUNET_TESTING_Daemon *d2; 905 struct GNUNET_TESTING_Daemon *d2;
890 906
891 /** 907 /**
892 * FIXME. 908 * Transport handle to the first daemon.
893 */ 909 */
894 struct GNUNET_TRANSPORT_Handle *d1th; 910 struct GNUNET_TRANSPORT_Handle *d1th;
895 911
896 /** 912 /**
897 * FIXME. 913 * Transport handle to the second daemon.
898 */ 914 */
899 struct GNUNET_TRANSPORT_Handle *d2th; 915 struct GNUNET_TRANSPORT_Handle *d2th;
900 916
@@ -919,7 +935,7 @@ struct ConnectContext
919/** 935/**
920 * Success, connection is up. Signal client our success. 936 * Success, connection is up. Signal client our success.
921 * 937 *
922 * @param cls FIXME 938 * @param cls our "struct ConnectContext"
923 * @param size number of bytes available in buf 939 * @param size number of bytes available in buf
924 * @param buf where to copy the message, NULL on error 940 * @param buf where to copy the message, NULL on error
925 * @return number of bytes copied to buf 941 * @return number of bytes copied to buf