summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-15 09:04:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-15 09:11:19 +0200
commitd6467102e2c2af2c0cacd1366d0922f5f4481ac1 (patch)
tree4c59607e834a2b77913a88ceab6b6c33bdcdb238
parentposix: Use _POSIX_Threads_Sporadic_timer_insert() (diff)
downloadrtems-d6467102e2c2af2c0cacd1366d0922f5f4481ac1.tar.bz2
psxtests/psx12: Use one file and simplify
-rw-r--r--testsuites/psxtests/psx12/Makefile.am2
-rw-r--r--testsuites/psxtests/psx12/init.c65
-rw-r--r--testsuites/psxtests/psx12/psx12.scn8
-rw-r--r--testsuites/psxtests/psx12/system.h52
-rw-r--r--testsuites/psxtests/psx12/task.c40
5 files changed, 33 insertions, 134 deletions
diff --git a/testsuites/psxtests/psx12/Makefile.am b/testsuites/psxtests/psx12/Makefile.am
index fedd135125..c6325309e9 100644
--- a/testsuites/psxtests/psx12/Makefile.am
+++ b/testsuites/psxtests/psx12/Makefile.am
@@ -1,6 +1,6 @@
rtems_tests_PROGRAMS = psx12
-psx12_SOURCES = init.c task.c system.h ../include/pmacros.h
+psx12_SOURCES = init.c ../include/pmacros.h
dist_rtems_tests_DATA = psx12.scn
diff --git a/testsuites/psxtests/psx12/init.c b/testsuites/psxtests/psx12/init.c
index 410a141335..46be8183e3 100644
--- a/testsuites/psxtests/psx12/init.c
+++ b/testsuites/psxtests/psx12/init.c
@@ -12,45 +12,24 @@
#endif
#include <sched.h>
-
-#define CONFIGURE_INIT
-#include "system.h"
#include <errno.h>
-#include "pritime.h"
-const char rtems_test_name[] = "PSX 12";
+#include <pmacros.h>
-void print_schedparam(
- char *prefix,
- struct sched_param *schedparam
-);
+const char rtems_test_name[] = "PSX 12";
-void print_schedparam(
- char *prefix,
- struct sched_param *schedparam
-)
+static void *sporadic_server( void *argument )
{
- printf( "%ssched priority = %d\n", prefix, schedparam->sched_priority );
-#if defined(_POSIX_SPORADIC_SERVER)
- printf( "%ssched_ss_low_priority = %d\n",
- prefix, schedparam->sched_ss_low_priority );
- printf( "%ssched_ss_repl_period = (%" PRIdtime_t ", %ld)\n", prefix,
- schedparam->sched_ss_repl_period.tv_sec,
- schedparam->sched_ss_repl_period.tv_nsec );
- printf( "%ssched_ss_init_budget = (%" PRIdtime_t ", %ld)\n", prefix,
- schedparam->sched_ss_init_budget.tv_sec,
- schedparam->sched_ss_init_budget.tv_nsec );
-#else
- printf( "%s_POSIX_SPORADIC_SERVER is not defined\n", prefix );
-#endif
+ puts( "Sporadic Server: exitting" );
+
+ return NULL;
}
-void *POSIX_Init(
- void *argument
-)
+static void *POSIX_Init( void *argument )
{
int status;
pthread_attr_t attr;
+ pthread_t thread;
struct sched_param schedparam;
TEST_BEGIN();
@@ -61,8 +40,7 @@ void *POSIX_Init(
/* get id of this thread */
- Init_id = pthread_self();
- printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+ printf( "Init's ID is 0x%08" PRIxpthread_t "\n", pthread_self() );
/* invalid scheduling policy error */
@@ -75,7 +53,7 @@ void *POSIX_Init(
attr.schedpolicy = -1;
puts( "Init: pthread_create - EINVAL (invalid scheduling policy)" );
- status = pthread_create( &Task_id, &attr, Task_1, NULL );
+ status = pthread_create( &thread, &attr, sporadic_server, NULL );
rtems_test_assert( status == EINVAL );
/* replenish period < budget error */
@@ -103,7 +81,7 @@ void *POSIX_Init(
rtems_test_assert( !status );
puts( "Init: pthread_create - EINVAL (replenish < budget)" );
- status = pthread_create( &Task_id, &attr, Task_1, NULL );
+ status = pthread_create( &thread, &attr, sporadic_server, NULL );
rtems_test_assert( status == EINVAL );
/* invalid sched_ss_low_priority error */
@@ -120,7 +98,7 @@ void *POSIX_Init(
rtems_test_assert( !status );
puts( "Init: pthread_create - EINVAL (invalid sched_ss_low_priority)" );
- status = pthread_create( &Task_id, &attr, Task_1, NULL );
+ status = pthread_create( &thread, &attr, sporadic_server, NULL );
rtems_test_assert( status == EINVAL );
/* create a thread as a sporadic server */
@@ -137,11 +115,11 @@ void *POSIX_Init(
rtems_test_assert( !status );
puts( "Init: pthread_create - SUCCESSFUL" );
- status = pthread_create( &Task_id, &attr, Task_1, NULL );
+ status = pthread_create( &thread, &attr, sporadic_server, NULL );
rtems_test_assert( !status );
- status = pthread_join( Task_id, NULL );
- rtems_test_assert( status );
+ status = pthread_join( thread, NULL );
+ rtems_test_assert( !status );
/* switch to Task_1 */
@@ -150,3 +128,16 @@ void *POSIX_Init(
return NULL; /* just so the compiler thinks we returned something */
}
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psx12/psx12.scn b/testsuites/psxtests/psx12/psx12.scn
index e35bdab6ae..1e3c04660d 100644
--- a/testsuites/psxtests/psx12/psx12.scn
+++ b/testsuites/psxtests/psx12/psx12.scn
@@ -1,11 +1,11 @@
-*** POSIX TEST 12 ***
+*** BEGIN OF TEST PSX 12 ***
Init's ID is 0x0b010001
Init: pthread_attr_init - SUCCESSFUL
Init: pthread_create - EINVAL (invalid scheduling policy)
Init: pthread_attr_init - SUCCESSFUL
Init: set scheduling parameter attributes for sporadic server
Init: pthread_create - EINVAL (replenish < budget)
-Init: pthread_create - EINVAL (invalid ss_low_priority)
+Init: pthread_create - EINVAL (invalid sched_ss_low_priority)
Init: pthread_create - SUCCESSFUL
-Task_1: exitting
-*** END OF POSIX TEST 12 ***
+Sporadic Server: exitting
+*** END OF TEST PSX 12 ***
diff --git a/testsuites/psxtests/psx12/system.h b/testsuites/psxtests/psx12/system.h
deleted file mode 100644
index 9aa786ebd2..0000000000
--- a/testsuites/psxtests/psx12/system.h
+++ /dev/null
@@ -1,52 +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.org/license/LICENSE.
- */
-
-/* functions */
-
-#include <pmacros.h>
-
-void *POSIX_Init(
- void *argument
-);
-
-void *Task_1(
- void *argument
-);
-
-/* configuration information */
-
-#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
-#define CONFIGURE_MAXIMUM_POSIX_KEYS 10
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 10
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
-
-#include <rtems/confdefs.h>
-
-/* global variables */
-
-#ifdef CONFIGURE_INIT
-#define TEST_EXTERN
-#else
-#define TEST_EXTERN extern
-#endif
-
-TEST_EXTERN pthread_t Init_id;
-TEST_EXTERN pthread_t Task_id;
-
-/* end of include file */
diff --git a/testsuites/psxtests/psx12/task.c b/testsuites/psxtests/psx12/task.c
deleted file mode 100644
index 0a288d4afd..0000000000
--- a/testsuites/psxtests/psx12/task.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Task_1
- *
- * This routine serves as a test task. It verifies the basic task
- * switching capabilities of the executive.
- *
- * Input parameters:
- * argument - task argument
- *
- * Output parameters: NONE
- *
- * 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.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "system.h"
-#include <time.h>
-#include <sched.h>
-
-void *Task_1(
- void *argument
-)
-{
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
-
- puts( "Task_1: exitting" );
- pthread_exit( NULL );
-
- return NULL; /* just so the compiler thinks we returned something */
-}