2 This file is part of GNUnet
3 Copyright (C) 2008--2013 GNUnet e.V.
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 3, 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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @file src/testbed/test_testbed_api_test.c
23 * @brief testing cases for testing notications via test master callback upon
24 * timeout while setting up testbed using functions
25 * GNUNET_TESTBED_test_run()
26 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
30 #include "gnunet_util_lib.h"
31 #include "gnunet_testbed_service.h"
35 * Generic logging shortcut
37 #define LOG(kind,...) \
38 GNUNET_log (kind, __VA_ARGS__)
41 * Number of peers we want to start
52 * shortcut to exit during failure
54 #define FAIL_TEST(cond) do { \
57 GNUNET_SCHEDULER_shutdown (); \
64 * Controller event callback
67 * @param event the controller event
70 controller_event_cb (void *cls,
71 const struct GNUNET_TESTBED_EventInformation *event)
78 * Signature of a main function for a testcase.
81 * @param h the run handle
82 * @param num_peers number of peers in 'peers'
83 * @param peers- handle to peers run in the testbed
84 * @param links_succeeded the number of overlay link connection attempts that
86 * @param links_failed the number of overlay link connection attempts that
90 test_master (void *cls,
91 struct GNUNET_TESTBED_RunHandle *h,
92 unsigned int num_peers,
93 struct GNUNET_TESTBED_Peer **peers_,
94 unsigned int links_succeeded,
95 unsigned int links_failed)
97 FAIL_TEST (NULL == cls);
98 FAIL_TEST (0 == num_peers);
99 FAIL_TEST (NULL == peers_);
101 GNUNET_SCHEDULER_shutdown ();
109 main (int argc, char **argv)
113 result = GNUNET_SYSERR;
115 (void) GNUNET_TESTBED_test_run ("test_testbed_api_test",
116 "test_testbed_api_test_timeout.conf", NUM_PEERS,
117 event_mask, &controller_event_cb, NULL,
119 if (GNUNET_OK != result)
124 /* end of test_testbed_api_test.c */