diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-16 13:29:49 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2010-08-16 13:29:49 +0000 |
commit | db8c6d6492545eab85f8b6e25b57ed85c7e06371 (patch) | |
tree | 1516402f6e57312e93ad968488a483a4a751502e /testsuites | |
parent | 2010-08-16 Ralf Corsépius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-db8c6d6492545eab85f8b6e25b57ed85c7e06371.tar.bz2 |
2010-08-16 Alin Rus <alin.codejunkie@gmail.com>
* Makefile.am, configure.ac: Add psxaio01/, psxaio02/.
* psxaio01/Makefile.am, psxaio01/init.c, psxaio01/psxaio01.scn,
psxaio01/system.h: New.
* psxaio02/Makefile.am, psxaio02/init.c, psxaio02/psxaio02.scn,
psxaio02/system.h: New.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/psxtests/ChangeLog | 8 | ||||
-rw-r--r-- | testsuites/psxtests/Makefile.am | 2 | ||||
-rw-r--r-- | testsuites/psxtests/configure.ac | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio01/Makefile.am | 25 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio01/init.c | 151 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio01/psxaio01.scn | 0 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio01/system.h | 50 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio02/Makefile.am | 25 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio02/init.c | 151 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio02/psxaio02.scn | 0 | ||||
-rw-r--r-- | testsuites/psxtests/psxaio02/system.h | 50 |
11 files changed, 463 insertions, 1 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 9d76021500..5d4a6b4841 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,11 @@ +2010-08-16 Alin Rus <alin.codejunkie@gmail.com> + + * Makefile.am, configure.ac: Add psxaio01/, psxaio02/. + * psxaio01/Makefile.am, psxaio01/init.c, psxaio01/psxaio01.scn, + psxaio01/system.h: New. + * psxaio02/Makefile.am, psxaio02/init.c, psxaio02/psxaio02.scn, + psxaio02/system.h: New. + 2010-08-10 Bharath Suri <bharath.s.jois@gmail.com> PR 1598/testing diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index a26cbfd445..61b84eb4bd 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = psxclock if HAS_POSIX SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \ - psx10 psx11 psx12 psx13 psx14 psxalarm01 \ + psx10 psx11 psx12 psx13 psx14 psxaio01 psxaio02 psxalarm01 \ psxautoinit01 psxautoinit02 psxbarrier01 \ psxcancel psxcancel01 psxcleanup psxcleanup01 \ psxcond01 psxenosys psxkey01 psxkey02 psxkey03 \ diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac index 851ecc205e..82c56e3dbf 100644 --- a/testsuites/psxtests/configure.ac +++ b/testsuites/psxtests/configure.ac @@ -72,6 +72,8 @@ psx11/Makefile psx12/Makefile psx13/Makefile psx14/Makefile +psxaio01/Makefile +psxaio02/Makefile psxalarm01/Makefile psxautoinit01/Makefile psxautoinit02/Makefile diff --git a/testsuites/psxtests/psxaio01/Makefile.am b/testsuites/psxtests/psxaio01/Makefile.am new file mode 100644 index 0000000000..8df6b55f4a --- /dev/null +++ b/testsuites/psxtests/psxaio01/Makefile.am @@ -0,0 +1,25 @@ + +MANAGERS = all + +rtems_tests_PROGRAMS = psxaio01 +psxaio01_SOURCES = init.c system.h ../include/pmacros.h + +dist_rtems_tests_DATA = psxaio01.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxaio01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxaio01_OBJECTS) $(psxaio01_LDADD) +LINK_LIBS = $(psxaio01_LDLIBS) + +psxaio01$(EXEEXT): $(psxaio01_OBJECTS) $(psxaio01_DEPENDENCIES) + @rm -f psxaio01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am
\ No newline at end of file diff --git a/testsuites/psxtests/psxaio01/init.c b/testsuites/psxtests/psxaio01/init.c new file mode 100644 index 0000000000..7af884201f --- /dev/null +++ b/testsuites/psxtests/psxaio01/init.c @@ -0,0 +1,151 @@ +/* + * Copyright 2010, Alin Rus <alin.codejunkie@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#define CONFIGURE_INIT +#include "system.h" +#include <rtems.h> +#include "tmacros.h" +#include <rtems/posix/aio_misc.h> +#include <aio.h> +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <sched.h> +#include <fcntl.h> + +#define BUFSIZE 512 +#define WRONG_FD 404 + +struct aiocb * +create_aiocb (void) +{ + struct aiocb *aiocbp; + + aiocbp = malloc (sizeof (struct aiocb)); + memset (aiocbp, 0, sizeof (struct aiocb)); + aiocbp->aio_buf = malloc (BUFSIZE * sizeof (char)); + aiocbp->aio_nbytes = BUFSIZE; + aiocbp->aio_offset = 0; + aiocbp->aio_reqprio = 0; + aiocbp->aio_fildes = open ("aio_fildes", O_RDWR | O_CREAT); + + return aiocbp; +} + +void +free_aiocb (struct aiocb *aiocbp) +{ + free ((char*) aiocbp->aio_buf); + free (aiocbp); +} + +void * +POSIX_Init (void *argument) +{ + int result, policy; + struct aiocb *aiocbp; + rtems_status_code status; + struct sched_param param; + + puts ("\n\n*** POSIX AIO TEST 01 ***"); + + puts ("\n*** POSIX aio_write() test ***"); + + /* Request canceled */ + puts ("Init: aio_write - ECANCELED"); + + aiocbp = create_aiocb (); + aio_write (aiocbp); + aio_cancel (aiocbp->aio_fildes, aiocbp); + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != ECANCELED); + free_aiocb (aiocbp); + + /* Successfull added request to queue */ + puts ("Init: aio_write - SUCCESSFUL"); + aiocbp = create_aiocb (); + aiocbp->aio_fildes = WRONG_FD; + status = aio_write (aiocbp); + rtems_test_assert (!status); + + pthread_getschedparam (pthread_self (), &policy, ¶m); + policy = SCHED_RR; + param.sched_priority = 30; + pthread_setschedparam (pthread_self (), policy, ¶m); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + /* Bad file descriptor */ + puts ("Init: aio_write() - EBADF "); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EBADF); + free_aiocb (aiocbp); + + /* Invalid offset */ + puts ("Init: aio_write() - EINVAL [aio_offset]"); + + aiocbp = create_aiocb (); + aiocbp->aio_offset = -1; + aio_write (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EINVAL); + free_aiocb (aiocbp); + + /* Invalid request priority */ + puts ("Init: aio_write() - EINVAL [aio_reqprio]"); + + aiocbp = create_aiocb (); + aiocbp->aio_reqprio = AIO_PRIO_DELTA_MAX + 1; + aio_write (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EINVAL); + free_aiocb (aiocbp); + + /* aio_nbytes > 0 and aio_offset >= SEEK_END */ + puts ("Init: aio_write() - EFBIG"); + aiocbp = create_aiocb (); + aiocbp->aio_nbytes = 1; + aiocbp->aio_offset = lseek (aiocbp->aio_fildes, 0, SEEK_END) + 1; + aio_write (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EFBIG); + free_aiocb (aiocbp); + + puts ("*** END OF POSIX AIO TEST 01 ***"); + + rtems_test_exit (0); + + return NULL; + +} diff --git a/testsuites/psxtests/psxaio01/psxaio01.scn b/testsuites/psxtests/psxaio01/psxaio01.scn new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuites/psxtests/psxaio01/psxaio01.scn diff --git a/testsuites/psxtests/psxaio01/system.h b/testsuites/psxtests/psxaio01/system.h new file mode 100644 index 0000000000..a4bc91f463 --- /dev/null +++ b/testsuites/psxtests/psxaio01/system.h @@ -0,0 +1,50 @@ + /* + * Copyright 2010, Alin Rus <alin.codejunkie@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +/* functions */ + +#include <pmacros.h> +#include <pthread.h> +#include <errno.h> +#include <sched.h> + +void *POSIX_Init (void *argument); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 20 +#define CONFIGURE_MAXIMUM_SEMAPHORES 20 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 20 +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20 +#define CONFIGURE_STACK_CHECKER_ENABLED + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10 +#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE +#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10 * RTEMS_MINIMUM_STACK_SIZE) + + +#define CONFIGURE_MALLOC_STATISTICS + + +#include <rtems/confdefs.h> + +/* global variables */ +TEST_EXTERN pthread_t Init_id; + +/* end of include file */ diff --git a/testsuites/psxtests/psxaio02/Makefile.am b/testsuites/psxtests/psxaio02/Makefile.am new file mode 100644 index 0000000000..db1b8d4642 --- /dev/null +++ b/testsuites/psxtests/psxaio02/Makefile.am @@ -0,0 +1,25 @@ + +MANAGERS = all + +rtems_tests_PROGRAMS = psxaio02 +psxaio02_SOURCES = init.c system.h ../include/pmacros.h + +dist_rtems_tests_DATA = psxaio02.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxaio02_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxaio02_OBJECTS) $(psxaio02_LDADD) +LINK_LIBS = $(psxaio02_LDLIBS) + +psxaio02$(EXEEXT): $(psxaio02_OBJECTS) $(psxaio02_DEPENDENCIES) + @rm -f psxaio02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am
\ No newline at end of file diff --git a/testsuites/psxtests/psxaio02/init.c b/testsuites/psxtests/psxaio02/init.c new file mode 100644 index 0000000000..240dd30e4c --- /dev/null +++ b/testsuites/psxtests/psxaio02/init.c @@ -0,0 +1,151 @@ +/* + * Copyright 2010, Alin Rus <alin.codejunkie@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#define CONFIGURE_INIT +#include "system.h" +#include <rtems.h> +#include "tmacros.h" +#include <rtems/posix/aio_misc.h> +#include <aio.h> +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <sched.h> +#include <fcntl.h> + +#define BUFSIZE 512 +#define WRONG_FD 404 + +struct aiocb * +create_aiocb (void) +{ + struct aiocb *aiocbp; + + aiocbp = malloc (sizeof (struct aiocb)); + memset (aiocbp, 0, sizeof (struct aiocb)); + aiocbp->aio_buf = malloc (BUFSIZE * sizeof (char)); + aiocbp->aio_nbytes = BUFSIZE; + aiocbp->aio_offset = 0; + aiocbp->aio_reqprio = 0; + aiocbp->aio_fildes = open ("aio_fildes", O_RDWR | O_CREAT); + + return aiocbp; +} + +void +free_aiocb (struct aiocb *aiocbp) +{ + free ((char*) aiocbp->aio_buf); + free (aiocbp); +} + +void * +POSIX_Init (void *argument) +{ + int result, policy; + struct aiocb *aiocbp; + rtems_status_code status; + struct sched_param param; + + puts ("\n\n*** POSIX AIO TEST 02 ***"); + + puts ("\n*** POSIX aio_read() test ***"); + + /* Request canceled */ + puts ("Init: aio_read - ECANCELED"); + + aiocbp = create_aiocb (); + aio_read (aiocbp); + aio_cancel (aiocbp->aio_fildes, aiocbp); + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != ECANCELED); + free_aiocb (aiocbp); + + /* Successfull added request to queue */ + puts ("Init: aio_read - SUCCESSFUL"); + aiocbp = create_aiocb (); + aiocbp->aio_fildes = WRONG_FD; + status = aio_read (aiocbp); + rtems_test_assert (!status); + + pthread_getschedparam (pthread_self (), &policy, ¶m); + policy = SCHED_RR; + param.sched_priority = 30; + pthread_setschedparam (pthread_self (), policy, ¶m); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + /* Bad file descriptor */ + puts ("Init: aio_read() - EBADF "); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EBADF); + free_aiocb (aiocbp); + + /* Invalid offset */ + puts ("Init: aio_read() - EINVAL [aio_offset]"); + + aiocbp = create_aiocb (); + aiocbp->aio_offset = -1; + aio_read (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EINVAL); + free_aiocb (aiocbp); + + /* Invalid request priority */ + puts ("Init: aio_read() - EINVAL [aio_reqprio]"); + + aiocbp = create_aiocb (); + aiocbp->aio_reqprio = AIO_PRIO_DELTA_MAX + 1; + aio_read (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EINVAL); + free_aiocb (aiocbp); + + /* aio_nbytes > 0 && aio_nbytes + aio_offset > max offset of aio_fildes */ + puts ("Init: aio_read() - OVERFLOW"); + aiocbp = create_aiocb (); + aiocbp->aio_nbytes = 10; + aiocbp->aio_offset = lseek (aiocbp->aio_fildes, 0, SEEK_END); + aio_read (aiocbp); + sleep (1); + + while (aio_error (aiocbp) == EINPROGRESS); + + result = aio_return (aiocbp); + rtems_test_assert (result != -1); + status = aio_error (aiocbp); + rtems_test_assert (status != EFBIG); + free_aiocb (aiocbp); + + puts ("*** END OF POSIX AIO TEST 01 ***"); + + rtems_test_exit (0); + + return NULL; + +} diff --git a/testsuites/psxtests/psxaio02/psxaio02.scn b/testsuites/psxtests/psxaio02/psxaio02.scn new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/testsuites/psxtests/psxaio02/psxaio02.scn diff --git a/testsuites/psxtests/psxaio02/system.h b/testsuites/psxtests/psxaio02/system.h new file mode 100644 index 0000000000..a4bc91f463 --- /dev/null +++ b/testsuites/psxtests/psxaio02/system.h @@ -0,0 +1,50 @@ + /* + * Copyright 2010, Alin Rus <alin.codejunkie@gmail.com> + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +/* functions */ + +#include <pmacros.h> +#include <pthread.h> +#include <errno.h> +#include <sched.h> + +void *POSIX_Init (void *argument); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 20 +#define CONFIGURE_MAXIMUM_SEMAPHORES 20 +#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 20 +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20 +#define CONFIGURE_STACK_CHECKER_ENABLED + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10 +#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE +#define CONFIGURE_EXTRA_TASK_STACKS (10 * RTEMS_MINIMUM_STACK_SIZE) +#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE (10 * RTEMS_MINIMUM_STACK_SIZE) + + +#define CONFIGURE_MALLOC_STATISTICS + + +#include <rtems/confdefs.h> + +/* global variables */ +TEST_EXTERN pthread_t Init_id; + +/* end of include file */ |