summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-01-08 21:01:47 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-01-08 21:01:47 +0000
commitc2cfe9443d2e6fb42b2e266659b97fb573601d43 (patch)
treeece8be9179f24bcfdb7663a61fc9f8bf7f86908e /testsuites/psxtests
parent2011-01-08 Alin Rus <alin.codejunkie@gmail.com> (diff)
downloadrtems-c2cfe9443d2e6fb42b2e266659b97fb573601d43.tar.bz2
2011-01-08 Alin Rus <alin.codejunkie@gmail.com>
* psxaio02/init.c: Improve aio_cancel() coverage.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/ChangeLog4
-rw-r--r--testsuites/psxtests/psxaio02/init.c57
-rw-r--r--testsuites/psxtests/psxaio02/system.h2
3 files changed, 56 insertions, 7 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index ff20e179e3..1abb48681d 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,7 @@
+2011-01-08 Alin Rus <alin.codejunkie@gmail.com>
+
+ * psxaio02/init.c: Improve aio_cancel() coverage.
+
2011-01-02 Joel Sherrill <joel.sherrilL@OARcorp.com>
* psx05/init.c: Spacing.
diff --git a/testsuites/psxtests/psxaio02/init.c b/testsuites/psxtests/psxaio02/init.c
index 7a1882c852..819f5174a4 100644
--- a/testsuites/psxtests/psxaio02/init.c
+++ b/testsuites/psxtests/psxaio02/init.c
@@ -22,7 +22,8 @@
#include <rtems/chain.h>
#define BUFSIZE 32
-#define MAX 7
+#define MAX 10
+#define WRONG_FD 666
struct aiocb *
create_aiocb (int fd)
@@ -51,12 +52,17 @@ void *
POSIX_Init (void *argument)
{
int fd[MAX];
- struct aiocb *aiocbp[MAX+2];
- int status, i;
+ struct aiocb *aiocbp[MAX+1];
+ int status, i, policy = SCHED_FIFO;
char filename[BUFSIZE];
+ struct sched_param param;
status = rtems_aio_init ();
rtems_test_assert (status == 0);
+
+ param.sched_priority = 30;
+ status = pthread_setschedparam (pthread_self(), policy, &param);
+ rtems_test_assert (status == 0);
status = mkdir ("/tmp", S_IRWXU);
rtems_test_assert (!status);
@@ -113,10 +119,52 @@ POSIX_Init (void *argument)
rtems_test_assert (status != -1);
puts (" Init: [IQ] aio_read on 7th file add by priority ");
- aiocbp[8] = create_aiocb (fd[6]);
+ aiocbp[8] = create_aiocb (fd[6]);
status = aio_read (aiocbp[8]);
rtems_test_assert (status != -1);
+ puts (" Init: [WQ] aio_sync on 1st file add by priority ");
+ aiocbp[9] = create_aiocb (fd[0]);
+ status = aio_fsync (O_SYNC, aiocbp[9]);
+ rtems_test_assert (status != -1);
+
+ puts (" Init: [NONE] aio_cancel aiocbp=NULL and invalid fildes ");
+ status = aio_cancel (WRONG_FD, NULL);
+ rtems_test_assert (status == -1);
+
+ puts (" Init: [NONE] aio_cancel aiocbp=NULL valid fildes not in queue ");
+ status = aio_cancel (fd[7], NULL);
+ rtems_test_assert (status == AIO_ALLDONE);
+
+ puts (" Init: [WQ] aio_cancel aiocbp=NULL fildes=fd[1] ");
+ status = aio_cancel (fd[1], NULL);
+ rtems_test_assert (status == AIO_CANCELED);
+
+ puts (" Init: [IQ] aio_cancel aiocbp=NULL fildes=fd[6] ");
+ status = aio_cancel (fd[6], NULL);
+ rtems_test_assert (status == AIO_CANCELED);
+
+ puts (" Init: [NONE] aio_cancel aiocbp->aio_fildes != fildes ");
+ status = aio_cancel (fd[4],aiocbp[4]);
+ rtems_test_assert (status == -1 );
+
+ puts (" Init: [NONE] aio_cancel FD on [IQ], aiocb not on chain ");
+ aiocbp[10] = create_aiocb (fd[9]);
+ status = aio_cancel (fd[9], aiocbp[10]);
+ rtems_test_assert (status == -1);
+
+ puts (" Init: [IQ] aio_cancel 6th file only one request ");
+ status = aio_cancel (fd[5], aiocbp[6]);
+ rtems_test_assert (status == AIO_CANCELED);
+
+ puts (" Init: [WQ] aio_cancel 1st file only one request ");
+ status = aio_cancel (fd[0], aiocbp[9]);
+ rtems_test_assert (status == AIO_CANCELED);
+
+ puts (" Init: [NONE] aio_cancel empty [IQ] ");
+ status = aio_cancel (fd[5], aiocbp[6]);
+ rtems_test_assert (status == AIO_ALLDONE);
+
puts ("\n\n*** POSIX AIO TEST 02 ***");
puts ("*** END OF POSIX AIO TEST 01 ***");
@@ -127,7 +175,6 @@ POSIX_Init (void *argument)
free_aiocb (aiocbp[i]);
}
free_aiocb (aiocbp[i]);
- free_aiocb (aiocbp[i+1]);
rtems_test_exit (0);
return NULL;
diff --git a/testsuites/psxtests/psxaio02/system.h b/testsuites/psxtests/psxaio02/system.h
index a4bc91f463..cee9eb5b69 100644
--- a/testsuites/psxtests/psxaio02/system.h
+++ b/testsuites/psxtests/psxaio02/system.h
@@ -38,10 +38,8 @@ void *POSIX_Init (void *argument);
#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 */