Module Name:    src
Committed By:   kre
Date:           Fri Oct 30 22:03:36 UTC 2020

Modified Files:
        src/tests/bin/date: t_date.sh

Log Message:
Update the test a little so that is possible to pass
(if date fails, because of bad or out of range input
to parsedate, it cannot be expected to output the
expected result).

Remove the atf-expect-fail now that parsedate() should
detect overflows, and fail, causing date to fail, rather
than simply producing bogus results.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 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/tests/bin/date/t_date.sh
diff -u src/tests/bin/date/t_date.sh:1.1 src/tests/bin/date/t_date.sh:1.2
--- src/tests/bin/date/t_date.sh:1.1	Fri Jul  3 03:59:18 2020
+++ src/tests/bin/date/t_date.sh	Fri Oct 30 22:03:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_date.sh,v 1.1 2020/07/03 03:59:18 jruoho Exp $
+# $NetBSD: t_date.sh,v 1.2 2020/10/30 22:03:35 kre Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -34,7 +34,7 @@ overflow_head() {
 
 overflow_body() {
 
-	atf_expect_fail "PR lib/46542"
+	## atf_expect_fail "PR lib/46542"	# no longer true
 
 	years="1 10 100 1000 10000 100000 1000000 10000000 \
 	      100000000 1000000000 10000000000 100000000000"
@@ -42,10 +42,10 @@ overflow_body() {
 	for year in $years; do
 
 		y=$(date +%Y)
-		yy=$(expr $y + $year)
-		yyy=$(date -d "$year years" +%Y)
+		yy=$((y + year))
+		yyy=$(date -d "$year years" +%Y) || continue
 
-		if [ ! $yy -eq $yyy ]; then
+		if [ "$yy" -ne "$yyy" ]; then
 			atf_fail "$yy vs. $yyy"
 		fi
 	done

Reply via email to