Module Name: src Committed By: jruoho Date: Fri Jul 3 03:59:18 UTC 2020
Modified Files: src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/bin: Makefile Added Files: src/tests/bin/date: Makefile t_date.sh Log Message: Add a check for the overflow noted in PR lib/46542. To generate a diff of this commit: cvs rdiff -u -r1.870 -r1.871 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.171 -r1.172 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.3 -r1.4 src/tests/bin/Makefile cvs rdiff -u -r0 -r1.1 src/tests/bin/date/Makefile \ src/tests/bin/date/t_date.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.870 src/distrib/sets/lists/tests/mi:1.871 --- src/distrib/sets/lists/tests/mi:1.870 Wed Jul 1 13:49:26 2020 +++ src/distrib/sets/lists/tests/mi Fri Jul 3 03:59:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.870 2020/07/01 13:49:26 jruoho Exp $ +# $NetBSD: mi,v 1.871 2020/07/03 03:59:18 jruoho Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -840,6 +840,10 @@ ./usr/tests/bin/cp/Atffile tests-bin-tests compattestfile,atf ./usr/tests/bin/cp/Kyuafile tests-bin-tests compattestfile,atf,kyua ./usr/tests/bin/cp/t_cp tests-bin-tests compattestfile,atf +./usr/tests/bin/date tests-bin-tests compattestfile,atf +./usr/tests/bin/date/Atffile tests-bin-tests compattestfile,atf +./usr/tests/bin/date/Kyuafile tests-bin-tests compattestfile,atf,kyua +./usr/tests/bin/date/t_date tests-bin-tests compattestfile,atf ./usr/tests/bin/dd tests-bin-tests compattestfile,atf ./usr/tests/bin/dd/Atffile tests-bin-tests compattestfile,atf ./usr/tests/bin/dd/Kyuafile tests-bin-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.171 src/etc/mtree/NetBSD.dist.tests:1.172 --- src/etc/mtree/NetBSD.dist.tests:1.171 Tue Jun 30 20:32:11 2020 +++ src/etc/mtree/NetBSD.dist.tests Fri Jul 3 03:59:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.171 2020/06/30 20:32:11 riastradh Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.172 2020/07/03 03:59:18 jruoho Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -186,6 +186,7 @@ ./usr/tests/bin ./usr/tests/bin/cat ./usr/tests/bin/cp +./usr/tests/bin/date ./usr/tests/bin/dd ./usr/tests/bin/df ./usr/tests/bin/expr Index: src/tests/bin/Makefile diff -u src/tests/bin/Makefile:1.3 src/tests/bin/Makefile:1.4 --- src/tests/bin/Makefile:1.3 Fri Mar 30 15:49:24 2012 +++ src/tests/bin/Makefile Fri Jul 3 03:59:18 2020 @@ -1,9 +1,9 @@ -# $NetBSD: Makefile,v 1.3 2012/03/30 15:49:24 njoly Exp $ +# $NetBSD: Makefile,v 1.4 2020/07/03 03:59:18 jruoho Exp $ .include <bsd.own.mk> TESTSDIR= ${TESTSBASE}/bin -TESTS_SUBDIRS= cat cp dd df expr pax ps sh sleep tar +TESTS_SUBDIRS= cat cp date dd df expr pax ps sh sleep tar .include <bsd.test.mk> Added files: Index: src/tests/bin/date/Makefile diff -u /dev/null src/tests/bin/date/Makefile:1.1 --- /dev/null Fri Jul 3 03:59:18 2020 +++ src/tests/bin/date/Makefile Fri Jul 3 03:59:18 2020 @@ -0,0 +1,8 @@ +# $NetBSD: Makefile,v 1.1 2020/07/03 03:59:18 jruoho Exp $ + +.include <bsd.own.mk> + +TESTSDIR= ${TESTSBASE}/bin/date +TESTS_SH= t_date + +.include <bsd.test.mk> Index: src/tests/bin/date/t_date.sh diff -u /dev/null src/tests/bin/date/t_date.sh:1.1 --- /dev/null Fri Jul 3 03:59:18 2020 +++ src/tests/bin/date/t_date.sh Fri Jul 3 03:59:18 2020 @@ -0,0 +1,56 @@ +# $NetBSD: t_date.sh,v 1.1 2020/07/03 03:59:18 jruoho Exp $ +# +# Copyright (c) 2020 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Jukka Ruohonen. +# +# 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. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# +atf_test_case overflow +overflow_head() { + atf_set "descr" "Check that date(1) does not overflow (PR lib/46542)" +} + +overflow_body() { + + atf_expect_fail "PR lib/46542" + + years="1 10 100 1000 10000 100000 1000000 10000000 \ + 100000000 1000000000 10000000000 100000000000" + + for year in $years; do + + y=$(date +%Y) + yy=$(expr $y + $year) + yyy=$(date -d "$year years" +%Y) + + if [ ! $yy -eq $yyy ]; then + atf_fail "$yy vs. $yyy" + fi + done +} + +atf_init_test_cases() { + atf_add_test_case overflow +}