summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxsem01
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-25 14:23:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-26 21:44:30 +0200
commit39bcf7417ea39806e4817a9ce72cfc20c060c4bf (patch)
treedc05ee9c4d99d8eb98adae586c462e5e84227a1b /testsuites/psxtests/psxsem01
parenttestsuites: Fix locked_printf() test printer (diff)
downloadrtems-39bcf7417ea39806e4817a9ce72cfc20c060c4bf.tar.bz2
Fix semaphore post overflow status
Close #2720.
Diffstat (limited to 'testsuites/psxtests/psxsem01')
-rw-r--r--testsuites/psxtests/psxsem01/init.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c
index 24f6d96465..1bec5c65a7 100644
--- a/testsuites/psxtests/psxsem01/init.c
+++ b/testsuites/psxtests/psxsem01/init.c
@@ -15,6 +15,7 @@
#include <semaphore.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <time.h>
#include <tmacros.h>
#include <pmacros.h>
@@ -76,6 +77,38 @@ static void test_sem_wait_during_delete(void)
rtems_test_assert( eno == 0 );
}
+static void test_sem_post_overflow(void)
+{
+ sem_t sem;
+ int rv;
+ int val;
+
+ rv = sem_init( &sem, 0, SEM_VALUE_MAX );
+ rtems_test_assert( rv == 0 );
+
+ rv = sem_getvalue( &sem, &val );
+ rtems_test_assert( rv == 0 );
+ rtems_test_assert( val == (int) SEM_VALUE_MAX );
+
+ errno = 0;
+ rv = sem_post( &sem );
+ rtems_test_assert( rv == -1 );
+ rtems_test_assert( errno == EOVERFLOW );
+
+ rv = sem_getvalue( &sem, &val );
+ rtems_test_assert( rv == 0 );
+ rtems_test_assert( val == (int) SEM_VALUE_MAX );
+
+ rv = sem_wait( &sem );
+ rtems_test_assert( rv == 0 );
+
+ rv = sem_post( &sem );
+ rtems_test_assert( rv == 0 );
+
+ rv = sem_destroy( &sem );
+ rtems_test_assert( rv == 0 );
+}
+
void *POSIX_Init(
void *argument
)
@@ -345,6 +378,7 @@ void *POSIX_Init(
rtems_test_assert( (status == -1) && (errno == ENOENT) );
test_sem_wait_during_delete();
+ test_sem_post_overflow();
/* Try adding in unlinking before closing... (can we still open?) */