aboutsummaryrefslogtreecommitdiffstats
path: root/test/lib
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 15:09:11 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-10-16 15:09:11 +0000
commiteb6b6685f09fbc4822492a1db9eaa367f46c657c (patch)
treee6b73b5865ff9559fd766a38054cbffc2e9466a3 /test/lib
parent6bbfd2126f0cd20c733b78682d322250d8223d93 (diff)
downloadChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.tar.gz
ChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.tar.bz2
ChibiOS-eb6b6685f09fbc4822492a1db9eaa367f46c657c.zip
Enhancements in the test engine, not finished.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10835 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/lib')
-rw-r--r--test/lib/ch_test.c13
-rw-r--r--test/lib/ch_test.h29
2 files changed, 28 insertions, 14 deletions
diff --git a/test/lib/ch_test.c b/test/lib/ch_test.c
index 8dd166278..11d7ac095 100644
--- a/test/lib/ch_test.c
+++ b/test/lib/ch_test.c
@@ -24,7 +24,6 @@
#include "hal.h"
#include "ch_test.h"
-#include "test_root.h"
/*===========================================================================*/
/* Module local definitions. */
@@ -134,7 +133,7 @@ bool _test_assert_time_window(systime_t start,
systime_t end,
const char *msg) {
- return _test_assert(osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end),
+ return _test_assert(osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end),
msg);
}
@@ -224,7 +223,7 @@ void test_emit_token_i(char token) {
*
* @api
*/
-msg_t test_execute(BaseSequentialStream *stream) {
+msg_t test_execute(BaseSequentialStream *stream, testsuite_t ts) {
int i, j;
test_chp = stream;
@@ -252,21 +251,21 @@ msg_t test_execute(BaseSequentialStream *stream) {
test_global_fail = false;
i = 0;
- while (test_suite[i]) {
+ while (ts[i] != NULL) {
j = 0;
- while (test_suite[i][j]) {
+ while (ts[i][j] != NULL) {
print_line();
test_print("--- Test Case ");
test_printn(i + 1);
test_print(".");
test_printn(j + 1);
test_print(" (");
- test_print(test_suite[i][j]->name);
+ test_print(ts[i][j]->name);
test_println(")");
#if TEST_DELAY_BETWEEN_TESTS > 0
osalThreadSleepMilliseconds(TEST_DELAY_BETWEEN_TESTS);
#endif
- execute_test(test_suite[i][j]);
+ execute_test(ts[i][j]);
if (test_local_fail) {
test_print("--- Result: FAILURE (#");
test_printn(test_step);
diff --git a/test/lib/ch_test.h b/test/lib/ch_test.h
index cbc2f2af8..3b805d6b5 100644
--- a/test/lib/ch_test.h
+++ b/test/lib/ch_test.h
@@ -65,6 +65,27 @@ typedef struct {
void (*execute)(void); /**< @brief Test case execution function. */
} testcase_t;
+/**
+ * @brief Structure representing a test sequence.
+ */
+typedef const struct {
+ const char *name; /**< @brief Name of the test sequence. */
+ testcase_t *cases; /**< @brief Test cases array. */
+} testsequence_t;
+
+/**
+ * @brief Type of a test suite.
+ */
+typedef const struct {
+ const char *name; /**< @brief Name of the test suite. */
+ testsequence_t *sequences; /**< @brief Test sequences array. */
+} ts_t;
+
+/**
+ * @brief Type of a test suite.
+ */
+typedef const testcase_t * const *testsuite_t[];
+
/*===========================================================================*/
/* Module macros. */
/*===========================================================================*/
@@ -173,7 +194,7 @@ extern "C" {
void test_println(const char *msgp);
void test_emit_token(char token);
void test_emit_token_i(char token);
- msg_t test_execute(BaseSequentialStream *stream);
+ msg_t test_execute(BaseSequentialStream *stream, testsuite_t ts);
#ifdef __cplusplus
}
#endif
@@ -182,12 +203,6 @@ extern "C" {
/* Module inline functions. */
/*===========================================================================*/
-/*===========================================================================*/
-/* Late inclusions. */
-/*===========================================================================*/
-
-#include "test_root.h"
-
#endif /* CH_TEST_H */
/** @} */