projects
/
oweals
/
gnunet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
maintain argv for helpers
[oweals/gnunet.git]
/
src
/
arm
/
test_arm_api.c
diff --git
a/src/arm/test_arm_api.c
b/src/arm/test_arm_api.c
index 6952b2e59e5d1e2c7ba93f5a92a93fac41abad66..e9bda410b0c33faa4bccddad8541f90c58f2f690 100644
(file)
--- a/
src/arm/test_arm_api.c
+++ b/
src/arm/test_arm_api.c
@@
-1,6
+1,6
@@
/*
This file is part of GNUnet.
/*
This file is part of GNUnet.
- (C) 2009 Christian Grothoff (and other contributing authors)
+ (C) 2009
, 2011
Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@
-30,11
+30,9
@@
#include "gnunet_program_lib.h"
#include "gnunet_resolver_service.h"
#include "gnunet_program_lib.h"
#include "gnunet_resolver_service.h"
-#define VERBOSE GNUNET_NO
-
#define START_ARM GNUNET_YES
#define START_ARM GNUNET_YES
-#define START_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
+#define START_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
1
500)
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15)
@@
-45,18
+43,20
@@
static struct GNUNET_ARM_Handle *arm;
static int ok = 1;
static void
static int ok = 1;
static void
-arm_stopped (void *cls,
int
success)
+arm_stopped (void *cls,
enum GNUNET_ARM_ProcessStatus
success)
{
{
- if (success != GNUNET_NO)
+ GNUNET_break (success == GNUNET_ARM_PROCESS_DOWN);
+ if (success != GNUNET_ARM_PROCESS_DOWN)
ok = 3;
else if (ok == 1)
ok = 0;
}
ok = 3;
else if (ok == 1)
ok = 0;
}
+
static void
static void
-arm_notify_stop (void *cls,
int
success)
+arm_notify_stop (void *cls,
enum GNUNET_ARM_ProcessStatus
success)
{
{
- GNUNET_
assert (success == GNUNET_NO
);
+ GNUNET_
break (success == GNUNET_ARM_PROCESS_DOWN
);
#if START_ARM
GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
#endif
#if START_ARM
GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
#endif
@@
-73,18
+73,19
@@
dns_notify (void *cls, const struct sockaddr *addr, socklen_t addrlen)
GNUNET_break (0);
ok = 2;
}
GNUNET_break (0);
ok = 2;
}
- GNUNET_ARM_stop_service (arm, "resolver", TIMEOUT, &arm_notify_stop, NULL);
+ GNUNET_ARM_stop_service (arm, "resolver", TIMEOUT, &arm_notify_stop,
+ NULL);
return;
}
return;
}
- GNUNET_
assert
(addr != NULL);
+ GNUNET_
break
(addr != NULL);
ok = 0;
}
static void
ok = 0;
}
static void
-resolver_notify (void *cls,
int
success)
+resolver_notify (void *cls,
enum GNUNET_ARM_ProcessStatus
success)
{
{
- if (success != GNUNET_
YES
)
+ if (success != GNUNET_
ARM_PROCESS_STARTING
)
{
GNUNET_break (0);
ok = 2;
{
GNUNET_break (0);
ok = 2;
@@
-93,15
+94,14
@@
resolver_notify (void *cls, int success)
#endif
return;
}
#endif
return;
}
- GNUNET_RESOLVER_ip_get (cfg,
- "localhost", AF_INET, TIMEOUT, &dns_notify, NULL);
+ GNUNET_RESOLVER_ip_get ("localhost", AF_INET, TIMEOUT, &dns_notify, NULL);
}
static void
}
static void
-arm_notify (void *cls,
int
success)
+arm_notify (void *cls,
enum GNUNET_ARM_ProcessStatus
success)
{
{
- if (success != GNUNET_
YES
)
+ if (success != GNUNET_
ARM_PROCESS_STARTING
)
{
GNUNET_break (0);
ok = 2;
{
GNUNET_break (0);
ok = 2;
@@
-109,20
+109,19
@@
arm_notify (void *cls, int success)
GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
#endif
}
GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL);
#endif
}
- GNUNET_ARM_start_service (arm, "resolver", START_TIMEOUT, &resolver_notify, NULL);
+ GNUNET_ARM_start_service (arm, "resolver", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &resolver_notify,
+ NULL);
}
static void
}
static void
-task (void *cls,
- char *const *args,
- const char *cfgfile,
+task (void *cls, char *const *args, const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *c)
{
cfg = c;
arm = GNUNET_ARM_connect (cfg, NULL);
#if START_ARM
const struct GNUNET_CONFIGURATION_Handle *c)
{
cfg = c;
arm = GNUNET_ARM_connect (cfg, NULL);
#if START_ARM
- GNUNET_ARM_start_service (arm, "arm", START_TIMEOUT, &arm_notify, NULL);
+ GNUNET_ARM_start_service (arm, "arm",
GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
START_TIMEOUT, &arm_notify, NULL);
#else
arm_notify (NULL, GNUNET_YES);
#endif
#else
arm_notify (NULL, GNUNET_YES);
#endif
@@
-136,19
+135,15
@@
check ()
char *const argv[] = {
"test-arm-api",
"-c", "test_arm_api_data.conf",
char *const argv[] = {
"test-arm-api",
"-c", "test_arm_api_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
GNUNET_assert (GNUNET_OK ==
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
};
GNUNET_assert (GNUNET_OK ==
- GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
- argv,
- "test-arm-api",
- "nohelp", options, &task, NULL));
+ GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1,
+ argv, "test-arm-api", "nohelp", options,
+ &task, NULL));
return ok;
}
return ok;
}
@@
-159,12
+154,8
@@
main (int argc, char *argv[])
GNUNET_log_setup ("test-arm-api",
GNUNET_log_setup ("test-arm-api",
-#if VERBOSE
- "DEBUG",
-#else
- "WARNING",
-#endif
- NULL);
+ "WARNING",
+ NULL);
ret = check ();
return ret;
ret = check ();
return ret;