summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxsem01
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-22 15:37:54 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-07-22 15:37:54 +0000
commit17e3808dd59cc7843f23a620780e01a2e5f27bb7 (patch)
tree4cf8f8a6ad114704bd5530cc1e33f69ba65f3336 /testsuites/psxtests/psxsem01
parent2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-17e3808dd59cc7843f23a620780e01a2e5f27bb7.tar.bz2
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxsem01/Makefile.am, psxsem01/init.c: Much clean up. * psxsem01/system.h: Removed.
Diffstat (limited to 'testsuites/psxtests/psxsem01')
-rw-r--r--testsuites/psxtests/psxsem01/Makefile.am2
-rw-r--r--testsuites/psxtests/psxsem01/init.c42
-rw-r--r--testsuites/psxtests/psxsem01/system.h54
3 files changed, 37 insertions, 61 deletions
diff --git a/testsuites/psxtests/psxsem01/Makefile.am b/testsuites/psxtests/psxsem01/Makefile.am
index 7053eccf6c..6b4291167f 100644
--- a/testsuites/psxtests/psxsem01/Makefile.am
+++ b/testsuites/psxtests/psxsem01/Makefile.am
@@ -5,7 +5,7 @@
MANAGERS = all
rtems_tests_PROGRAMS = psxsem01
-psxsem01_SOURCES = init.c system.h ../include/pmacros.h \
+psxsem01_SOURCES = init.c ../include/pmacros.h \
../../support/src/test_support.c
dist_rtems_tests_DATA = psxsem01.scn
diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c
index f57ba05b39..5f067bb16f 100644
--- a/testsuites/psxtests/psxsem01/init.c
+++ b/testsuites/psxtests/psxsem01/init.c
@@ -1,11 +1,25 @@
-#define CONFIGURE_INIT
-#include "system.h"
+/*
+ * COPYRIGHT (c) 1989-2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * 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$
+ */
+
#include <sched.h>
+#include <semaphore.h>
+#include <errno.h>
#include <fcntl.h>
#include <time.h>
#include <tmacros.h>
+#include <pmacros.h>
#include "test_support.h"
+#define MAX_SEMS 10
+
void *POSIX_Init(
void *argument
)
@@ -13,7 +27,7 @@ void *POSIX_Init(
int status;
int value;
int i;
- sem_t sems[CONFIGURE_MAXIMUM_POSIX_SEMAPHORES];
+ sem_t sems[MAX_SEMS];
sem_t sem2;
sem_t *n_sem1;
sem_t *n_sem2;
@@ -28,7 +42,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" );
puts( "Init: sem_init - SUCCESSFUL" );
- for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 0; i < MAX_SEMS; i++) {
status = sem_init(&sems[i], 0, i);
sprintf(failure_msg, "sem_init %d", i );
fatal_posix_service_status( status, 0, failure_msg);
@@ -44,7 +58,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, ENOSYS, "sem_init errno set to ENOSYS");
puts( "Init: sem_getvalue - SUCCESSFUL ");
- for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 0; i < MAX_SEMS; i++) {
status = sem_getvalue(&sems[i], &value);
sprintf( failure_msg, "sem_getvalue %d", i );
fatal_posix_service_status( status, 0, failure_msg );
@@ -143,7 +157,7 @@ void *POSIX_Init(
fatal_posix_service_status( errno, EINVAL, "sem_post errno EINVAL");
puts( "Init: sem_destroy - SUCCESSFUL" );
- for (i = 1; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
+ for (i = 1; i < MAX_SEMS; i++) {
status = sem_destroy(&sems[i]);
sprintf( failure_msg, "sem_destroy %d", i );
fatal_posix_service_status( status, 0, failure_msg );
@@ -287,3 +301,19 @@ void *POSIX_Init(
return NULL; /* just so the compiler thinks we returned something */
}
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES MAX_SEMS
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+ (RTEMS_MINIMUM_STACK_SIZE * 4)
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxsem01/system.h b/testsuites/psxtests/psxsem01/system.h
deleted file mode 100644
index 5a62affd46..0000000000
--- a/testsuites/psxtests/psxsem01/system.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* system.h
- *
- * This include file contains information that is included in every
- * function in the test set.
- *
- * COPYRIGHT (c) 1989-1999.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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 <unistd.h>
-#include <errno.h>
-#include <sched.h>
-#include <semaphore.h>
-#include <tmacros.h>
-
-void *POSIX_Init(
- void *argument
-);
-
-void *Task_1_through_3(
- void *argument
-);
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
-
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 10
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
-#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
- (RTEMS_MINIMUM_STACK_SIZE * 4)
-
-#include <rtems/confdefs.h>
-
-/* global variables */
-
-TEST_EXTERN pthread_t Init_id;
-TEST_EXTERN pthread_t Task_id;
-
-/* end of include file */