summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-13 07:44:25 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-18 07:08:51 +0200
commit5d614fdfa7ff0c4ea27cffc83451dd64d6f26352 (patch)
treee19d6c19efd3328d56a84811b87117ecef47e3b6
parenta7af34d0cfdb8b1cfa553fad78339798334963ad (diff)
downloadrtems-5d614fdfa7ff0c4ea27cffc83451dd64d6f26352.tar.bz2
libtest: Add T_puts()
Update #3199.
-rw-r--r--cpukit/include/rtems/test.h2
-rw-r--r--cpukit/libtest/t-test.c24
2 files changed, 26 insertions, 0 deletions
diff --git a/cpukit/include/rtems/test.h b/cpukit/include/rtems/test.h
index a3900c1285..212d4a5ae2 100644
--- a/cpukit/include/rtems/test.h
+++ b/cpukit/include/rtems/test.h
@@ -673,6 +673,8 @@ int T_printf(char const *, ...);
int T_vprintf(char const *, va_list);
+int T_puts(const char *, size_t);
+
int T_snprintf(char *, size_t, const char *, ...);
void T_log(T_verbosity, char const *, ...);
diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c
index 92aed62b9b..c93636a2b7 100644
--- a/cpukit/libtest/t-test.c
+++ b/cpukit/libtest/t-test.c
@@ -277,6 +277,30 @@ T_vprintf(char const *fmt, va_list ap)
}
static int
+T_do_puts(T_context *ctx, const char *buf, size_t len)
+{
+ if (T_do_is_runner(ctx)) {
+ size_t i;
+
+ T_output_buffer_drain(ctx);
+
+ for (i = 0; i < len; ++i) {
+ (*ctx->putchar)(buf[i], ctx->putchar_arg);
+ }
+ } else {
+ len = T_output_buffer_fill(ctx, buf, len);
+ }
+
+ return (int)len;
+}
+
+int
+T_puts(const char *buf, size_t len)
+{
+ return T_do_puts(&T_instance, buf, len);
+}
+
+static int
T_cpu(void)
{
#if defined(__rtems__)