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 it
6 under the terms of the GNU General Public License as published
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your 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 Affero General Public License for more details.
17 * @file src/testbed/test_testbed_api_test.c
18 * @brief testing cases for testing notications via test master callback upon
19 * timeout while setting up testbed using functions
20 * GNUNET_TESTBED_test_run()
21 * @author Sree Harsha Totakura <sreeharsha@totakura.in>
25 #include "gnunet_util_lib.h"
26 #include "gnunet_testbed_service.h"
30 * Generic logging shortcut
32 #define LOG(kind,...) \
33 GNUNET_log (kind, __VA_ARGS__)
36 * Number of peers we want to start
47 * shortcut to exit during failure
49 #define FAIL_TEST(cond) do { \
52 GNUNET_SCHEDULER_shutdown (); \
59 * Controller event callback
62 * @param event the controller event
65 controller_event_cb (void *cls,
66 const struct GNUNET_TESTBED_EventInformation *event)
73 * Signature of a main function for a testcase.
76 * @param h the run handle
77 * @param num_peers number of peers in 'peers'
78 * @param peers- handle to peers run in the testbed
79 * @param links_succeeded the number of overlay link connection attempts that
81 * @param links_failed the number of overlay link connection attempts that
85 test_master (void *cls,
86 struct GNUNET_TESTBED_RunHandle *h,
87 unsigned int num_peers,
88 struct GNUNET_TESTBED_Peer **peers_,
89 unsigned int links_succeeded,
90 unsigned int links_failed)
92 FAIL_TEST (NULL == cls);
93 FAIL_TEST (0 == num_peers);
94 FAIL_TEST (NULL == peers_);
96 GNUNET_SCHEDULER_shutdown ();
104 main (int argc, char **argv)
108 result = GNUNET_SYSERR;
110 (void) GNUNET_TESTBED_test_run ("test_testbed_api_test",
111 "test_testbed_api_test_timeout.conf", NUM_PEERS,
112 event_mask, &controller_event_cb, NULL,
114 if (GNUNET_OK != result)
119 /* end of test_testbed_api_test.c */