2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 * @file fs/test_gnunet_service_fs_p2p.c
23 * @brief test P2P routing using simple publish + download operation
24 * @author Christian Grothoff
27 #include "test_fs_lib.h"
29 #define VERBOSE GNUNET_NO
32 * File-size we use for testing.
34 #define FILESIZE (1024 * 1024 * 2)
37 * How long until we give up on transmitting the message?
39 #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
45 static struct GNUNET_FS_TestDaemon *daemons[NUM_DAEMONS];
47 static struct GNUNET_SCHEDULER_Handle *sched;
52 const struct GNUNET_SCHEDULER_TaskContext *tc)
54 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
55 GNUNET_FS_TEST_daemons_stop (sched,
62 do_download (void *cls,
63 const struct GNUNET_FS_Uri *uri)
65 GNUNET_assert (NULL != uri);
66 GNUNET_FS_TEST_download (sched,
76 do_publish (void *cls,
77 const struct GNUNET_SCHEDULER_TaskContext *tc)
79 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
80 GNUNET_FS_TEST_publish (sched,
83 1, GNUNET_NO, FILESIZE, SEED,
90 do_connect (void *cls,
91 const struct GNUNET_SCHEDULER_TaskContext *tc)
93 GNUNET_assert (0 != (tc->reason & GNUNET_SCHEDULER_REASON_PREREQ_DONE));
94 GNUNET_FS_TEST_daemons_connect (sched,
105 struct GNUNET_SCHEDULER_Handle *s,
108 const struct GNUNET_CONFIGURATION_Handle *cfg)
111 GNUNET_FS_TEST_daemons_start (sched,
121 main (int argc, char *argv[])
123 char *const argvx[] = {
124 "test-gnunet-service-fs-p2p",
126 "test_fs_lib_data.conf",
132 struct GNUNET_GETOPT_CommandLineOption options[] = {
133 GNUNET_GETOPT_OPTION_END
136 GNUNET_log_setup ("test_gnunet_service_fs_p2p",
143 GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
144 argvx, "test-gnunet-service-fs-p2p",
145 "nohelp", options, &run, NULL);
149 /* end of test_gnunet_service_fs_p2p.c */