[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-ext] branch master updated: update test as well
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-ext] branch master updated: update test as well |
Date: |
Sat, 25 Feb 2017 03:40:10 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet-ext.
The following commit(s) were added to refs/heads/master by this push:
new 2f5a56e update test as well
2f5a56e is described below
commit 2f5a56e69f618000c16c0aceaaa46aeeb56ba8c2
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Feb 25 03:40:08 2017 +0100
update test as well
---
src/ext/test_ext_api.c | 74 +++++++++++++++++++++++++++++++++-----------------
1 file changed, 49 insertions(+), 25 deletions(-)
diff --git a/src/ext/test_ext_api.c b/src/ext/test_ext_api.c
index c987108..75a7cc4 100644
--- a/src/ext/test_ext_api.c
+++ b/src/ext/test_ext_api.c
@@ -26,9 +26,15 @@
#include "gnunet_ext_service.h"
+/**
+ * Return value from #main(). Set to 0 to mark test as passing.
+ */
static int ok = 1;
+/**
+ * Main function of the test.
+ */
static void
run (void *cls,
char *const *args,
@@ -39,58 +45,76 @@ run (void *cls,
}
-static void
-check ()
+/**
+ * Launches the gnunet-service-ext and then the #run() function
+ * with some specified arguments, allowing it to then interact
+ * with the 'ext' service.
+ *
+ * Note that you may want to use libgnunettesting or
+ * libgnunettestbed to launch a "full" peer instead of just
+ * a single service.
+ *
+ * @param argc ignored
+ * @param argv ignored
+ * @return 77 if we failed to find gnunet-service-ext
+ */
+int
+main (int argc,
+ char *argv[])
{
- char *const argv[] = { "test-ext-api", NULL };
+ char *const ext_argv[] = {
+ "test-ext-api",
+ NULL
+ };
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
struct GNUNET_OS_Process *proc;
- char *path = GNUNET_OS_get_libexec_binary_path ("gnunet-service-ext");
+ char *path;
+ GNUNET_log_setup ("test_ext_api",
+ "WARNING",
+ NULL);
+ path = GNUNET_OS_get_libexec_binary_path ("gnunet-service-ext");
if (NULL == path)
{
fprintf (stderr,
"Failed to determine path for `%s'\n",
"gnunet-service-ext");
- ok = 77;
- return;
+ return 77;
}
-
proc = GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ALL,
NULL,
- NULL, NULL, path,
- "gnunet-service-ext", NULL);
+ NULL,
+ NULL,
+ path,
+ "gnunet-service-ext",
+ NULL);
GNUNET_free (path);
if (NULL == proc)
{
fprintf (stderr,
"Service executable not found `%s'\n",
"gnunet-service-ext");
- ok = 77;
- return;
+ return 77;
}
- GNUNET_PROGRAM_run (1, argv, "test-ext-api", "nohelp",
- options, &run, &ok);
- if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
+ GNUNET_PROGRAM_run (1,
+ ext_argv,
+ "test-ext-api",
+ "nohelp",
+ options,
+ &run,
+ &ok);
+ if (0 != GNUNET_OS_process_kill (proc,
+ SIGTERM))
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+ "kill");
ok = 1;
}
GNUNET_OS_process_wait (proc);
GNUNET_OS_process_destroy (proc);
-}
-
-
-int
-main (int argc, char *argv[])
-{
- GNUNET_log_setup ("test_statistics_api",
- "WARNING",
- NULL);
- check ();
return ok;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet-ext] branch master updated: update test as well,
gnunet <=