summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGedare Bloom <gedare@rtems.org>2015-03-03 11:08:51 -0500
committerGedare Bloom <gedare@rtems.org>2015-03-04 15:38:53 -0500
commit56c719260668c35e87acda32bb12bdf81f08d9e0 (patch)
tree7e406ae9078bed668603b4befda64434377b4ab6
parentlibcsupport: scale times() call to microseconds (diff)
downloadrtems-56c719260668c35e87acda32bb12bdf81f08d9e0.tar.bz2
psxtests/psxclock01: use clock() and CLOCKS_PER_SEC
Closes #2182
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psxclock01/Makefile.am21
-rw-r--r--testsuites/psxtests/psxclock01/init.c50
-rw-r--r--testsuites/psxtests/psxclock01/psxclock01.doc19
-rw-r--r--testsuites/psxtests/psxclock01/psxclock01.scn3
6 files changed, 95 insertions, 1 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index e15d72f105..e734c6c0b1 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -14,7 +14,7 @@ _SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
psxspin01 psxspin02 psxsysconf \
psxtime psxtimer01 psxtimer02 psxualarm psxusleep psxfatal01 psxfatal02 \
psxintrcritical01 psxstack01 psxstack02 \
- psxeintr_join psxgetattrnp01
+ psxeintr_join psxgetattrnp01 psxclock01
if HAS_CPLUSPLUS
_SUBDIRS += psxglobalcon01
_SUBDIRS += psxglobalcon02
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 00c9970062..78ae4593d0 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -141,6 +141,7 @@ psxclassic01/Makefile
psxcleanup/Makefile
psxcleanup01/Makefile
psxclock/Makefile
+psxclock01/Makefile
psxcond01/Makefile
psxconfig01/Makefile
psxeintr_join/Makefile
diff --git a/testsuites/psxtests/psxclock01/Makefile.am b/testsuites/psxtests/psxclock01/Makefile.am
new file mode 100644
index 0000000000..acb8f6dc67
--- /dev/null
+++ b/testsuites/psxtests/psxclock01/Makefile.am
@@ -0,0 +1,21 @@
+rtems_tests_PROGRAMS = psxclock01
+psxclock01_SOURCES = init.c
+
+dist_rtems_tests_DATA = psxclock01.scn
+dist_rtems_tests_DATA += psxclock01.doc
+
+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 = $(psxclock01_OBJECTS) $(psxclock01_LDADD)
+LINK_LIBS = $(psxclock01_LDLIBS)
+
+psxclock01$(EXEEXT): $(psxclock01_OBJECTS) $(psxclock01_DEPENDENCIES)
+ @rm -f psxclock01$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxclock01/init.c b/testsuites/psxtests/psxclock01/init.c
new file mode 100644
index 0000000000..bb39faa9b9
--- /dev/null
+++ b/testsuites/psxtests/psxclock01/init.c
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015 Gedare Bloom.
+ *
+ * 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.
+ */
+
+#include <tmacros.h>
+#include "test_support.h"
+
+const char rtems_test_name[] = "PSXCLOCK01";
+#include <time.h>
+
+/* forward declarations to avoid warnings */
+void *POSIX_Init(void *argument);
+
+void *POSIX_Init(void *argument)
+{
+ clock_t start, end;
+ int diff = 0;
+
+ TEST_BEGIN();
+
+ start = clock();
+ end = 0;
+ if ( start >= 0 ) {
+ do {
+ end = clock();
+ diff = (int)(end - start)/CLOCKS_PER_SEC;
+ } while (diff < 1);
+ }
+
+ printf("Spun for %d second\n", diff);
+
+ TEST_END();
+ rtems_test_exit(0);
+}
+
+/* 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_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */
diff --git a/testsuites/psxtests/psxclock01/psxclock01.doc b/testsuites/psxtests/psxclock01/psxclock01.doc
new file mode 100644
index 0000000000..f1d0c8f9d7
--- /dev/null
+++ b/testsuites/psxtests/psxclock01/psxclock01.doc
@@ -0,0 +1,19 @@
+# Copyright (c) 2015 Gedare Bloom
+#
+# 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: psxclock01
+
+directives:
+
+ clock
+
+concepts:
+
++ Reads clock() and converts to time in seconds.
+
diff --git a/testsuites/psxtests/psxclock01/psxclock01.scn b/testsuites/psxtests/psxclock01/psxclock01.scn
new file mode 100644
index 0000000000..ec290803dc
--- /dev/null
+++ b/testsuites/psxtests/psxclock01/psxclock01.scn
@@ -0,0 +1,3 @@
+*** BEGIN OF TEST PSXCLOCK01 ***
+Spun for 1 second
+*** END OF TEST PSXCLOCK01 ***