diff options
author | Thomas Haller <thaller@redhat.com> | 2022-03-16 12:09:15 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-03-16 23:56:20 +0100 |
commit | 1fc3e07924fa38856ea76d5be1bd51d96932c072 (patch) | |
tree | eccc17c4304cd1840de6883f62e479695246251d /tests | |
parent | 7a3d6e23a0cfb80201ffe4a1377b9526bfe5470a (diff) | |
download | libnl-1fc3e07924fa38856ea76d5be1bd51d96932c072.tar.gz |
tests: refactor tests and add n-test-util helper library
- we have "check-all.c" and "check-direct.c", which contains the
main functions of the actual tests.
On the other hand, the other "check-{addr,attr,ematch-tree-clone}.c"
files only contained the test suites for "check-all.c". Rename
the latter to have a separate name prefix.
- rename "tests/util.h" to "tests/cksuite-all.h". It's really the
header that declares all the suites.
- add a "tests/nl-test-util.c" as a static helper library with
test code.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check-all.c | 4 | ||||
-rw-r--r-- | tests/cksuite-all-addr.c (renamed from tests/check-addr.c) | 2 | ||||
-rw-r--r-- | tests/cksuite-all-attr.c (renamed from tests/check-attr.c) | 2 | ||||
-rw-r--r-- | tests/cksuite-all-ematch-tree-clone.c (renamed from tests/check-ematch-tree-clone.c) | 2 | ||||
-rw-r--r-- | tests/cksuite-all.h | 11 | ||||
-rw-r--r-- | tests/nl-test-util.c | 3 | ||||
-rw-r--r-- | tests/nl-test-util.h | 8 | ||||
-rw-r--r-- | tests/util.h | 6 |
8 files changed, 27 insertions, 11 deletions
diff --git a/tests/check-all.c b/tests/check-all.c index f9c75c40..b8f9222a 100644 --- a/tests/check-all.c +++ b/tests/check-all.c @@ -5,7 +5,7 @@ #include <check.h> -#include "util.h" +#include "cksuite-all.h" static Suite *main_suite(void) { @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) { SRunner *runner; int nfailed; - + runner = srunner_create(main_suite()); /* Add testsuites below */ diff --git a/tests/check-addr.c b/tests/cksuite-all-addr.c index 8c61ea9c..3ae1feee 100644 --- a/tests/check-addr.c +++ b/tests/cksuite-all-addr.c @@ -7,7 +7,7 @@ #include <netlink/addr.h> #include <netlink/route/addr.h> -#include "util.h" +#include "cksuite-all.h" START_TEST(addr_alloc) { diff --git a/tests/check-attr.c b/tests/cksuite-all-attr.c index 0a375538..76e2ecef 100644 --- a/tests/check-attr.c +++ b/tests/cksuite-all-attr.c @@ -6,7 +6,7 @@ #include <linux/netlink.h> #include <linux/if_ether.h> -#include "util.h" +#include "cksuite-all.h" #include "netlink/attr.h" #include "netlink/msg.h" #include "netlink/route/cls/u32.h" diff --git a/tests/check-ematch-tree-clone.c b/tests/cksuite-all-ematch-tree-clone.c index 9f69646f..76684572 100644 --- a/tests/check-ematch-tree-clone.c +++ b/tests/cksuite-all-ematch-tree-clone.c @@ -5,7 +5,7 @@ #include "netlink-private/types.h" #include "netlink/route/cls/ematch.h" -#include "util.h" +#include "cksuite-all.h" #include "netlink-private/nl-auto.h" #define MAX_DEPTH 6 diff --git a/tests/cksuite-all.h b/tests/cksuite-all.h new file mode 100644 index 00000000..a2e27fbb --- /dev/null +++ b/tests/cksuite-all.h @@ -0,0 +1,11 @@ +#ifndef __LIBNL3_TESTS_CHECK_ALL_H__ +#define __LIBNL3_TESTS_CHECK_ALL_H__ + +#include <check.h> +#include "nl-test-util.h" + +Suite *make_nl_attr_suite(void); +Suite *make_nl_addr_suite(void); +Suite *make_nl_ematch_tree_clone_suite(void); + +#endif /* __LIBNL3_TESTS_CHECK_ALL_H__ */ diff --git a/tests/nl-test-util.c b/tests/nl-test-util.c new file mode 100644 index 00000000..b37b44b7 --- /dev/null +++ b/tests/nl-test-util.c @@ -0,0 +1,3 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#include "nl-test-util.h" diff --git a/tests/nl-test-util.h b/tests/nl-test-util.h new file mode 100644 index 00000000..0b99c76c --- /dev/null +++ b/tests/nl-test-util.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: LGPL-2.1-only */ + +#ifndef __NL_TEST_UTIL_H__ +#define __NL_TEST_UTIL_H__ + +#include <check.h> + +#endif /* __NL_TEST_UTIL_H__ */ diff --git a/tests/util.h b/tests/util.h deleted file mode 100644 index ba182097..00000000 --- a/tests/util.h +++ /dev/null @@ -1,6 +0,0 @@ -#include <check.h> - -Suite *make_nl_attr_suite(void); -Suite *make_nl_addr_suite(void); -Suite *make_nl_ematch_tree_clone_suite(void); - |