Skip to contentSkip to conversation

tester: Add framework for serialized test execution

RFC PATCH In review Inga Stotland 2 participants 2 messages Mar 15, 2021 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 tester: Add framework for serialized test execution

This adds a framework for running series of noninteractive tests that are capable of executing more complex scenarios than a usual unit test.

The framework enables staging of a test case processing:
- test pre-setup: can be used to prepare an initial testing environment potentially common to between several test cases, e.g., put an emulator in a certain well known state.
- test setup: used to setup conditions specific for the test case
- test run: execute actual test case
- test teardown: Cleans up after test setup
- test post-teardown: Cleans up after test pre-setup

Additional command line options allow to run a selected group of tests based either on a group prefix of the test name or a substring in test description.

---
 Makefile.am  |   6 +-
 ell/ell.h    |   1 +
 ell/ell.sym  |  21 ++
 ell/tester.c | 780 +++++++++++++++++++++++++++++++++++++++++++++++++++
 ell/tester.h |  97 +++++++
 5 files changed, 903 insertions(+), 2 deletions(-)
 create mode 100644 ell/tester.c
 create mode 100644 ell/tester.h
Makefile.am +4 -2
index 2f9a4ce..4c65e9d 100644
@@ -58,7 +58,8 @@ pkginclude_HEADERS = ell/ell.h \
 			ell/gpio.h \
 			ell/path.h \
 			ell/icmp6.h \
-			ell/acd.h
+			ell/acd.h \
+			ell/tester.h
 
 lib_LTLIBRARIES = ell/libell.la
 
@@ -141,7 +142,8 @@ ell_libell_la_SOURCES = $(linux_headers) \
 			ell/path.c \
 			ell/icmp6.c \
 			ell/icmp6-private.h \
-			ell/acd.c
+			ell/acd.c \
+			ell/tester.c
 
 ell_libell_la_LDFLAGS = -Wl,--no-undefined \
 			-Wl,--version-script=$(top_srcdir)/ell/ell.sym \
ell/ell.h +1 -0
index 22fddf7..d47d5cf 100644
@@ -64,3 +64,4 @@
 #include <ell/gpio.h>
 #include <ell/path.h>
 #include <ell/acd.h>
+#include <ell/tester.h>
ell/ell.sym +21 -0
index 9938216..606513c 100644
@@ -665,6 +665,27 @@ global:
 	l_acd_set_debug;
 	l_acd_set_skip_probes;
 	l_acd_set_defend_policy;
+	/* tester */
+	l_tester_new;
+	l_tester_destroy;
+	l_tester_start;
+	l_tester_summarize;
+	l_tester_test_add;
+	l_tester_test_add_full;
+	l_tester_test_get_stage;
+	l_tester_get_data;
+	l_tester_pre_setup_complete;
+	l_tester_pre_setup_failed;
+	l_tester_setup_complete;
+	l_tester_setup_failed;
+	l_tester_test_passed;
+	l_tester_test_failed;
+	l_tester_test_abort;
+	l_tester_teardown_complete;
+	l_tester_teardown_failed;
+	l_tester_post_teardown_complete;
+	l_tester_post_teardown_failed;
+	l_tester_wait;
 local:
 	*;
 };
ell/tester.c new file +780 -0

780 lines not on this page · raw message

ell/tester.h new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.26.2
#1 lore raw

Hi Inga,

Quoted 23 lines · Inga Stotland

This adds a framework for running series of noninteractive tests that are capable of executing more complex scenarios than a usual unit test.

The framework enables staging of a test case processing:
- test pre-setup: can be used to prepare an initial testing environment potentially common to between several test cases, e.g., put an emulator in a certain well known state.
- test setup: used to setup conditions specific for the test case
- test run: execute actual test case
- test teardown: Cleans up after test setup
- test post-teardown: Cleans up after test pre-setup

Additional command line options allow to run a selected group of tests based either on a group prefix of the test name or a substring in test description.

---
  Makefile.am  |   6 +-
  ell/ell.h    |   1 +
  ell/ell.sym  |  21 ++
  ell/tester.c | 780 +++++++++++++++++++++++++++++++++++++++++++++++++++
  ell/tester.h |  97 +++++++
  5 files changed, 903 insertions(+), 2 deletions(-)
Quoted 3 lines

create mode 100644 ell/tester.c
create mode 100644 ell/tester.h

I went ahead and applied this with a minor tweak to the includes (adding #include "useful.h") due to recent internal includes reorg.

Regards,
-Denis