[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22019 - gnunet/src/vpn
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22019 - gnunet/src/vpn |
Date: |
Fri, 15 Jun 2012 13:18:29 +0200 |
Author: grothoff
Date: 2012-06-15 13:18:29 +0200 (Fri, 15 Jun 2012)
New Revision: 22019
Modified:
gnunet/src/vpn/Makefile.am
gnunet/src/vpn/test_gnunet_vpn.c
Log:
-use testing lib
Modified: gnunet/src/vpn/Makefile.am
===================================================================
--- gnunet/src/vpn/Makefile.am 2012-06-15 11:06:42 UTC (rev 22018)
+++ gnunet/src/vpn/Makefile.am 2012-06-15 11:18:29 UTC (rev 22019)
@@ -85,26 +85,26 @@
test_gnunet_vpn.c
test_gnunet_vpn_4_over_LDADD = -lmicrohttpd @LIBCURL@ \
$(top_builddir)/src/vpn/libgnunetvpn.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_gnunet_vpn_6_over_SOURCES = \
test_gnunet_vpn.c
test_gnunet_vpn_6_over_LDADD = -lmicrohttpd @LIBCURL@ \
$(top_builddir)/src/vpn/libgnunetvpn.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_gnunet_vpn_4_to_6_SOURCES = \
test_gnunet_vpn.c
test_gnunet_vpn_4_to_6_LDADD = -lmicrohttpd @LIBCURL@ \
$(top_builddir)/src/vpn/libgnunetvpn.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
test_gnunet_vpn_6_to_4_SOURCES = \
test_gnunet_vpn.c
test_gnunet_vpn_6_to_4_LDADD = -lmicrohttpd @LIBCURL@ \
$(top_builddir)/src/vpn/libgnunetvpn.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
Modified: gnunet/src/vpn/test_gnunet_vpn.c
===================================================================
--- gnunet/src/vpn/test_gnunet_vpn.c 2012-06-15 11:06:42 UTC (rev 22018)
+++ gnunet/src/vpn/test_gnunet_vpn.c 2012-06-15 11:18:29 UTC (rev 22019)
@@ -27,27 +27,13 @@
#include <curl/curl.h>
#include <microhttpd.h>
#include "gnunet_vpn_service.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#define PORT 48080
-#define START_ARM GNUNET_YES
-
-#define VERBOSE GNUNET_NO
-
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 300)
-struct PeerContext
-{
- struct GNUNET_CONFIGURATION_Handle *cfg;
- struct GNUNET_PeerIdentity id;
-#if START_ARM
- struct GNUNET_OS_Process *arm_proc;
-#endif
-};
-static struct PeerContext p1;
-
/**
* Return value for 'main'.
*/
@@ -96,7 +82,6 @@
static struct CBC cbc;
-
static size_t
copy_buffer (void *ptr, size_t size, size_t nmemb, void *ctx)
{
@@ -388,7 +373,7 @@
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct in_addr v4;
@@ -435,41 +420,6 @@
}
-static void
-setup_peer (struct PeerContext *p, const char *cfgname)
-{
- p->cfg = GNUNET_CONFIGURATION_create ();
-#if START_ARM
- p->arm_proc =
- GNUNET_OS_start_process (GNUNET_YES, NULL, NULL, "gnunet-service-arm",
- "gnunet-service-arm",
- "-c", cfgname, NULL);
-#endif
- GNUNET_assert (NULL != p->arm_proc);
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_peer (struct PeerContext *p)
-{
-#if START_ARM
- if (NULL != p->arm_proc)
- {
- if (0 != GNUNET_OS_process_kill (p->arm_proc, SIGTERM))
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
- if (GNUNET_OS_process_wait (p->arm_proc) != GNUNET_OK)
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "waitpid");
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ARM process %u stopped\n",
- GNUNET_OS_process_get_pid (p->arm_proc));
- GNUNET_OS_process_destroy (p->arm_proc);
- p->arm_proc = NULL;
- }
-#endif
- GNUNET_CONFIGURATION_destroy (p->cfg);
-}
-
-
/**
* Test if the given AF is supported by this system.
*
@@ -494,21 +444,11 @@
}
-
int
main (int argc, char *const *argv)
{
const char *type;
const char *bin;
- char *const argvx[] = {
- "test_gnunet_vpn",
- "-c",
- "test_gnunet_vpn.conf",
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
if (0 != ACCESS ("/dev/net/tun", R_OK))
{
@@ -577,20 +517,15 @@
"Required address families not supported by this system, skipping
test.\n");
return 0;
}
-
-
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
fprintf (stderr, "failed to initialize curl\n");
return 2;
}
- setup_peer (&p1, "test_gnunet_vpn.conf");
- GNUNET_log_setup ("test_gnunet_vpn",
- "WARNING",
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test_gnunet_vpn", "nohelp", options, &run, NULL);
- stop_peer (&p1);
+ if (0 != GNUNET_TESTING_peer_run ("test-gnunet-vpn",
+ "test_gnunet_vpn.conf",
+ &run, NULL))
+ return 1;
GNUNET_DISK_directory_remove ("/tmp/gnunet-test-vpn");
return global_ret;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22019 - gnunet/src/vpn,
gnunet <=