*/
/**
- * @file fs/test_fs_namespace.c
- * @brief Test for fs_namespace.c
+ * @file fs/test_fs_namespace_list_updateable.c
+ * @brief Test for fs_namespace_list_updateable.c
* @author Christian Grothoff
- *
- * TODO:
- * - add timeout task
*/
#include "platform.h"
#include "gnunet_util_lib.h"
#define START_ARM GNUNET_YES
-static struct GNUNET_SCHEDULER_Handle *sched;
-
static struct PeerContext p1;
static struct GNUNET_FS_Handle *fs;
{
struct GNUNET_CONFIGURATION_Handle *cfg;
#if START_ARM
- pid_t arm_pid;
+ struct GNUNET_OS_Process *arm_proc;
#endif
};
{
p->cfg = GNUNET_CONFIGURATION_create ();
#if START_ARM
- p->arm_pid = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
+ p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm",
"gnunet-service-arm",
#if VERBOSE
"-L", "DEBUG",
stop_arm (struct PeerContext *p)
{
#if START_ARM
- if (0 != PLIBC_KILL (p->arm_pid, SIGTERM))
+ 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_pid) != GNUNET_OK)
+ 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", p->arm_pid);
+ "ARM process %u stopped\n", GNUNET_OS_process_get_pid (p->arm_proc));
+ GNUNET_OS_process_close (p->arm_proc);
+ p->arm_proc = NULL;
#endif
if (uri_this != NULL)
GNUNET_FS_uri_destroy (uri_this);
+static void
+check_next (void *cls,
+ const char *last_id,
+ const struct GNUNET_FS_Uri *last_uri,
+ const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const char *next_id)
+{
+ GNUNET_break (0 == strcmp (last_id, "next"));
+ GNUNET_break (0 == strcmp (next_id, "future"));
+ err -= 4;
+}
+
+
+static void
+check_this_next (void *cls,
+ const char *last_id,
+ const struct GNUNET_FS_Uri *last_uri,
+ const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const char *next_id)
+{
+ GNUNET_break (0 == strcmp (last_id, "this"));
+ GNUNET_break (0 == strcmp (next_id, "next"));
+ err -= 2;
+ err += 4;
+ GNUNET_FS_namespace_list_updateable (ns,
+ next_id,
+ &check_next,
+ NULL);
+}
+
+
static void
sks_cont_next (void *cls,
const struct GNUNET_FS_Uri *uri,
const char *emsg)
{
GNUNET_assert (NULL == emsg);
+ err += 2;
+ GNUNET_FS_namespace_list_updateable (ns,
+ NULL,
+ &check_this_next,
+ NULL);
+
+}
+
+
+static void
+check_this (void *cls,
+ const char *last_id,
+ const struct GNUNET_FS_Uri *last_uri,
+ const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const char *next_id)
+{
+ GNUNET_break (0 == strcmp (last_id, "this"));
+ GNUNET_break (0 == strcmp (next_id, "next"));
+ err -= 1;
}
const char *emsg)
{
GNUNET_assert (NULL == emsg);
-
+ err = 1;
+ GNUNET_FS_namespace_list_updateable (ns,
+ NULL,
+ &check_this,
+ NULL);
GNUNET_FS_publish_sks (fs,
ns,
"next",
static void
run (void *cls,
- struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
- sched = s;
setup_peer (&p1, "test_fs_namespace_data.conf");
- fs = GNUNET_FS_start (sched,
- cfg,
+ fs = GNUNET_FS_start (cfg,
"test-fs-namespace",
&progress_cb,
NULL,