aboutsummaryrefslogtreecommitdiff
path: root/tests/unittests/torture_init.c
blob: 8299cf67d58f8d51f54ab88dc4f6025525972e74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#define LIBSSH_STATIC
#include <libssh/libssh.h>
#include "libssh/priv.h"
#include "torture.h"

START_TEST (torture_ssh_init)
{
    int rc;
    rc=ssh_init();
    ck_assert_int_eq(rc,SSH_OK);
    rc=ssh_finalize();
    ck_assert_int_eq(rc,SSH_OK);
}
END_TEST

static Suite *torture_make_suite(void) {
  Suite *s = suite_create("libssh_init");

  torture_create_case(s, "torture_ssh_init", torture_ssh_init);

  return s;
}

int main(int argc, char **argv) {
  Suite *s = NULL;
  SRunner *sr = NULL;
  struct argument_s arguments;
  int nf;

  ZERO_STRUCT(arguments);

  torture_cmdline_parse(argc, argv, &arguments);

  s = torture_make_suite();

  sr = srunner_create(s);
  if (arguments.nofork) {
    srunner_set_fork_status(sr, CK_NOFORK);
  }
  srunner_run_all(sr, CK_VERBOSE);
  nf = srunner_ntests_failed(sr);
  srunner_free(sr);

  return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}