236e8478978c67fd58185196ac0508ae9c41dd27
[oweals/gnunet.git] / src / testing / test_testing_servicestartup.c
1 /*
2       This file is part of GNUnet
3       (C) 2008, 2009, 2012 Christian Grothoff (and other contributing authors)
4
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.
9
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.
14
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.
19  */
20
21 /**
22  * @file testing/test_testing_new_servicestartup.c
23  * @brief test case for testing service startup using new testing API
24  * @author Sree Harsha Totakura
25  */
26 #include "platform.h"
27 #include "gnunet_scheduler_lib.h"
28 #include "gnunet_testing_lib-new.h"
29
30
31 #define LOG(kind,...)                           \
32   GNUNET_log (kind, __VA_ARGS__)
33
34
35 /**
36  * Global test status
37  */
38 static int test_success;
39
40
41 /**
42  * The testing callback function
43  *
44  * @param cls NULL
45  * @param cfg the configuration with which the current testing service is run
46  */
47 static void
48 test_run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
49 {
50   GNUNET_assert (NULL == cls);
51   GNUNET_assert (NULL != cfg);
52   LOG (GNUNET_ERROR_TYPE_DEBUG, "Service arm started successfully\n");
53   test_success = GNUNET_YES;
54   GNUNET_SCHEDULER_shutdown ();
55 }
56
57
58 /**
59  * The main point of execution
60  */
61 int main (int argc, char *argv[])
62 {
63   test_success = GNUNET_NO;
64   GNUNET_assert (0 == GNUNET_TESTING_service_run ("test-testing-servicestartup",
65                                                   "arm",
66                                                   "test_testing_defaults.conf",
67                                                   &test_run,
68                                                   NULL));
69   return (GNUNET_YES == test_success) ? 0 : 1;
70 }
71
72 /* end of test_testing_servicestartup.c */
73