diff options
Diffstat (limited to 'testsuites/sptests/sp2038')
-rw-r--r-- | testsuites/sptests/sp2038/init.c | 74 | ||||
-rw-r--r-- | testsuites/sptests/sp2038/sp2038.doc | 27 |
2 files changed, 50 insertions, 51 deletions
diff --git a/testsuites/sptests/sp2038/init.c b/testsuites/sptests/sp2038/init.c index dedd66d2c3..89462beb84 100644 --- a/testsuites/sptests/sp2038/init.c +++ b/testsuites/sptests/sp2038/init.c @@ -1,15 +1,28 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* - * Copyright (c) 2011, 2016 embedded brains GmbH. All rights reserved. + * Copyright (C) 2011, 2016 embedded brains GmbH & Co. KG * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifdef HAVE_CONFIG_H @@ -143,13 +156,7 @@ static const uint32_t sample_seconds [] = { 3979434495UL, 4011056895UL, 4042592895UL, - 4074128895UL, - 4105664895UL, - 4137200895UL, - 4168736895UL, - 4200272895UL, - 4231808895UL, - 4263431295UL + 4074128895UL }; static const rtems_time_of_day nearly_problem_2038 = { @@ -179,24 +186,6 @@ static const rtems_time_of_day tod_to_seconds_base = { .second = 15 }; -static const rtems_time_of_day nearly_problem_2106 = { - .year = 2105, - .month = 12, - .day = 31, - .hour = 23, - .minute = 59, - .second = 59 -}; - -static const rtems_time_of_day problem_2106 = { - .year = 2106, - .month = 1, - .day = 1, - .hour = 0, - .minute = 0, - .second = 0 -}; - static const rtems_time_of_day problem_2100 = { .year = 2100, .month = 2, @@ -242,24 +231,15 @@ static void test_tod_to_seconds(void) static void test_problem_year(void) { rtems_status_code sc = RTEMS_SUCCESSFUL; - time_t zero = 0; - time_t one = 1; - time_t maybe_negative = zero - one; bool time_t_is_32_bit = sizeof(time_t) == 4; - bool time_t_is_signed = maybe_negative < zero; 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; - } + nearly_problem = &nearly_problem_2038; + problem = &problem_2038; sc = rtems_clock_set(nearly_problem); ASSERT_SC(sc); @@ -282,7 +262,7 @@ static void test_leap_year(void) const rtems_time_of_day *problem2 = &problem_2100_2; // 2100 is not a leap year, so it should have 28 days test_status = _TOD_Validate(problem, TOD_ENABLE_TICKS_VALIDATION); - rtems_test_assert(test_status == RTEMS_SUCCESSFUL); + rtems_test_assert(test_status == RTEMS_INVALID_CLOCK); test_status = _TOD_Validate(problem2, TOD_ENABLE_TICKS_VALIDATION); rtems_test_assert(test_status == RTEMS_INVALID_CLOCK); } @@ -309,7 +289,7 @@ static void test_every_day(void) rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_time_of_day now; - for (every_day.year = 1988; every_day.year <= 2100; ++every_day.year) { + for (every_day.year = 1988; every_day.year <= 2099; ++every_day.year) { int leap_year = test_year_is_leap_year(every_day.year) ? 1 : 0; for (every_day.month = 1; every_day.month <= 12; ++every_day.month) { int days = days_per_month[leap_year][every_day.month - 1]; diff --git a/testsuites/sptests/sp2038/sp2038.doc b/testsuites/sptests/sp2038/sp2038.doc index db6fa10045..056814a58e 100644 --- a/testsuites/sptests/sp2038/sp2038.doc +++ b/testsuites/sptests/sp2038/sp2038.doc @@ -1,8 +1,27 @@ -# Copyright (c) 2011 embedded brains GmbH. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause + +# Copyright (c) 2011 embedded brains GmbH & Co. KG +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. # -# The license and distribution terms for this file may be -# found in the file LICENSE in this distribution or at -# http://www.rtems.org/license/LICENSE. +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. # This file describes the directives and concepts tested by this test set. |