From ac741625b0926a0329627beca52174edd69e587b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 14 Sep 2017 15:21:14 +0200 Subject: libio: Use FIFO for iop free list Update #3136. --- testsuites/fstests/fsclose01/init.c | 31 +++++++++++++++++++++++++++---- testsuites/libtests/termios01/init.c | 15 +++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) (limited to 'testsuites') diff --git a/testsuites/fstests/fsclose01/init.c b/testsuites/fstests/fsclose01/init.c index a9de652b51..77df082036 100644 --- a/testsuites/fstests/fsclose01/init.c +++ b/testsuites/fstests/fsclose01/init.c @@ -405,6 +405,27 @@ static void worker_task(rtems_task_argument arg) } } +static void test_fd_free_fifo(const char *path) +{ + int a; + int b; + int rv; + + a = open(path, O_RDWR); + rtems_test_assert(a >= 0); + + rv = close(a); + rtems_test_assert(rv == 0); + + b = open(path, O_RDWR); + rtems_test_assert(b >= 0); + + rv = close(b); + rtems_test_assert(rv == 0); + + rtems_test_assert(a != b); +} + static void test(test_context *ctx) { const char *path = "generic"; @@ -420,6 +441,8 @@ static void test(test_context *ctx) ); rtems_test_assert(rv == 0); + test_fd_free_fifo(path); + sc = rtems_task_create( rtems_build_name('W', 'O', 'R', 'K'), 1, @@ -469,15 +492,15 @@ static void test(test_context *ctx) rv = unlink(path); rtems_test_assert(rv == 0); - rtems_test_assert(ctx->close_count == 15); + rtems_test_assert(ctx->close_count == 17); rtems_test_assert(ctx->fcntl_count == 1); rtems_test_assert(ctx->fdatasync_count == 1); - rtems_test_assert(ctx->fstat_count == 38); + rtems_test_assert(ctx->fstat_count == 42); rtems_test_assert(ctx->fsync_count == 1); rtems_test_assert(ctx->ftruncate_count == 1); rtems_test_assert(ctx->ioctl_count == 1); rtems_test_assert(ctx->lseek_count == 1); - rtems_test_assert(ctx->open_count == 15); + rtems_test_assert(ctx->open_count == 17); rtems_test_assert(ctx->read_count == 1); rtems_test_assert(ctx->readv_count == 1); rtems_test_assert(ctx->write_count == 1); @@ -495,7 +518,7 @@ static void Init(rtems_task_argument arg) #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER -#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4 +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5 #define CONFIGURE_MAXIMUM_TASKS 2 diff --git a/testsuites/libtests/termios01/init.c b/testsuites/libtests/termios01/init.c index 562b252745..a892762b03 100644 --- a/testsuites/libtests/termios01/init.c +++ b/testsuites/libtests/termios01/init.c @@ -623,16 +623,23 @@ static rtems_status_code test_early_device_install( rtems_status_code sc; int fd; int rv; + int i; rtems_resource_snapshot_take( &snapshot ); sc = rtems_termios_device_install( &dev[0], &handler, NULL, NULL ); rtems_test_assert( sc == RTEMS_SUCCESSFUL ); - errno = 0; - fd = open( &dev[0], O_RDWR ); - rtems_test_assert( fd == -1 ); - rtems_test_assert( errno == ENXIO ); + /* + * The loop ensures that file descriptor 0 is the first free file descriptor + * after this test case. + */ + for (i = 0; i < 4; ++i) { + errno = 0; + fd = open( &dev[0], O_RDWR ); + rtems_test_assert( fd == -1 ); + rtems_test_assert( errno == ENXIO ); + } rv = unlink( &dev[0] ); rtems_test_assert( rv == 0 ); -- cgit v1.2.3