- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
-
- char *const argv_prog[] = {
- "test-stun",
- NULL
- };
- GNUNET_log_setup ("test-stun",
- "WARNING",
- NULL);
-
- GNUNET_PROGRAM_run (1, argv_prog, "test-stun", "nohelp", options, &run, NULL);
-
- return ret;
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_END
+ };
+ char *const argv_prog[] = {
+ "test-stun",
+ "-c",
+ "test_stun.conf",
+ NULL
+ };
+ char *fn;
+ struct GNUNET_OS_Process *proc;
+
+ GNUNET_log_setup ("test-stun",
+ "WARNING",
+ NULL);
+
+ /* Lets start resolver */
+ fn = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver");
+ proc = GNUNET_OS_start_process (GNUNET_YES,
+ GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
+ NULL, NULL, NULL,
+ fn,
+ "gnunet-service-resolver",
+ "-c", "test_stun.conf", NULL);
+
+ if (NULL == proc)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "This test was unable to start gnunet-service-resolver, and it is required to run ...\n");
+ exit(1);
+ }
+
+ GNUNET_PROGRAM_run (3, argv_prog,
+ "test-stun", "nohelp",
+ options,
+ &run, NULL);
+
+ /* Now kill the resolver */
+ if (0 != GNUNET_OS_process_kill (proc, GNUNET_TERM_SIG))
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "kill");
+ }
+ GNUNET_OS_process_wait (proc);
+ GNUNET_OS_process_destroy (proc);
+ proc = NULL;
+ GNUNET_free (fn);
+
+ return ret;