aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-07 13:39:08 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-07 13:39:08 +0200
commit431d8fe7c798b00c9d193bbaab7a57695554c229 (patch)
tree6f181446aea00b66ccfcbbfc649c250f631564bd /tests
parent9ee4d6c697a638db4bb883f8027cf048b2f05c70 (diff)
downloadlibssh-431d8fe7c798b00c9d193bbaab7a57695554c229.tar.gz
libssh-431d8fe7c798b00c9d193bbaab7a57695554c229.tar.xz
libssh-431d8fe7c798b00c9d193bbaab7a57695554c229.zip
The actual init test
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/torture_init.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/unittests/torture_init.c b/tests/unittests/torture_init.c
new file mode 100644
index 00000000..8299cf67
--- /dev/null
+++ b/tests/unittests/torture_init.c
@@ -0,0 +1,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;
+}
+