mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-22 04:54:43 +08:00
psxtests: move pthread_once tests into an extra test.
This commit is contained in:
committed by
Sebastian Huber
parent
f31311aa67
commit
6592cabade
@@ -30,6 +30,9 @@ if HAS_POSIX
|
||||
SUBDIRS += psxkey07
|
||||
endif
|
||||
|
||||
## POSIX Once is always available
|
||||
SUBDIRS += psxonce01
|
||||
|
||||
SUBDIRS += psxrdwrv
|
||||
|
||||
include $(top_srcdir)/../automake/subdirs.am
|
||||
|
||||
@@ -168,6 +168,7 @@ psxmsgq03/Makefile
|
||||
psxmsgq04/Makefile
|
||||
psxmutexattr01/Makefile
|
||||
psxobj01/Makefile
|
||||
psxonce01/Makefile
|
||||
psxpasswd01/Makefile
|
||||
psxpasswd02/Makefile
|
||||
psxpipe01/Makefile
|
||||
|
||||
@@ -20,18 +20,6 @@
|
||||
|
||||
#include <rtems/score/todimpl.h>
|
||||
|
||||
pthread_once_t nesting_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
void Test_init_routine_nesting( void );
|
||||
|
||||
void Test_init_routine_nesting( void )
|
||||
{
|
||||
int status;
|
||||
puts( "Test_init_routine_nesting: invoked" );
|
||||
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
}
|
||||
|
||||
void *POSIX_Init(
|
||||
void *argument
|
||||
)
|
||||
@@ -107,11 +95,6 @@ void *POSIX_Init(
|
||||
);
|
||||
rtems_test_assert( !status );
|
||||
|
||||
/* once nesting */
|
||||
puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
|
||||
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
/* create a thread */
|
||||
|
||||
puts( "Init: pthread_create - SUCCESSFUL" );
|
||||
|
||||
@@ -14,7 +14,6 @@ test set name: psx01
|
||||
directives:
|
||||
pthread_create
|
||||
pthread_equal
|
||||
pthread_once
|
||||
sched_get_priority_min
|
||||
sched_get_priority_max
|
||||
sched_rr_get_interval
|
||||
@@ -32,5 +31,3 @@ concepts:
|
||||
+ Verify that thread yielding is operational
|
||||
+ Verify that pthread_equal works as expected for different combinations of
|
||||
legitimate and illegitimate thread id’s
|
||||
+ Verify that pthread_once works as expected for different combinations of
|
||||
legitimate and illegitimate thread initiations
|
||||
|
||||
@@ -27,9 +27,4 @@ Task_1: pthread_equal - match case passed
|
||||
Task_1: pthread_equal - different case passed
|
||||
Task_1: pthread_equal - first id bad
|
||||
Task_1: pthread_equal - second id bad
|
||||
Task_1: pthread_once - EINVAL (NULL once_control)
|
||||
Task_1: pthread_once - EINVAL (NULL init_routine)
|
||||
Task_1: pthread_once - SUCCESSFUL (init_routine executes)
|
||||
Test_init_routine: invoked
|
||||
Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)
|
||||
*** END OF POSIX TEST 1 ***
|
||||
|
||||
@@ -35,7 +35,6 @@ void *Task_1_through_3(
|
||||
)
|
||||
{
|
||||
int status;
|
||||
pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
puts( "Task_1: sched_yield to Init" );
|
||||
status = sched_yield();
|
||||
@@ -72,24 +71,6 @@ void *Task_1_through_3(
|
||||
status = pthread_equal( Init_id, (pthread_t) -1 );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
/* exercise pthread_once */
|
||||
|
||||
puts( "Task_1: pthread_once - EINVAL (NULL once_control)" );
|
||||
status = pthread_once( NULL, Test_init_routine );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
|
||||
puts( "Task_1: pthread_once - EINVAL (NULL init_routine)" );
|
||||
status = pthread_once( &once, NULL );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
|
||||
puts( "Task_1: pthread_once - SUCCESSFUL (init_routine executes)" );
|
||||
status = pthread_once( &once, Test_init_routine );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
puts( "Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)" );
|
||||
status = pthread_once( &once, Test_init_routine );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
puts( "*** END OF POSIX TEST 1 ***" );
|
||||
rtems_test_exit( 0 );
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
rtems_tests_PROGRAMS = psxonce01
|
||||
psxonce01_SOURCES = init.c system.h ../include/pmacros.h
|
||||
|
||||
dist_rtems_tests_DATA = psxonce01.scn
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../automake/compile.am
|
||||
include $(top_srcdir)/../automake/leaf.am
|
||||
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
|
||||
LINK_OBJS = $(psxonce01_OBJECTS)
|
||||
LINK_LIBS = $(psxonce01_LDLIBS)
|
||||
|
||||
psxonce01$(EXEEXT): $(psxonce01_OBJECTS) $(psxonce01_DEPENDENCIES)
|
||||
@rm -f psxonce01$(EXEEXT)
|
||||
$(make-exe)
|
||||
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#define CONFIGURE_INIT
|
||||
#include "system.h"
|
||||
|
||||
pthread_once_t nesting_once = PTHREAD_ONCE_INIT;
|
||||
|
||||
void Test_init_routine_nesting( void );
|
||||
|
||||
void Test_init_routine_nesting( void )
|
||||
{
|
||||
int status;
|
||||
puts( "Test_init_routine_nesting: invoked" );
|
||||
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
}
|
||||
|
||||
void Test_init_routine( void );
|
||||
|
||||
void Test_init_routine( void )
|
||||
{
|
||||
puts( "Test_init_routine: invoked" );
|
||||
}
|
||||
|
||||
rtems_task Init(rtems_task_argument argument)
|
||||
{
|
||||
int status;
|
||||
pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
|
||||
puts( "\n\n*** TEST POSIX ONCE 01 ***" );
|
||||
|
||||
/* once nesting */
|
||||
puts( "Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)" );
|
||||
status = pthread_once( &nesting_once, Test_init_routine_nesting );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
/* exercise pthread_once */
|
||||
|
||||
puts( "Init: pthread_once - EINVAL (NULL once_control)" );
|
||||
status = pthread_once( NULL, Test_init_routine );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
|
||||
puts( "Init: pthread_once - EINVAL (NULL init_routine)" );
|
||||
status = pthread_once( &once, NULL );
|
||||
rtems_test_assert( status == EINVAL );
|
||||
|
||||
puts( "Init: pthread_once - SUCCESSFUL (init_routine executes)" );
|
||||
status = pthread_once( &once, Test_init_routine );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
puts( "Init: pthread_once - SUCCESSFUL (init_routine does not execute)" );
|
||||
status = pthread_once( &once, Test_init_routine );
|
||||
rtems_test_assert( !status );
|
||||
|
||||
puts( "*** END OF TEST POSIX ONCE 01 ***" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
# COPYRIGHT (c) 1989-2009.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright (c) 2013 Annelies Odermann <annelies.odermann@gmail.com>
|
||||
# Copyright (c) 2014 embedded brains GmbH.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: psxonce01
|
||||
|
||||
directives:
|
||||
pthread_once
|
||||
|
||||
concepts:
|
||||
+ Verify that pthread_once works as expected for different combinations of
|
||||
legitimate and illegitimate thread initiations
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
|
||||
*** TEST POSIX ONCE 01 ***
|
||||
Init: pthread_once - SUCCESSFUL (init_routine_nesting executes)
|
||||
Test_init_routine_nesting: invoked
|
||||
Init: pthread_once - EINVAL (NULL once_control)
|
||||
Init: pthread_once - EINVAL (NULL init_routine)
|
||||
Init: pthread_once - SUCCESSFUL (init_routine executes)
|
||||
Test_init_routine: invoked
|
||||
Init: pthread_once - SUCCESSFUL (init_routine does not execute)
|
||||
*** END OF TEST POSIX ONCE 01 ***
|
||||
@@ -0,0 +1,28 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
/* functions */
|
||||
|
||||
#include <pmacros.h>
|
||||
|
||||
/* configuration information */
|
||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 1
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/* end of include file */
|
||||
Reference in New Issue
Block a user