diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-05-06 07:08:04 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-05-06 07:08:04 +0000 |
commit | b68d231ee23e5d1a0e38e03d34ce5af3c5cfd5f8 (patch) | |
tree | 4ba3d4d9a03dfbae93f077ccff92064f7389f745 /testsuites/sptests/spnsext01 | |
parent | 2011-05-05 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-b68d231ee23e5d1a0e38e03d34ce5af3c5cfd5f8.tar.bz2 |
2011-05-06 Sebastian Huber <sebastian.huber@embedded-brains.de>
* spnsext01/.cvsignore, spnsext01/Makefile.am, spnsext01/init.c,
spnsext01/spnsext01.doc, spnsext01/spnsext01.scn: New files.
* Makefile.am, configure.ac: Reflect changes above.
Diffstat (limited to 'testsuites/sptests/spnsext01')
-rw-r--r-- | testsuites/sptests/spnsext01/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/sptests/spnsext01/Makefile.am | 27 | ||||
-rw-r--r-- | testsuites/sptests/spnsext01/init.c | 88 | ||||
-rw-r--r-- | testsuites/sptests/spnsext01/spnsext01.doc | 27 | ||||
-rw-r--r-- | testsuites/sptests/spnsext01/spnsext01.scn | 2 |
5 files changed, 146 insertions, 0 deletions
diff --git a/testsuites/sptests/spnsext01/.cvsignore b/testsuites/sptests/spnsext01/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/spnsext01/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/spnsext01/Makefile.am b/testsuites/sptests/spnsext01/Makefile.am new file mode 100644 index 0000000000..7abbcb73d1 --- /dev/null +++ b/testsuites/sptests/spnsext01/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +MANAGERS = io semaphore event + +rtems_tests_PROGRAMS = spnsext01 +spnsext01_SOURCES = init.c + +dist_rtems_tests_DATA = spnsext01.scn spnsext01.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +spnsext01_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(spnsext01_OBJECTS) $(spnsext01_LDADD) +LINK_LIBS = $(spnsext01_LDLIBS) + +spnsext01$(EXEEXT): $(spnsext01_OBJECTS) $(spnsext01_DEPENDENCIES) + @rm -f spnsext01$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/spnsext01/init.c b/testsuites/sptests/spnsext01/init.c new file mode 100644 index 0000000000..7520b0648d --- /dev/null +++ b/testsuites/sptests/spnsext01/init.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2011 embedded brains GmbH. All rights reserved. + * + * embedded brains GmbH + * Obere Lagerstr. 30 + * 82178 Puchheim + * Germany + * <rtems@embedded-brains.de> + * + * 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 <tmacros.h> + +static rtems_task Init(rtems_task_argument argument) +{ + rtems_status_code sc = RTEMS_SUCCESSFUL; + rtems_interrupt_level level; + rtems_interval t0 = 0; + rtems_interval t1 = 0; + int i = 0; + int n = 0; + struct timespec uptime; + struct timespec new_uptime; + + puts("\n\n*** TEST NANO SECONDS EXTENSION 1 ***"); + + /* Align with clock tick */ + t0 = rtems_clock_get_ticks_since_boot(); + while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) { + /* Do nothing */ + } + + t0 = t1; + sc = rtems_clock_get_uptime(&uptime); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + while ((t1 = rtems_clock_get_ticks_since_boot()) == t0) { + ++n; + sc = rtems_clock_get_uptime(&new_uptime); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(!_Timestamp_Less_than(&new_uptime, &uptime)); + uptime = new_uptime; + } + + n = (3 * n) / 2; + + rtems_interrupt_disable(level); + sc = rtems_clock_get_uptime(&uptime); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + for (i = 0; i < n; ++i) { + /* Preserve execution time of previous loop */ + rtems_clock_get_ticks_since_boot(); + + sc = rtems_clock_get_uptime(&new_uptime); + rtems_test_assert(sc == RTEMS_SUCCESSFUL); + rtems_test_assert(!_Timestamp_Less_than(&new_uptime, &uptime)); + uptime = new_uptime; + } + rtems_interrupt_enable(level); + + puts("*** END OF TEST NANO SECONDS EXTENSION 1 ***"); + + rtems_test_exit(0); +} + +#define CONFIGURE_INIT + +#define CONFIGURE_MICROSECONDS_PER_TICK 100000 + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_DRIVERS 2 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#include <rtems/confdefs.h> diff --git a/testsuites/sptests/spnsext01/spnsext01.doc b/testsuites/sptests/spnsext01/spnsext01.doc new file mode 100644 index 0000000000..c35f4a5c17 --- /dev/null +++ b/testsuites/sptests/spnsext01/spnsext01.doc @@ -0,0 +1,27 @@ +# +# Copyright (c) 2011 embedded brains GmbH. All rights reserved. +# +# embedded brains GmbH +# Obere Lagerstr. 30 +# 82178 Puchheim +# Germany +# <rtems@embedded-brains.de> +# +# 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$ +# + +This file describes the directives and concepts tested by this test set. + +test set name: spnsext + +directives: + + rtems_clock_get_uptime + +concepts: + ++ Check if nano seconds extension works. diff --git a/testsuites/sptests/spnsext01/spnsext01.scn b/testsuites/sptests/spnsext01/spnsext01.scn new file mode 100644 index 0000000000..bb64f82d76 --- /dev/null +++ b/testsuites/sptests/spnsext01/spnsext01.scn @@ -0,0 +1,2 @@ +*** TEST NANO SECONDS EXTENSION 1 *** +*** END OF TEST NANO SECONDS EXTENSION 1 *** |