aboutsummaryrefslogtreecommitdiff
path: root/tests/torture.c
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2010-05-18 22:25:06 +0200
committerAris Adamantiadis <aris@0xbadc0de.be>2010-05-18 22:25:06 +0200
commitf95157297e1c6dc0cf1fce12d3e10bb16fbf40f8 (patch)
treed0805c50f5af648abc204306009c2e555f263521 /tests/torture.c
parent89993dd75713b68f4ffebf9a30d03b1991c25b15 (diff)
downloadlibssh-f95157297e1c6dc0cf1fce12d3e10bb16fbf40f8.tar.gz
libssh-f95157297e1c6dc0cf1fce12d3e10bb16fbf40f8.tar.xz
libssh-f95157297e1c6dc0cf1fce12d3e10bb16fbf40f8.zip
Factorize all the main functions in unit tests
Diffstat (limited to 'tests/torture.c')
-rw-r--r--tests/torture.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/torture.c b/tests/torture.c
index 6fa4c459..6b7484e9 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -24,3 +24,25 @@ void torture_create_case_timeout(Suite *s, const char *name, TFun function, int
tcase_add_test(tc_new, function);
}
+int main(int argc, char **argv) {
+ Suite *s = NULL;
+ SRunner *sr = NULL;
+ struct argument_s arguments;
+ int nf;
+
+ memset(&arguments,0,sizeof(struct argument_s));
+
+ 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;
+}