diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-12-28 13:43:32 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-12-28 22:14:47 +0100 |
commit | 635a263f64ea39e2fed9e95be4c3cc425aee9302 (patch) | |
tree | 6583036e372f6e20971f8a9307dac1ba5c7d6bfb /tests/cmdline.c | |
parent | 17f592d4dd25eae98b1a8378625adc454976fcb6 (diff) | |
download | libssh-635a263f64ea39e2fed9e95be4c3cc425aee9302.tar.gz libssh-635a263f64ea39e2fed9e95be4c3cc425aee9302.tar.xz libssh-635a263f64ea39e2fed9e95be4c3cc425aee9302.zip |
tests: Migrate the torture library to cmockery.
Diffstat (limited to 'tests/cmdline.c')
-rw-r--r-- | tests/cmdline.c | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/tests/cmdline.c b/tests/cmdline.c deleted file mode 100644 index e179037..0000000 --- a/tests/cmdline.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "config.h" -#include "torture.h" - -#ifdef HAVE_ARGP_H -#include <argp.h> - - -const char *argp_program_version = "check test 0.1"; -const char *argp_program_bug_address = "<csync-devel@csync.org>"; - -static char **cmdline; - -/* Program documentation. */ -static char doc[] = "check test"; - -/* The options we understand. */ -static struct argp_option options[] = { - { - .name = "no-fork", - .key = 'n', - .arg = NULL, - .flags = 0, - .doc = "Don't fork the testcases", - .group = 0 - }, - { - .name = "verbose", - .key = 'v', - .arg = NULL, - .flags = 0, - .doc = "Make libssh test more verbose", - .group = 0 - }, - {NULL, 0, NULL, 0, NULL, 0} -}; - -/* Parse a single option. */ -static error_t parse_opt (int key, char *arg, struct argp_state *state) { - /* Get the input argument from argp_parse, which we - * know is a pointer to our arguments structure. - */ - struct argument_s *arguments = state->input; - - /* arg is currently not used */ - (void) arg; - - switch (key) { - case 'n': - arguments->nofork = 1; - break; - case 'v': - arguments->verbose++; - break; - case ARGP_KEY_ARG: - /* End processing here. */ - cmdline = &state->argv [state->next - 1]; - state->next = state->argc; - break; - default: - return ARGP_ERR_UNKNOWN; - } - - return 0; -} - -/* Our argp parser. */ -/* static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL}; */ -static struct argp argp = {options, parse_opt, NULL, doc, NULL, NULL, NULL}; -#endif /* HAVE_ARGP_H */ - -void torture_cmdline_parse(int argc, char **argv, struct argument_s *arguments) { - /* - * Parse our arguments; every option seen by parse_opt will - * be reflected in arguments. - */ -#ifdef HAVE_ARGP_H - argp_parse(&argp, argc, argv, 0, 0, arguments); -#endif /* HAVE_ARGP_H */ -} - |