test_fs_publish_SOURCES = \
test_fs_publish.c
test_fs_publish_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
test_fs_publish_persistence_SOURCES = \
test_fs_publish_persistence.c
test_fs_publish_persistence_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
test_fs_search_SOURCES = \
test_fs_search.c
test_fs_search_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
test_fs_search_probes_SOURCES = \
test_fs_search_probes.c
test_fs_search_probes_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
test_fs_search_persistence_SOURCES = \
test_fs_search_persistence.c
test_fs_search_persistence_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
test_fs_start_stop_SOURCES = \
test_fs_start_stop.c
test_fs_start_stop_LDADD = \
+ $(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/fs/libgnunetfs.la \
$(top_builddir)/src/util/libgnunetutil.la
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_publish.c
* @brief simple testcase for publish operation (indexing, listing
* indexed, directory structure)
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
/**
* File-size we use for testing.
*/
*/
#define LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-struct PeerContext
-{
- struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
- struct GNUNET_OS_Process *arm_proc;
-#endif
-};
-
-static struct PeerContext p1;
static struct GNUNET_TIME_Absolute start;
static int err;
+
static void
abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
ret = event->value.publish.cctx;
GNUNET_assert (publish == event->value.publish.pc);
-#if VERBOSE
- printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n",
- (unsigned long long) event->value.publish.completed,
- (unsigned long long) event->value.publish.size,
- event->value.publish.specifics.progress.depth,
- (unsigned long long) event->value.publish.specifics.
- progress.offset);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Publish is progressing (%llu/%llu at level %u off %llu)...\n",
+ (unsigned long long) event->value.publish.completed,
+ (unsigned long long) event->value.publish.size,
+ event->value.publish.specifics.progress.depth,
+ (unsigned long long) event->value.publish.specifics.
+ progress.offset);
break;
case GNUNET_FS_STATUS_PUBLISH_ERROR:
ret = event->value.publish.cctx;
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",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfgname, NULL);
-#endif
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const char *keywords[] = {
size_t i;
struct GNUNET_FS_BlockOptions bo;
- setup_peer (&p1, "test_fs_publish_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-publish", &progress_cb, NULL,
GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
GNUNET_assert (NULL != fs);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-publish",
- "-c",
- "test_fs_publish_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_log_setup ("test_fs_publish",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-publish", "nohelp", options, &run, NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-publish/");
- if (fn1 != NULL)
- {
- GNUNET_DISK_directory_remove (fn1);
- GNUNET_free (fn1);
- }
- if (fn2 != NULL)
- {
- GNUNET_DISK_directory_remove (fn2);
- GNUNET_free (fn2);
- }
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-publish",
+ "test_fs_publish_data.conf",
+ &run, NULL))
+ return 1;
return err;
}
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_publish_persistence.c
* @brief simple testcase for persistence of simple publish operation
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
/**
* File-size we use for testing.
*/
#define LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-struct PeerContext
-{
- struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
- struct GNUNET_OS_Process *arm_proc;
-#endif
-};
-
-static struct PeerContext p1;
static struct GNUNET_TIME_Absolute start;
static GNUNET_SCHEDULER_TaskIdentifier rtask;
+
static void
abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
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",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfgname, NULL);
-#endif
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c)
{
const char *keywords[] = {
struct GNUNET_FS_BlockOptions bo;
cfg = c;
- setup_peer (&p1, "test_fs_publish_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-publish-persistence", &progress_cb, NULL,
GNUNET_FS_FLAGS_PERSISTENCE, GNUNET_FS_OPTIONS_END);
GNUNET_assert (NULL != fs);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-publish-persistence",
- "-c",
- "test_fs_publish_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_log_setup ("test_fs_publish_persistence",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-publish", "nohelp", options, &run, NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-publish/");
- if (fn1 != NULL)
- {
- GNUNET_DISK_directory_remove (fn1);
- GNUNET_free (fn1);
- }
- if (fn2 != NULL)
- {
- GNUNET_DISK_directory_remove (fn2);
- GNUNET_free (fn2);
- }
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-publish-persistence",
+ "test_fs_publish_data.conf",
+ &run, NULL))
+ return 1;
return err;
}
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_search.c
* @brief simple testcase for simple publish + search operation
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
/**
* File-size we use for testing.
*/
#define LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-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;
static struct GNUNET_TIME_Absolute start;
switch (event->status)
{
case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
-#if VERBOSE
- printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n",
- (unsigned long long) event->value.publish.completed,
- (unsigned long long) event->value.publish.size,
- event->value.publish.specifics.progress.depth,
- (unsigned long long) event->value.publish.specifics.
- progress.offset);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Publish is progressing (%llu/%llu at level %u off %llu)...\n",
+ (unsigned long long) event->value.publish.completed,
+ (unsigned long long) event->value.publish.size,
+ event->value.publish.specifics.progress.depth,
+ (unsigned long long) event->value.publish.specifics.
+ progress.offset);
break;
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
GNUNET_assert (search != NULL);
break;
case GNUNET_FS_STATUS_SEARCH_RESULT:
-#if VERBOSE
- printf ("Search complete.\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Search complete.\n");
GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
break;
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 (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const char *keywords[] = {
struct GNUNET_FS_FileInformation *fi;
size_t i;
- setup_peer (&p1, "test_fs_search_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL,
GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
GNUNET_assert (NULL != fs);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-search",
- "-c",
- "test_fs_search_data.conf",
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_log_setup ("test_fs_search",
- "WARNING",
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-search", "nohelp", options, &run, NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-search/");
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-search",
+ "test_fs_search_data.conf",
+ &run, NULL))
+ return 1;
return 0;
}
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_search_persistence.c
* @brief simple testcase for persistence of search operation
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
/**
* File-size we use for testing.
*/
#define LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-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;
static struct GNUNET_TIME_Absolute start;
static const struct GNUNET_CONFIGURATION_Handle *cfg;
+
static void
abort_publish_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
}
-
-
/**
* Consider scheduling the restart-task.
* Only runs the restart task once per event
switch (event->status)
{
case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
-#if VERBOSE
- printf ("Publish is progressing (%llu/%llu at level %u off %llu)...\n",
- (unsigned long long) event->value.publish.completed,
- (unsigned long long) event->value.publish.size,
- event->value.publish.specifics.progress.depth,
- (unsigned long long) event->value.publish.specifics.
- progress.offset);
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Publish is progressing (%llu/%llu at level %u off %llu)...\n",
+ (unsigned long long) event->value.publish.completed,
+ (unsigned long long) event->value.publish.size,
+ event->value.publish.specifics.progress.depth,
+ (unsigned long long) event->value.publish.specifics.
+ progress.offset);
break;
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
kuri = GNUNET_FS_uri_ksk_create_from_args (1, keywords);
case GNUNET_FS_STATUS_SEARCH_RESULT:
/* FIXME: consider_restart (event->status); cannot be tested with
* search result since we exit here after the first one... */
-#if VERBOSE
- printf ("Search complete.\n");
-#endif
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Search complete.\n");
GNUNET_SCHEDULER_add_continuation (&abort_search_task, NULL,
GNUNET_SCHEDULER_REASON_PREREQ_DONE);
break;
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",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfgname, NULL);
-#endif
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *c)
{
const char *keywords[] = {
struct GNUNET_FS_BlockOptions bo;
cfg = c;
- setup_peer (&p1, "test_fs_search_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-search-persistence", &progress_cb, NULL,
GNUNET_FS_FLAGS_PERSISTENCE, GNUNET_FS_OPTIONS_END);
GNUNET_assert (NULL != fs);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-search-persistence",
- "-c",
- "test_fs_search_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-search/");
- GNUNET_log_setup ("test_fs_search_persistence",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-search-persistence", "nohelp", options, &run,
- NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-search/");
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-search-persistence",
+ "test_fs_search_data.conf",
+ &run, NULL))
+ return 1;
return 0;
}
*/
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define START_ARM GNUNET_YES
/**
* File-size we use for testing.
*/
#define LIFETIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15)
-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;
static struct GNUNET_TIME_Absolute start;
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 (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const char *keywords[] = {
struct GNUNET_FS_FileInformation *fi;
size_t i;
- setup_peer (&p1, "test_fs_search_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-search", &progress_cb, NULL,
GNUNET_FS_FLAGS_DO_PROBES,
GNUNET_FS_OPTIONS_END);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-search-probes",
- "-c",
- "test_fs_search_data.conf",
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_log_setup ("test_fs_search_probes",
- "WARNING",
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-search", "nohelp", options, &run, NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs-search/");
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-search-probes",
+ "test_fs_search_data.conf",
+ &run, NULL))
+ return 1;
return 0;
}
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_start_stop.c
* @brief testcase for fs.c (start-stop only)
#include "platform.h"
#include "gnunet_util_lib.h"
-#include "gnunet_arm_service.h"
+#include "gnunet_testing_lib-new.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_NO
-
-#define START_ARM GNUNET_YES
-
-static struct PeerContext p1;
-
-struct PeerContext
-{
- struct GNUNET_CONFIGURATION_Handle *cfg;
-#if START_ARM
- struct GNUNET_OS_Process *arm_proc;
-#endif
-};
-
static void *
progress_cb (void *cls, const struct GNUNET_FS_ProgressInfo *event)
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",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- "-c", cfgname, NULL);
-#endif
- GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname));
-}
-
-
-static void
-stop_arm (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);
-}
-
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_FS_Handle *fs;
- setup_peer (&p1, "test_fs_data.conf");
fs = GNUNET_FS_start (cfg, "test-fs-start-stop", &progress_cb, NULL,
GNUNET_FS_FLAGS_NONE, GNUNET_FS_OPTIONS_END);
GNUNET_assert (NULL != fs);
int
main (int argc, char *argv[])
{
- char *const argvx[] = {
- "test-fs-start-stop",
- "-c",
- "test_fs_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- GNUNET_log_setup ("test_fs_start_stop",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
- GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
- "test-fs-start-stop", "nohelp", options, &run, NULL);
- stop_arm (&p1);
- GNUNET_DISK_directory_remove ("/tmp/gnunet-test-fs/");
+ if (0 != GNUNET_TESTING_peer_run ("test-fs-start-stop",
+ "test_fs_data.conf",
+ &run, NULL))
+ return 1;
return 0;
}
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file fs/test_fs_uri.c
* @brief Test for fs_uri.c
* @author Christian Grothoff
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
#include "fs_api.h"
-#define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); return 1; }
static int
testKeyword ()
if (NULL != (ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/++", &emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg);
if (ret == NULL)
{
GNUNET_free (emsg);
- ABORT ();
+ GNUNET_assert (0);
}
if (!GNUNET_FS_uri_test_ksk (ret))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
if ((2 != ret->data.ksk.keywordCount) ||
(0 != strcmp (" foo", ret->data.ksk.keywords[0])) ||
(0 != strcmp (" bar", ret->data.ksk.keywords[1])))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
uri = GNUNET_FS_uri_to_string (ret);
{
GNUNET_free (uri);
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (uri);
GNUNET_FS_uri_destroy (ret);
return 0;
}
+
static int
testLocation ()
{
return 0;
}
+
static int
testNamespace (int i)
{
&emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
if (NULL !=
("gnunet://fs/sks/D1KJS9H2A82Q65VKQ0ML3RFU6U1D3V/test", &emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
if (NULL != (ret = GNUNET_FS_uri_parse ("gnunet://fs/sks/test", &emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
ret =
if (ret == NULL)
{
GNUNET_free (emsg);
- ABORT ();
+ GNUNET_assert (0);
}
if (GNUNET_FS_uri_test_ksk (ret))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
if (!GNUNET_FS_uri_test_sks (ret))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
uri = GNUNET_FS_uri_to_string (ret);
{
GNUNET_FS_uri_destroy (ret);
GNUNET_free (uri);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (uri);
GNUNET_FS_uri_destroy (ret);
&emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
if (NULL !=
&emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
if (NULL !=
&emsg)))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (emsg);
ret =
if (ret == NULL)
{
GNUNET_free (emsg);
- ABORT ();
+ GNUNET_assert (0);
}
if (GNUNET_FS_uri_test_ksk (ret))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
if (GNUNET_FS_uri_test_sks (ret))
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
if (GNUNET_ntohll (ret->data.chk.file_length) != 42)
{
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
uri = GNUNET_FS_uri_to_string (ret);
{
GNUNET_free (uri);
GNUNET_FS_uri_destroy (ret);
- ABORT ();
+ GNUNET_assert (0);
}
GNUNET_free (uri);
GNUNET_FS_uri_destroy (ret);
return 0;
}
+
int
main (int argc, char *argv[])
{
int i;
GNUNET_log_setup ("test_fs_uri",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
GNUNET_CRYPTO_random_disable_entropy_gathering ();
failureCount += testKeyword ();