aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/torture.c22
-rw-r--r--tests/torture.h6
-rw-r--r--tests/unittests/torture_algorithms.c25
-rw-r--r--tests/unittests/torture_init.c23
-rw-r--r--tests/unittests/torture_keyfiles.c25
-rw-r--r--tests/unittests/torture_knownhosts.c24
-rw-r--r--tests/unittests/torture_list.c26
-rw-r--r--tests/unittests/torture_misc.c25
-rw-r--r--tests/unittests/torture_options.c25
-rw-r--r--tests/unittests/torture_proxycommand.c26
10 files changed, 36 insertions, 191 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;
+}
diff --git a/tests/torture.h b/tests/torture.h
index 542b2757..2be45644 100644
--- a/tests/torture.h
+++ b/tests/torture.h
@@ -31,4 +31,10 @@ void torture_create_case_fixture(Suite *s, const char *name, TFun function,
void torture_create_case_timeout(Suite *s, const char *name, TFun function,
int timeout);
+/*
+ * This function must be defined in every unit test file.
+ */
+Suite *torture_make_suite(void);
+
+
#endif /* _TORTURE_H */
diff --git a/tests/unittests/torture_algorithms.c b/tests/unittests/torture_algorithms.c
index dcaca216..300fe054 100644
--- a/tests/unittests/torture_algorithms.c
+++ b/tests/unittests/torture_algorithms.c
@@ -119,7 +119,7 @@ START_TEST (torture_algorithms_zlib)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_algorithms");
torture_create_case_fixture(s, "torture_algorithms_aes128-cbc",
@@ -142,26 +142,3 @@ static Suite *torture_make_suite(void) {
torture_algorithms_zlib, setup, teardown);
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;
-}
diff --git a/tests/unittests/torture_init.c b/tests/unittests/torture_init.c
index 8299cf67..8b09d36b 100644
--- a/tests/unittests/torture_init.c
+++ b/tests/unittests/torture_init.c
@@ -13,7 +13,7 @@ START_TEST (torture_ssh_init)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_init");
torture_create_case(s, "torture_ssh_init", torture_ssh_init);
@@ -21,26 +21,5 @@ static Suite *torture_make_suite(void) {
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;
-}
diff --git a/tests/unittests/torture_keyfiles.c b/tests/unittests/torture_keyfiles.c
index 7f57b5bf..d99ac0a3 100644
--- a/tests/unittests/torture_keyfiles.c
+++ b/tests/unittests/torture_keyfiles.c
@@ -223,7 +223,7 @@ START_TEST(torture_privatekey_from_file_passphrase){
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_keyfiles");
torture_create_case_fixture(s, "torture_pubkey_from_file",
@@ -238,26 +238,3 @@ static Suite *torture_make_suite(void) {
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;
-}
-
diff --git a/tests/unittests/torture_knownhosts.c b/tests/unittests/torture_knownhosts.c
index 2f38bfd2..2a7cdab9 100644
--- a/tests/unittests/torture_knownhosts.c
+++ b/tests/unittests/torture_knownhosts.c
@@ -76,7 +76,7 @@ START_TEST (torture_knownhosts_port)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_knownhosts");
torture_create_case_fixture(s, "torture_knownhosts_port",
@@ -84,25 +84,3 @@ static Suite *torture_make_suite(void) {
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;
-}
diff --git a/tests/unittests/torture_list.c b/tests/unittests/torture_list.c
index 8a82072a..d954100a 100644
--- a/tests/unittests/torture_list.c
+++ b/tests/unittests/torture_list.c
@@ -76,7 +76,7 @@ START_TEST(torture_ssh_list_prepend)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_list");
torture_create_case(s, "torture_ssh_list_new", torture_ssh_list_new);
@@ -85,27 +85,3 @@ static Suite *torture_make_suite(void) {
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;
-}
-
diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c
index 6904997e..5996bd97 100644
--- a/tests/unittests/torture_misc.c
+++ b/tests/unittests/torture_misc.c
@@ -117,7 +117,7 @@ START_TEST (torture_path_expand_escape)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_misc");
torture_create_case(s, "torture_get_user_home_dir", torture_get_user_home_dir);
@@ -131,26 +131,3 @@ static Suite *torture_make_suite(void) {
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;
-}
-
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index ec173f24..5a83a2fd 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -119,7 +119,7 @@ START_TEST (torture_options_set_identity)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_options");
torture_create_case_fixture(s, "torture_options_set_host",
@@ -136,26 +136,3 @@ static Suite *torture_make_suite(void) {
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;
-}
-
diff --git a/tests/unittests/torture_proxycommand.c b/tests/unittests/torture_proxycommand.c
index 8bc601c3..3ee30a74 100644
--- a/tests/unittests/torture_proxycommand.c
+++ b/tests/unittests/torture_proxycommand.c
@@ -41,7 +41,7 @@ START_TEST (torture_options_set_proxycommand_notexist)
}
END_TEST
-static Suite *torture_make_suite(void) {
+Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_proxycommand");
torture_create_case_fixture(s, "torture_options_set_proxycommand",
@@ -52,27 +52,3 @@ static Suite *torture_make_suite(void) {
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;
-}
-