aboutsummaryrefslogtreecommitdiff
path: root/src/conversation/test_conversation_api.c
diff options
context:
space:
mode:
authorAndreas Fuchs <fuchandr@in.tum.de>2013-10-01 12:44:50 +0000
committerAndreas Fuchs <fuchandr@in.tum.de>2013-10-01 12:44:50 +0000
commit2b9080ac724c387cdc7197d1b476e138cdc280dd (patch)
tree85acf5cfe5dcb73afb704d0e5f66e4fea9dac6ef /src/conversation/test_conversation_api.c
parent2b8aa2e755da70f7e52ae99ed9dfcf8d94cd75d4 (diff)
downloadgnunet-2b9080ac724c387cdc7197d1b476e138cdc280dd.tar.gz
gnunet-2b9080ac724c387cdc7197d1b476e138cdc280dd.zip
Added test file for conversation
Diffstat (limited to 'src/conversation/test_conversation_api.c')
-rw-r--r--src/conversation/test_conversation_api.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c
new file mode 100644
index 000000000..7860eb794
--- /dev/null
+++ b/src/conversation/test_conversation_api.c
@@ -0,0 +1,85 @@
1/*
2 This file is part of GNUnet.
3 (C)
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 * @file src/test_conversation_api.c
22 * @brief testcase for conversation_api.c
23 */
24#include <gnunet/platform.h>
25#include <gnunet/gnunet_util_lib.h>
26#include "gnunet_conversation_service.h"
27
28
29static int ok = 1;
30
31
32static void
33run (void *cls,
34 char *const *args,
35 const char *cfgfile,
36 const struct GNUNET_CONFIGURATION_Handle *cfg)
37{
38 ok = 0;
39}
40
41
42static int
43check ()
44{
45 char *const argv[] = { "test-conversation-api", NULL };
46 struct GNUNET_GETOPT_CommandLineOption options[] = {
47 GNUNET_GETOPT_OPTION_END
48 };
49 struct GNUNET_OS_Process *proc;
50 char *path = GNUNET_OS_get_libexec_binary_path ( "gnunet-service-conversation");
51 if (NULL == path)
52 {
53 fprintf (stderr, "Service executable not found `%s'\n", "gnunet-service-conversation");
54 return;
55 }
56 proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL,
57 path,
58 "gnunet-service-conversation",
59 NULL);
60
61 GNUNET_free (path);
62 GNUNET_assert (NULL != proc);
63 GNUNET_PROGRAM_run (1, argv, "test-ext-conversation", "nohelp",
64 options, &run, &ok);
65 if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
66 {
67 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
68 ok = 1;
69 }
70 GNUNET_OS_process_wait (proc);
71 GNUNET_OS_process_destroy (proc);
72 return ok;
73}
74
75
76int
77main (int argc, char *argv[])
78{
79 GNUNET_log_setup ("test_conversation_api",
80 "WARNING",
81 NULL);
82 return check ();
83}
84
85/* end of test_conversation_api.c */