[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15196 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15196 - gnunet/src/mesh |
Date: |
Mon, 9 May 2011 20:38:47 +0200 |
Author: bartpolot
Date: 2011-05-09 20:38:47 +0200 (Mon, 09 May 2011)
New Revision: 15196
Modified:
gnunet/src/mesh/Makefile.am
gnunet/src/mesh/test_mesh_api.c
Log:
Added test mockup
Modified: gnunet/src/mesh/Makefile.am
===================================================================
--- gnunet/src/mesh/Makefile.am 2011-05-09 09:57:52 UTC (rev 15195)
+++ gnunet/src/mesh/Makefile.am 2011-05-09 18:38:47 UTC (rev 15196)
@@ -51,7 +51,8 @@
test_mesh_api.c
test_mesh_api_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/mesh/libgnunetmeshnew.la
+ $(top_builddir)/src/mesh/libgnunetmeshnew.la \
+ $(top_builddir)/src/dht/libgnunetdht.la
test_mesh_api_DEPENDENCIES = \
libgnunetmeshnew.la
Modified: gnunet/src/mesh/test_mesh_api.c
===================================================================
--- gnunet/src/mesh/test_mesh_api.c 2011-05-09 09:57:52 UTC (rev 15195)
+++ gnunet/src/mesh/test_mesh_api.c 2011-05-09 18:38:47 UTC (rev 15196)
@@ -1,30 +1,48 @@
#include "platform.h"
#include "gnunet_util_lib.h"
+#include "gnunet_dht_service.h"
#include "gnunet_mesh_service_new.h"
static struct GNUNET_MESH_MessageHandler handlers[] = {
{NULL, 0, 0}
};
-int main (int argc, char *argv[]) {
+static void
+run (void *cls,
+ char *const *args,
+ const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) {
struct GNUNET_OS_Process *arm_pid;
struct GNUNET_MESH_Handle *mesh;
+ struct GNUNET_DHT_Handle *dht;
// struct GNUNET_MESH_Tunnel *t;
- struct GNUNET_CONFIGURATION_Handle *cfg;
- cfg = GNUNET_CONFIGURATION_create();
arm_pid = GNUNET_OS_start_process (NULL, NULL,
"gnunet-service-arm",
"gnunet-service-arm",
"-L", "DEBUG",
+ "-c", "test_dht_api_data.conf",
NULL);
- mesh = GNUNET_MESH_connect(cfg, NULL, NULL, handlers, NULL);
- if(NULL == mesh) {
- fprintf(stderr, "Couldn't connect to mesh :(\n");
+// sleep(1);
+// printf("%d\n", fopen( "test_mesh.conf", "r"));
+// GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg,
"test_mesh.conf"));
+ //printf("%d\n", GNUNET_CONFIGURATION_load (cfg, NULL));
+// printf("%d\n", GNUNET_CONFIGURATION_load (cfg,
"test_dht_api_data.conf"));
+ dht = GNUNET_DHT_connect(cfg, 100);
+ if(NULL == dht) {
+// fprintf(stderr, "Couldn't connect to dht :(\n");
// return 1; // succeed anyway
+ } else {
+// fprintf(stderr, "YAY! CONNECTED TO DHT :D\n");
}
- mesh = realloc(mesh, 0); // don't complain about *mesh
+// mesh = GNUNET_MESH_connect(cfg, NULL, NULL, handlers, NULL);
+// if(NULL == mesh) {
+// fprintf(stderr, "Couldn't connect to mesh :(\n");
+// return 1; // succeed anyway
+// } else {
+// fprintf(stderr, "YAY! CONNECTED TO MESH :D\n");
+// }
+// mesh = realloc(mesh, 0); // don't complain about *mesh
// printf("MESH TEST\n");
// t = GNUNET_MESH_tunnel_create(mesh, );
@@ -34,5 +52,36 @@
GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid));
GNUNET_OS_process_close (arm_pid);
- return 0;
+ return;
}
+
+static int
+check ()
+{
+ int ret;
+ char *const argv[] = {"test-mesh-api",
+ "-c",
+ "test_dht_api_data.conf",
+#if VERBOSE
+ "-L", "DEBUG",
+#endif
+ NULL
+ };
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_END
+ };
+ ret = GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
+ argv, "test-mesh-api", "nohelp",
+ options, &run, NULL);
+ if (ret != GNUNET_OK)
+ {
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "test-mesh-api': Failed with error
code %d\n", ret);
+ }
+ return GNUNET_OK;
+}
+
+int main (int argc, char *argv[]) {
+ if(GNUNET_OK == check())
+ return 0;
+ else return 1;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15196 - gnunet/src/mesh,
gnunet <=