summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-28 16:01:53 +0000
committerSebastian Huber <sebastian.huber@embedded-brains.de>2011-09-28 16:01:53 +0000
commit0d573690ae0b2075e99f13f9006b959a9f0da184 (patch)
tree2e24fb0a52938b3ce89f2eda0a49ec6305e973b4 /testsuites
parent2011-09-28 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-0d573690ae0b2075e99f13f9006b959a9f0da184.tar.bz2
2011-09-28 Sebastian Huber <sebastian.huber@embedded-brains.de>
* sp2038/Makefile.am, sp2038/init.c, sp2038/sp2038.doc, sp2038/sp2038.scn: New files. * Makefile.am, configure.ac: Reflect changes above.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/sptests/ChangeLog6
-rw-r--r--testsuites/sptests/Makefile.am2
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/sp2038/Makefile.am28
-rw-r--r--testsuites/sptests/sp2038/init.c127
-rw-r--r--testsuites/sptests/sp2038/sp2038.doc23
-rw-r--r--testsuites/sptests/sp2038/sp2038.scn2
7 files changed, 188 insertions, 1 deletions
diff --git a/testsuites/sptests/ChangeLog b/testsuites/sptests/ChangeLog
index 0591c43cf0..c24b24e925 100644
--- a/testsuites/sptests/ChangeLog
+++ b/testsuites/sptests/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-28 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * sp2038/Makefile.am, sp2038/init.c, sp2038/sp2038.doc,
+ sp2038/sp2038.scn: New files.
+ * Makefile.am, configure.ac: Reflect changes above.
+
2011-09-27 Sebastian Huber <sebastian.huber@embedded-brains.de>
* spfatal07/testcase.h: Print end of test if test is not applicable.
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index a67dffec39..24775cd75d 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -14,7 +14,7 @@ SUBDIRS = \
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
sp60 sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
- sp70 sp71 sp72 sp73 sp74 sp75 sp76 \
+ sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp2038 \
spassoc01 spchain spclockget spcoverage spobjgetnext \
spnotepad01 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 3e25ca5f56..fdf584a19b 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -102,6 +102,7 @@ sp73/Makefile
sp74/Makefile
sp75/Makefile
sp76/Makefile
+sp2038/Makefile
spassoc01/Makefile
spcbssched01/Makefile
spcbssched02/Makefile
diff --git a/testsuites/sptests/sp2038/Makefile.am b/testsuites/sptests/sp2038/Makefile.am
new file mode 100644
index 0000000000..38c3ca68d7
--- /dev/null
+++ b/testsuites/sptests/sp2038/Makefile.am
@@ -0,0 +1,28 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = sp2038
+sp2038_SOURCES = init.c
+
+dist_rtems_tests_DATA = sp2038.scn
+dist_rtems_tests_DATA += sp2038.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+sp2038_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp2038_OBJECTS) $(sp2038_LDADD)
+LINK_LIBS = $(sp2038_LDLIBS)
+
+sp2038$(EXEEXT): $(sp2038_OBJECTS) $(sp2038_DEPENDENCIES)
+ @rm -f sp2038$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp2038/init.c b/testsuites/sptests/sp2038/init.c
new file mode 100644
index 0000000000..961ef3bebe
--- /dev/null
+++ b/testsuites/sptests/sp2038/init.c
@@ -0,0 +1,127 @@
+/*
+ * 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>
+
+#include <time.h>
+#include <string.h>
+
+#include <rtems.h>
+
+#define TEST_APPLICABLE \
+ (CPU_TIMESTAMP_USE_INT64 == TRUE || CPU_TIMESTAMP_USE_INT64_INLINE == TRUE)
+
+#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
+
+static const rtems_time_of_day nearly_problem_2038 = {
+ .year = 2038,
+ .month = 1,
+ .day = 19,
+ .hour = 3,
+ .minute = 14,
+ .second = 7
+};
+
+static const rtems_time_of_day problem_2038 = {
+ .year = 2038,
+ .month = 1,
+ .day = 19,
+ .hour = 3,
+ .minute = 14,
+ .second = 8
+};
+
+static const rtems_time_of_day nearly_problem_2106 = {
+ .year = 2106,
+ .month = 2,
+ .day = 7,
+ .hour = 6,
+ .minute = 28,
+ .second = 15
+};
+
+static const rtems_time_of_day problem_2106 = {
+ .year = 2106,
+ .month = 2,
+ .day = 7,
+ .hour = 6,
+ .minute = 28,
+ .second = 16
+};
+
+static void test_case(void)
+{
+#if TEST_APPLICABLE
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ int64_t one = 1;
+ int64_t large = one << 32;
+ time_t time_t_large = (time_t) large;
+ bool time_t_is_32_bit = time_t_large != large;
+ bool time_t_is_signed = (((time_t) 0) - ((time_t) 1)) < 0;
+
+ if (time_t_is_32_bit) {
+ const rtems_time_of_day *nearly_problem = NULL;
+ const rtems_time_of_day *problem = NULL;
+ rtems_time_of_day now;
+
+ if (time_t_is_signed) {
+ nearly_problem = &nearly_problem_2038;
+ problem = &problem_2038;
+ } else {
+ nearly_problem = &nearly_problem_2106;
+ problem = &problem_2106;
+ }
+
+ sc = rtems_clock_set(nearly_problem);
+ ASSERT_SC(sc);
+ sc = rtems_clock_get_tod(&now);
+ ASSERT_SC(sc);
+ rtems_test_assert(memcmp(&now, nearly_problem, sizeof(now)) == 0);
+
+ sc = rtems_clock_set(problem);
+ ASSERT_SC(sc);
+ sc = rtems_clock_get_tod(&now);
+ ASSERT_SC(sc);
+ rtems_test_assert(memcmp(&now, problem, sizeof(now)) == 0);
+ }
+#endif /* TEST_APPLICABLE */
+}
+
+rtems_task Init(rtems_task_argument argument)
+{
+ puts("\n\n*** TEST 2038 ***");
+
+ test_case();
+
+ puts("*** END OF TEST 2038 ***");
+
+ rtems_test_exit(0);
+}
+
+#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
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/sptests/sp2038/sp2038.doc b/testsuites/sptests/sp2038/sp2038.doc
new file mode 100644
index 0000000000..199859221e
--- /dev/null
+++ b/testsuites/sptests/sp2038/sp2038.doc
@@ -0,0 +1,23 @@
+#
+# $Id$
+#
+# Copyright (c) 2011 embedded brains GmbH. All rights reserved.
+#
+# 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: sp2038
+
+directives:
+
+ rtems_clock_set
+ rtems_clock_get
+ time
+
+concepts:
+
++ Ensure that special time values lead to the expected result
diff --git a/testsuites/sptests/sp2038/sp2038.scn b/testsuites/sptests/sp2038/sp2038.scn
new file mode 100644
index 0000000000..5849f0a2be
--- /dev/null
+++ b/testsuites/sptests/sp2038/sp2038.scn
@@ -0,0 +1,2 @@
+*** TEST 2038 ***
+*** END OF TEST 2038 ***