Opened on 10/19/17 at 10:12:46
Closed on 09/29/21 at 13:25:31
#3199 closed enhancement (fixed)
New test framework
Reported by: | Sebastian Huber | Owned by: | Sebastian Huber |
---|---|---|---|
Priority: | normal | Milestone: | 6.1 |
Component: | lib | Version: | 5 |
Severity: | normal | Keywords: | qualification |
Cc: | Blocked By: | ||
Blocking: | #3716 |
Description
Requirements:
- Support for RTEMS and general POSIX systems such as Linux or FreeBSD
- Test output functions
- printf() like
- No floating point support by default
- Optional floating point support
- Non-blocking
- Arbitrary context, e.g. during system start, before device drivers, in interrupt context
- Automatic test case registrations (constructors, linker set)
- Standard test case output, e.g. begin/end of test case message
- Ability to sort test cases at run-time
- Safe assert functions, e.g. assert(a == b) vs. assert(a = b) vs. assert_eq(a, b)
- Easy to write, e.g. avoid long namespace prefix rtems_test_*
- Support multiple threads
- No dependency on C++
- Context validation, context invariant validation (e.g. thread dispatch disable level, interrupt state, heap state)
- Test pattern support (e.g. spintercritical*, parallel tests on SMP)
No ready to use framework exists which fulfils these requirements. We have to write something for RTEMS.
API proposal (header file <T.h>):
T_eq(a, b) T_gt(a, b) T_printf(fmt, ...) T_output_printf(putchar, fmt, ...) T_output_string(putchar, s, n) T_output_add_format_handler(handler, arg)
Example for T_output_add_format():
#include <stdio.h> #include <string.h> typedef void (*T_putchar)(char c); typedef size_t (*T_format_handler)(void *arg, T_putchar putchar, const char *fmt, const char *s, int *out); int T_printf(const char *fmt, ...); void T_output_printf(T_putchar putchar, const char *fmt, ...); void T_output_string(T_putchar putchar, const char *s, size_t n); void T_output_add_format_handler(T_format_handler handler, void *arg); size_t T_output_float_handler(void *arg, T_putchar putchar, const char *fmt, const char *s, int *out) { char buf[32]; if (strncmp(fmt, "%f", 2) != 0) { return 0; } *out = snprintf(buf, sizeof(buf), "%f", s); if (*out > 0) { T_output_string(putchar, s, (size_t) *out); } return 2; } void f(void) { T_output_add_format_handler(T_output_float_handler, NULL); }
Attachments (2)
Change History (76)
comment:1 Changed on 10/19/17 at 20:44:08 by Chris Johns
comment:11 Changed on 11/02/17 at 13:26:51 by Sebastian Huber <sebastian.huber@…>
In 8c1f4064/rtems:
comment:14 Changed on 11/06/17 at 06:29:41 by Sebastian Huber <sebastian.huber@…>
In c4b8b147/rtems:
comment:15 Changed on 11/07/17 at 06:09:15 by Sebastian Huber <sebastian.huber@…>
In 7b00c2fa/rtems:
comment:21 Changed on 02/05/18 at 09:48:37 by Sebastian Huber <sebastian.huber@…>
comment:22 Changed on 03/04/19 at 13:03:31 by Sebastian Huber
Blocking: | 3716 added |
---|---|
Status: | assigned → accepted |
comment:23 Changed on 03/27/19 at 06:29:28 by Sebastian Huber <sebastian.huber@…>
In 6fe01e4b/rtems:
comment:24 Changed on 03/27/19 at 06:29:32 by Sebastian Huber <sebastian.huber@…>
In cfcc2cbf/rtems:
comment:25 Changed on 03/27/19 at 06:29:37 by Sebastian Huber <sebastian.huber@…>
In cbfc3415/rtems:
comment:26 Changed on 03/27/19 at 06:34:23 by Sebastian Huber <sebastian.huber@…>
comment:28 Changed on 10/11/19 at 09:02:13 by Sebastian Huber <sebastian.huber@…>
In b406d071/rtems:
comment:30 Changed on 10/11/19 at 09:02:26 by Sebastian Huber <sebastian.huber@…>
In b5e61f95/rtems:
comment:32 Changed on 02/10/20 at 08:03:35 by Sebastian Huber <sebastian.huber@…>
comment:33 Changed on 02/10/20 at 08:03:37 by Sebastian Huber <sebastian.huber@…>
comment:34 Changed on 02/10/20 at 12:49:18 by Sebastian Huber <sebastian.huber@…>
comment:35 Changed on 07/17/20 at 09:23:51 by Sebastian Huber
Milestone: | Indefinite → 6.1 |
---|
comment:36 Changed on 07/23/20 at 08:06:12 by Sebastian Huber <sebastian.huber@…>
comment:38 Changed on 07/23/20 at 08:57:54 by Sebastian Huber <sebastian.huber@…>
In 361404e8/rtems:
comment:39 Changed on 07/23/20 at 08:57:57 by Sebastian Huber <sebastian.huber@…>
In e3e3b871/rtems:
comment:43 Changed on 07/23/20 at 08:58:10 by Sebastian Huber <sebastian.huber@…>
In cb3c6bdc/rtems:
comment:45 Changed on 07/23/20 at 08:58:17 by Sebastian Huber <sebastian.huber@…>
In 34e4df55/rtems:
comment:47 Changed on 07/23/20 at 08:58:24 by Sebastian Huber <sebastian.huber@…>
In 35d9af69/rtems:
comment:48 Changed on 07/23/20 at 08:58:27 by Sebastian Huber <sebastian.huber@…>
In d702c9f4/rtems:
comment:49 Changed on 07/23/20 at 08:58:30 by Sebastian Huber <sebastian.huber@…>
In 467ef5b4/rtems:
comment:50 Changed on 07/23/20 at 08:58:34 by Sebastian Huber <sebastian.huber@…>
In dddc9a58/rtems:
comment:52 Changed on 07/23/20 at 08:58:40 by Sebastian Huber <sebastian.huber@…>
In cc3fd8fc/rtems:
comment:53 Changed on 08/06/20 at 17:16:12 by Sebastian Huber <sebastian.huber@…>
In 32f1f747/rtems:
comment:57 Changed on 08/18/20 at 05:15:18 by Sebastian Huber <sebastian.huber@…>
In 5a8114c6/rtems:
comment:59 Changed on 08/18/20 at 05:15:25 by Sebastian Huber <sebastian.huber@…>
In a7af34d0/rtems:
comment:63 Changed on 08/18/20 at 05:15:37 by Sebastian Huber <sebastian.huber@…>
In 5383d4db/rtems:
comment:64 Changed on 08/18/20 at 05:15:41 by Sebastian Huber <sebastian.huber@…>
In 72960bc7/rtems:
comment:66 Changed on 08/18/20 at 05:15:47 by Sebastian Huber <sebastian.huber@…>
In c7289484/rtems:
comment:67 Changed on 08/31/20 at 14:21:37 by Sebastian Huber <sebastian.huber@…>
In d556af36/rtems:
comment:70 Changed on 11/19/20 at 07:59:18 by Sebastian Huber <sebastian.huber@…>
comment:71 Changed on 11/19/20 at 07:59:20 by Sebastian Huber <sebastian.huber@…>
comment:73 Changed on 06/18/21 at 09:24:45 by Sebastian Huber
Keywords: | qualification added |
---|
comment:74 Changed on 09/29/21 at 13:25:31 by Sebastian Huber
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
The test framework is fully implemented.
Have you seen TAP?
I suggest we look at something that exists and see if it fits.