summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtmtests
diff options
context:
space:
mode:
authorDaniel Ramirez <javamonn@gmail.com>2013-12-02 20:24:28 -0600
committerGedare Bloom <gedare@rtems.org>2013-12-02 22:43:09 -0500
commit064820c8740766a4cbe698dd9dd7ec100fe3ebbb (patch)
treeb04a1a593c010d3fbca87f55ffa963c55343f651 /testsuites/psxtmtests
parentleon2_doxygen_1 (diff)
downloadrtems-064820c8740766a4cbe698dd9dd7ec100fe3ebbb.tar.bz2
psxtmtests: added new psxtmthread04 test
Diffstat (limited to 'testsuites/psxtmtests')
-rw-r--r--testsuites/psxtmtests/Makefile.am1
-rw-r--r--testsuites/psxtmtests/configure.ac1
-rw-r--r--testsuites/psxtmtests/psxtmtests_plan.csv4
-rw-r--r--testsuites/psxtmtests/psxtmthread04/Makefile.am27
-rw-r--r--testsuites/psxtmtests/psxtmthread04/init.c98
-rw-r--r--testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc24
6 files changed, 153 insertions, 2 deletions
diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am
index e5ca7b5fe0..4474cbe65e 100644
--- a/testsuites/psxtmtests/Makefile.am
+++ b/testsuites/psxtmtests/Makefile.am
@@ -45,6 +45,7 @@ SUBDIRS += psxtmsleep02
SUBDIRS += psxtmthread01
SUBDIRS += psxtmthread02
SUBDIRS += psxtmthread03
+SUBDIRS += psxtmthread04
SUBDIRS += psxtmthread05
SUBDIRS += psxtmthread06
endif
diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac
index 5f0a503da4..8b720f128b 100644
--- a/testsuites/psxtmtests/configure.ac
+++ b/testsuites/psxtmtests/configure.ac
@@ -119,6 +119,7 @@ psxtmsleep02/Makefile
psxtmthread01/Makefile
psxtmthread02/Makefile
psxtmthread03/Makefile
+psxtmthread04/Makefile
psxtmthread05/Makefile
psxtmthread06/Makefile
])
diff --git a/testsuites/psxtmtests/psxtmtests_plan.csv b/testsuites/psxtmtests/psxtmtests_plan.csv
index 6f511b83f1..f5f4f8da90 100644
--- a/testsuites/psxtmtests/psxtmtests_plan.csv
+++ b/testsuites/psxtmtests/psxtmtests_plan.csv
@@ -32,8 +32,8 @@
"pthread_detach",,,
"pthread_exit",,,
"pthread_exit","psxtmthread03","psxtmtest_single","Yes"
-"pthread_getschedparam","psxtmthread04","psxtmtest_single w/multiple timings","No"
-"pthread_setschedparam - no thread switch","psxtmthread04","psxtmtest_single w/multiple timings","No"
+"pthread_getschedparam","psxtmthread04","psxtmtest_single w/multiple timings","Yes"
+"pthread_setschedparam - no thread switch","psxtmthread04","psxtmtest_single w/multiple timings","Yes"
"pthread_setschedparam - lower own priority: preempt","psxtmthread05","psxtmtest_single","Yes"
"pthread_setschedparam - raise other priority: preempt","psxtmthread06","psxtmtest_single","Yes"
,,,
diff --git a/testsuites/psxtmtests/psxtmthread04/Makefile.am b/testsuites/psxtmtests/psxtmthread04/Makefile.am
new file mode 100644
index 0000000000..e479bade35
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread04/Makefile.am
@@ -0,0 +1,27 @@
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxtmthread04
+psxtmthread04_SOURCES = init.c
+psxtmthread04_SOURCES += ../../tmtests/include/timesys.h
+psxtmthread04_SOURCES += ../../support/src/tmtests_empty_function.c
+psxtmthread04_SOURCES += ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = psxtmthread04.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 = $(psxtmthread04_OBJECTS) $(psxtmthread04_LDADD)
+LINK_LIBS = $(psxtmthread04_LDLIBS)
+
+psxtmthread04$(EXEEXT): $(psxtmthread04_OBJECTS) $(psxtmthread04_DEPENDENCIES)
+ @rm -f psxtmthread04$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtmtests/psxtmthread04/init.c b/testsuites/psxtmtests/psxtmthread04/init.c
new file mode 100644
index 0000000000..b67fca1946
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread04/init.c
@@ -0,0 +1,98 @@
+/*
+ * COPYRIGHT (c) 1989-2013.
+ * 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
+
+#include <timesys.h>
+#include <pthread.h>
+#include <sched.h>
+#include <rtems/timerdrv.h>
+#include "test_support.h"
+
+/* forward declarations to avoid warnings */
+void benchmark_pthread_setschedparam(void);
+void benchmark_pthread_getschedparam(void);
+void *POSIX_Init(void *argument);
+
+void benchmark_pthread_getschedparam(void)
+{
+ long end_time;
+ int status;
+ int policy;
+ struct sched_param param;
+
+ benchmark_timer_initialize();
+ status = pthread_getschedparam( pthread_self(), &policy, &param );
+ end_time = benchmark_timer_read();
+ rtems_test_assert( status == 0 );
+
+ put_time(
+ "pthread_getschedparam",
+ end_time,
+ 1, /* Only executed once */
+ 0,
+ 0
+ );
+
+}
+
+void benchmark_pthread_setschedparam(void)
+{
+ long end_time;
+ int status;
+ int policy;
+ struct sched_param param;
+
+ status = pthread_getschedparam( pthread_self(), &policy, &param );
+ rtems_test_assert( status == 0 );
+
+ /* Arbitrary priority, no other threads to preempt us so it doesn't matter. */
+ param.sched_priority = 5;
+ benchmark_timer_initialize();
+ status = pthread_setschedparam( pthread_self(), policy, &param );
+ end_time = benchmark_timer_read();
+ rtems_test_assert( status == 0 );
+
+ put_time(
+ "pthread_setschedparam - no thread switch",
+ end_time,
+ 1, /* Only executed once */
+ 0,
+ 0
+ );
+}
+
+void *POSIX_Init(
+ void *argument
+)
+{
+
+ puts( "\n\n*** POSIX TIME TEST PSXTMTHREAD04 ***" );
+
+ benchmark_pthread_getschedparam();
+ benchmark_pthread_setschedparam();
+
+ puts( "*** END OF POSIX TIME TEST PSXTMTHREAD04 ***" );
+ rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc b/testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc
new file mode 100644
index 0000000000..7088b4ea84
--- /dev/null
+++ b/testsuites/psxtmtests/psxtmthread04/psxtmthread04.doc
@@ -0,0 +1,24 @@
+# COPYRIGHT (c) 1989-2013.
+# 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:
+
++ pthread_getschedparam
++ pthread_setschedparam - no thread switch
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: psxtmthread
+
+directives:
++ pthread_getschedparam
++ pthread_setschedparam
+
+concepts:
++ Benchmark the call pthread_getschedparam and pthread_setschedparam without
+ triggering a context switch.