summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-24 14:56:51 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-02-28 09:09:23 +0100
commit902ffeddb596d487fecffe69bbc0a047c73cd026 (patch)
tree2c3f17589685b91571749a3175237429631af711 /testsuites
parenttermios: Implement non-blocking write (diff)
downloadrtems-902ffeddb596d487fecffe69bbc0a047c73cd026.tar.bz2
termios09: Test send callback
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/termios09/init.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/testsuites/libtests/termios09/init.c b/testsuites/libtests/termios09/init.c
index f13804dcc1..9b8992a861 100644
--- a/testsuites/libtests/termios09/init.c
+++ b/testsuites/libtests/termios09/init.c
@@ -1067,6 +1067,31 @@ static void test_write(test_context *ctx)
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
+static void test_tx_callback(test_context *ctx)
+{
+ size_t i = INTERRUPT;
+ device_context *dev = &ctx->devices[i];
+ char c;
+ ssize_t n;
+
+ clear_output(ctx, i);
+ dev->callback_counter = 0;
+ dev->tty->tty_snd.sw_pfn = callback;
+ dev->tty->tty_snd.sw_arg = dev;
+
+ c = 'a';
+ n = write(ctx->fds[i], &c, sizeof(c));
+ rtems_test_assert(n == 1);
+ rtems_test_assert(dev->callback_counter == 0);
+ flush_output(ctx, i);
+ rtems_test_assert(dev->callback_counter == 1);
+ rtems_test_assert(dev->output_count == 1);
+ rtems_test_assert(dev->output_buf[0] == 'a');
+
+ dev->tty->tty_snd.sw_pfn = NULL;
+ dev->tty->tty_snd.sw_arg = NULL;
+}
+
static void Init(rtems_task_argument arg)
{
test_context *ctx = &test_instance;
@@ -1090,6 +1115,7 @@ static void Init(rtems_task_argument arg)
test_xtabs(ctx);
test_olcuc(ctx);
test_write(ctx);
+ test_tx_callback(ctx);
TEST_END();
rtems_test_exit(0);