diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-22 20:53:33 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-22 20:53:33 +0000 |
commit | dfe9034dad6c3fd7c1b269e880ca4d229fdbeb0b (patch) | |
tree | 30ab7abdffc8c8d86216c9d08f526de95cfc7db9 /testsuites/psxtmtests/psxtmsleep02 | |
parent | 2011-06-21 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-dfe9034dad6c3fd7c1b269e880ca4d229fdbeb0b.tar.bz2 |
2011-06-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* Makefile.am, configure.ac: Add test case for sleep - blocking.
* psxtmsleep02/.cvsignore, psxtmsleep02/Makefile.am,
psxtmsleep02/init.c, psxtmsleep02/psxtmsleep02.doc: New files.
Diffstat (limited to 'testsuites/psxtmtests/psxtmsleep02')
-rw-r--r-- | testsuites/psxtmtests/psxtmsleep02/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmsleep02/Makefile.am | 30 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmsleep02/init.c | 87 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmsleep02/psxtmsleep02.doc | 14 |
4 files changed, 133 insertions, 0 deletions
diff --git a/testsuites/psxtmtests/psxtmsleep02/.cvsignore b/testsuites/psxtmtests/psxtmsleep02/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmsleep02/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmsleep02/Makefile.am b/testsuites/psxtmtests/psxtmsleep02/Makefile.am new file mode 100644 index 0000000000..470daf595e --- /dev/null +++ b/testsuites/psxtmtests/psxtmsleep02/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmsleep02 +psxtmsleep02_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmsleep02.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +OPERATION_COUNT = @OPERATION_COUNT@ +AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include +AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT) +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtmsleep02_OBJECTS) $(psxtmsleep02_LDADD) +LINK_LIBS = $(psxtmsleep02_LDLIBS) + +psxtmsleep02$(EXEEXT): $(psxtmsleep02_OBJECTS) $(psxtmsleep02_DEPENDENCIES) + @rm -f psxtmsleep02$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmsleep02/init.c b/testsuites/psxtmtests/psxtmsleep02/init.c new file mode 100644 index 0000000000..4938584069 --- /dev/null +++ b/testsuites/psxtmtests/psxtmsleep02/init.c @@ -0,0 +1,87 @@ +/* + * COPYRIGHT (c) 1989-2011. + * 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$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <timesys.h> +#include <rtems/timerdrv.h> +#include "test_support.h" + +#include <pthread.h> + +void *Low( + void *argument +) +{ + long end_time; + + end_time = benchmark_timer_read(); + + put_time( + "sleep - blocking", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + puts( "*** END OF POSIX TIME TEST sleep - blocking ***" ); + + rtems_test_exit( 0 ); + return NULL; +} + +void *Middle( + void *argument +) +{ + sleep(1); + return NULL; +} + +void *POSIX_Init( + void *argument +) +{ + int i; + int status; + pthread_t threadId; + + puts( "\n\n*** POSIX TIME TEST sleep - blocking ***" ); + + for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { + status = pthread_create( &threadId, NULL, Middle, NULL ); + rtems_test_assert( !status ); + } + + status = pthread_create( &threadId, NULL, Low, NULL ); + rtems_test_assert( !status ); + + /* start the timer and switch through all the other tasks */ + benchmark_timer_initialize(); + sleep(1); + return NULL; +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 2 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> + /* end of file */ diff --git a/testsuites/psxtmtests/psxtmsleep02/psxtmsleep02.doc b/testsuites/psxtmtests/psxtmsleep02/psxtmsleep02.doc new file mode 100644 index 0000000000..325141e54d --- /dev/null +++ b/testsuites/psxtmtests/psxtmsleep02/psxtmsleep02.doc @@ -0,0 +1,14 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2011. +# 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. +# + +This test benchmarks the following operations: + ++ sleep - blocking |