[Openvpn-devel] Remove example unit tests
Commit Message
We have plenty real unit test that can be used as examples, so the
example tests are no longer needed. Let's get rid of them.
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
---
tests/unit_tests/Makefile.am | 2 +-
tests/unit_tests/example_test/Makefile.am | 13 --------
tests/unit_tests/example_test/README.md | 3 --
tests/unit_tests/example_test/test.c | 52 -------------------------------
tests/unit_tests/example_test/test2.c | 23 --------------
5 files changed, 1 insertion(+), 92 deletions(-)
delete mode 100644 tests/unit_tests/example_test/Makefile.am
delete mode 100644 tests/unit_tests/example_test/README.md
delete mode 100644 tests/unit_tests/example_test/test.c
delete mode 100644 tests/unit_tests/example_test/test2.c
Comments
Hi,
[ Talking to myself here... ]
On 10-10-18 08:51, Steffan Karger wrote:
> We have plenty real unit test that can be used as examples, so the
> example tests are no longer needed. Let's get rid of them.
NAK. The patch is wrong because it leaves around a trace of the example
tests in configure.ac, doesn't update the README in tests/unit_tests/
and the examples actually still are useful as a template.
So on second thought I think it's better to just leave them in.
-Steffan
@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = foreign
if CMOCKA_INITIALIZED
-SUBDIRS = example_test openvpn plugins
+SUBDIRS = openvpn plugins
endif
deleted file mode 100644
@@ -1,13 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-check_PROGRAMS = example_testdriver example2_testdriver
-
-TESTS = $(check_PROGRAMS)
-
-example_testdriver_CFLAGS = @TEST_CFLAGS@
-example_testdriver_LDFLAGS = @TEST_LDFLAGS@
-example_testdriver_SOURCES = test.c
-
-example2_testdriver_CFLAGS = @TEST_CFLAGS@
-example2_testdriver_LDFLAGS = @TEST_LDFLAGS@
-example2_testdriver_SOURCES = test2.c
deleted file mode 100644
@@ -1,3 +0,0 @@
-This test only checks that test compilation works. This example contains two test executables.
-
-These tests can be used as template for 'real' tests.
deleted file mode 100644
@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-static int
-setup(void **state) {
- int *answer = malloc(sizeof(int));
-
- *answer = 42;
- *state = answer;
-
- return 0;
-}
-
-static int
-teardown(void **state) {
- free(*state);
-
- return 0;
-}
-
-static void
-null_test_success(void **state) {
- (void) state;
-}
-
-static void
-int_test_success(void **state) {
- int *answer = *state;
- assert_int_equal(*answer, 42);
-}
-
-static void
-failing_test(void **state) {
- /* This tests fails to test that make check fails */
- assert_int_equal(0, 42);
-}
-
-int
-main(void) {
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(null_test_success),
- cmocka_unit_test_setup_teardown(int_test_success, setup, teardown),
-/* cmocka_unit_test(failing_test), */
- };
-
- return cmocka_run_group_tests_name("success_test", tests, NULL, NULL);
-}
deleted file mode 100644
@@ -1,23 +0,0 @@
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <setjmp.h>
-#include <cmocka.h>
-
-
-static void
-test_true(void **state) {
- (void) state;
-}
-
-
-int
-main(void) {
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(test_true),
- };
-
- return cmocka_run_group_tests_name("success_test2", tests, NULL, NULL);
-}