Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Jan 2014 10:40:38 -0800
From:      Garrett Cooper <yaneurabeya@gmail.com>
To:        Julio Merino <julio@meroh.net>
Cc:        freebsd-testing@FreeBSD.org, Giorgos Keramidas <keramida@freebsd.org>
Subject:   [PATCH] convert bin/date over to ATF
Message-ID:  <6079AD8F-5EBB-431C-A06B-9B51E2729F5A@gmail.com>

next in thread | raw e-mail | index | archive | help

--Apple-Mail=_AD906FCC-501F-4A0D-9822-A6E8655CA547
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

	This is based on work done by Giorgos a couple years ago.
Thanks!
-Garrett

# kyua test
regress:A  ->  passed  [0.059s]
regress:a  ->  passed  [0.144s]
regress:B  ->  passed  [0.036s]
regress:b  ->  passed  [0.037s]
regress:C  ->  passed  [0.045s]
regress:c  ->  passed  [0.035s]
regress:D  ->  passed  [0.061s]
regress:d  ->  passed  [0.034s]
regress:e  ->  passed  [0.040s]
regress:F  ->  passed  [0.036s]
regress:G  ->  passed  [0.039s]
regress:g  ->  passed  [0.042s]
regress:H  ->  passed  [0.034s]
regress:h  ->  passed  [0.036s]
regress:I  ->  passed  [0.043s]
regress:j  ->  passed  [0.034s]
regress:k  ->  passed  [0.035s]
regress:l  ->  passed  [0.047s]
regress:M  ->  passed  [0.034s]
regress:m  ->  passed  [0.039s]
regress:p  ->  passed  [0.036s]
regress:R  ->  passed  [0.037s]
regress:r  ->  passed  [0.035s]
regress:S  ->  passed  [0.045s]
regress:s  ->  passed  [0.035s]
regress:U  ->  passed  [0.035s]
regress:u  ->  passed  [0.034s]
regress:V  ->  passed  [0.034s]
regress:v  ->  passed  [0.035s]
regress:W  ->  passed  [0.051s]
regress:w  ->  passed  [0.038s]
regress:X  ->  passed  [0.043s]
regress:x  ->  passed  [0.041s]
regress:Y  ->  passed  [0.045s]
regress:y  ->  passed  [0.044s]
regress:Z  ->  passed  [0.036s]
regress:z  ->  passed  [0.035s]
regress:pct  ->  passed  [0.036s]
regress:plus  ->  passed  [0.036s]

39/39 passed (0 failed)
Committed action 28
--Apple-Mail=_AD906FCC-501F-4A0D-9822-A6E8655CA547
Content-Disposition: attachment;
	filename=convert-bin-date-over-to-atf.patch
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="convert-bin-date-over-to-atf.patch"
Content-Transfer-Encoding: 7bit

diff --git a/bin/date/tests/Makefile b/bin/date/tests/Makefile
index 540008b..459d019 100644
--- a/bin/date/tests/Makefile
+++ b/bin/date/tests/Makefile
@@ -4,6 +4,6 @@
 
 TESTSDIR=	${TESTSBASE}/bin/date
 
-TAP_TESTS_SH=	legacy_test
+ATF_TESTS_SH=	regress
 
-.include <tap.test.mk>
+.include <atf.test.mk>
diff --git a/bin/date/tests/legacy_test.sh b/bin/date/tests/legacy_test.sh
deleted file mode 100644
index 981bdd0..0000000
--- a/bin/date/tests/legacy_test.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-
-#
-# Regression tests for date(1)
-#
-# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
-#
-# $FreeBSD$
-#
-
-#
-# These two date/times have been chosen carefully, they
-# create both the single digit and double/multidigit version of
-# the values.
-#
-# To create a new one, make sure you are using the UTC timezone!
-#
-
-TEST1=3222243		# 1970-02-07 07:04:03
-TEST2=1005600000	# 2001-11-12 21:11:12
-
-export LC_ALL=C
-export TZ=UTC
-count=0
-
-check()
-{
-	S=$1
-	A1=$2
-	A2=$3
-
-	count=`expr ${count} + 1`
-
-	if [ -z "${A2}" ]; then A2=${A1}; fi
-
-	R=`date -r ${TEST1} +%${S}`
-	if [ "${R}" = "${A1}" ]; then
-		echo "ok ${S}{t1}"
-	else
-		echo "no ok ${S}{t1} - (got ${R}, expected ${A1})"
-	fi
-
-	R=`date -r ${TEST2} +%${S}`
-	if [ "${R}" = "${A2}" ]; then
-		echo "ok ${S}{t2}"
-	else
-		echo "no ok ${S}{t2} - (got ${R}, expected ${A2})"
-	fi
-}
-
-echo "1..78"
-
-check A Saturday Monday
-check a Sat Mon
-check B February November
-check b Feb Nov
-check C 19 20
-check c "Sat Feb  7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
-check D 02/07/70 11/12/01
-check d 07 12
-check e " 7" 12
-check F "1970-02-07" "2001-11-12"
-check G 1970 2001
-check g 70 01
-check H 07 21
-check h Feb Nov
-check I 07 09
-check j 038 316
-check k " 7" 21
-check l " 7" " 9"
-check M 04 20
-check m 02 11
-check p AM PM
-check R 07:04 21:20
-check r "07:04:03 AM" "09:20:00 PM"
-check S 03 00
-check s ${TEST1} ${TEST2}
-check U 05 45
-check u 6 1
-check V 06 46
-check v " 7-Feb-1970" "12-Nov-2001"
-check W 05 46
-check w 6 1
-check X "07:04:03" "21:20:00"
-check x "02/07/70" "11/12/01"
-check Y 1970 2001
-check y 70 01
-check Z UTC UTC
-check z +0000 +0000
-check % % %
-check + "Sat Feb  7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
diff --git a/bin/date/tests/regress.sh b/bin/date/tests/regress.sh
new file mode 100644
index 0000000..f5f72a6
--- /dev/null
+++ b/bin/date/tests/regress.sh
@@ -0,0 +1,557 @@
+#!/bin/sh
+
+#
+# Regression tests for date(1)
+#
+# Submitted by Edwin Groothuis <edwin@FreeBSD.org>
+#
+# $FreeBSD: src/tools/regression/bin/date/regress.sh,v 1.4 2011/01/09 22:05:09 keramida Exp $
+#
+
+#
+# These two date/times have been chosen carefully, they
+# create both the single digit and double/multidigit version of
+# the values.
+#
+# To create a new one, make sure you are using the UTC timezone!
+#
+
+TEST1=3222243		# 1970-02-07 07:04:03
+TEST2=1005600000	# 2001-11-12 21:11:12
+
+export LC_ALL=C
+export TZ=UTC
+
+check()
+{
+	S=$1
+	A1=$2
+	A2=$3
+
+	# If the second sample text for formatted output has not been
+	# passed, assume it should match exactly the first one.
+	if [ -z "${A2}" ]; then
+		A2=${A1}
+	fi
+
+	R=`date -r ${TEST1} +%${S}`
+	atf_check test "${R}" = "${A1}"
+
+	R=`date -r ${TEST2} +%${S}`
+	atf_check test "${R}" = "${A2}"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case A
+A_head()
+{
+	atf_set "descr" "Verifies that 'A' formatting spec works"
+}
+A_body()
+{
+	check A Saturday Monday
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case a
+a_head()
+{
+	atf_set "descr" "Verifies that 'a' formatting spec works"
+}
+a_body()
+{
+	check a Sat Mon
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case B
+B_head()
+{
+	atf_set "descr" "Verifies that 'B' formatting spec works"
+}
+B_body()
+{
+	check B February November
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case b
+b_head()
+{
+	atf_set "descr" "Verifies that 'b' formatting spec works"
+}
+b_body()
+{
+	check b Feb Nov
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case C
+C_head()
+{
+	atf_set "descr" "Verifies that 'C' formatting spec works"
+}
+C_body()
+{
+	check C 19 20
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case c
+c_head()
+{
+	atf_set "descr" "Verifies that 'c' formatting spec works"
+}
+c_body()
+{
+	check c "Sat Feb  7 07:04:03 1970" "Mon Nov 12 21:20:00 2001"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case D
+D_head()
+{
+	atf_set "descr" "Verifies that 'D' formatting spec works"
+}
+D_body()
+{
+	check D 02/07/70 11/12/01
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case d
+d_head()
+{
+	atf_set "descr" "Verifies that 'd' formatting spec works"
+}
+d_body()
+{
+	check d 07 12
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case e
+e_head()
+{
+	atf_set "descr" "Verifies that 'e' formatting spec works"
+}
+e_body()
+{
+	check e " 7" 12
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case F
+F_head()
+{
+	atf_set "descr" "Verifies that 'F' formatting spec works"
+}
+F_body()
+{
+	check F "1970-02-07" "2001-11-12"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case G
+G_head()
+{
+	atf_set "descr" "Verifies that 'G' formatting spec works"
+}
+G_body()
+{
+	check G 1970 2001
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case g
+g_head()
+{
+	atf_set "descr" "Verifies that 'g' formatting spec works"
+}
+g_body()
+{
+	check g 70 01
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case H
+H_head()
+{
+	atf_set "descr" "Verifies that 'H' formatting spec works"
+}
+H_body()
+{
+	check H 07 21
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case h
+h_head()
+{
+	atf_set "descr" "Verifies that 'h' formatting spec works"
+}
+h_body()
+{
+	check h Feb Nov
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case I
+I_head()
+{
+	atf_set "descr" "Verifies that 'I' formatting spec works"
+}
+I_body()
+{
+	check I 07 09
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case j
+j_head()
+{
+	atf_set "descr" "Verifies that 'j' formatting spec works"
+}
+j_body()
+{
+	check j 038 316
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case k
+k_head()
+{
+	atf_set "descr" "Verifies that 'k' formatting spec works"
+}
+k_body()
+{
+	check k " 7" 21
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case l
+l_head()
+{
+	atf_set "descr" "Verifies that 'l' formatting spec works"
+}
+l_body()
+{
+	check l " 7" " 9"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case M
+M_head()
+{
+	atf_set "descr" "Verifies that 'M' formatting spec works"
+}
+M_body()
+{
+	check M 04 20
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case m
+m_head()
+{
+	atf_set "descr" "Verifies that 'm' formatting spec works"
+}
+m_body()
+{
+	check m 02 11
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case p
+p_head()
+{
+	atf_set "descr" "Verifies that 'p' formatting spec works"
+}
+p_body()
+{
+	check p AM PM
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case R
+R_head()
+{
+	atf_set "descr" "Verifies that 'R' formatting spec works"
+}
+R_body()
+{
+	check R 07:04 21:20
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case r
+r_head()
+{
+	atf_set "descr" "Verifies that 'r' formatting spec works"
+}
+r_body()
+{
+	check r "07:04:03 AM" "09:20:00 PM"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case S
+S_head()
+{
+	atf_set "descr" "Verifies that 'S' formatting spec works"
+}
+S_body()
+{
+	check S 03 00
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case s
+s_head()
+{
+	atf_set "descr" "Verifies that 's' formatting spec works"
+}
+s_body()
+{
+	check s ${TEST1} ${TEST2}
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case U
+U_head()
+{
+	atf_set "descr" "Verifies that 'U' formatting spec works"
+}
+U_body()
+{
+	check U 05 45
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case u
+u_head()
+{
+	atf_set "descr" "Verifies that 'u' formatting spec works"
+}
+u_body()
+{
+	check u 6 1
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case V
+V_head()
+{
+	atf_set "descr" "Verifies that 'V' formatting spec works"
+}
+V_body()
+{
+	check V 06 46
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case v
+v_head()
+{
+	atf_set "descr" "Verifies that 'v' formatting spec works"
+}
+v_body()
+{
+	check v " 7-Feb-1970" "12-Nov-2001"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case W
+W_head()
+{
+	atf_set "descr" "Verifies that 'W' formatting spec works"
+}
+W_body()
+{
+	check W 05 46
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case w
+w_head()
+{
+	atf_set "descr" "Verifies that 'w' formatting spec works"
+}
+w_body()
+{
+	check w 6 1
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case X
+X_head()
+{
+	atf_set "descr" "Verifies that 'X' formatting spec works"
+}
+X_body()
+{
+	check X "07:04:03" "21:20:00"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case x
+x_head()
+{
+	atf_set "descr" "Verifies that 'x' formatting spec works"
+}
+x_body()
+{
+	check x "02/07/70" "11/12/01"
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case Y
+Y_head()
+{
+	atf_set "descr" "Verifies that 'Y' formatting spec works"
+}
+Y_body()
+{
+	check Y 1970 2001
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case y
+y_head()
+{
+	atf_set "descr" "Verifies that 'y' formatting spec works"
+}
+y_body()
+{
+	check y 70 01
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case Z
+Z_head()
+{
+	atf_set "descr" "Verifies that 'Z' formatting spec works"
+}
+Z_body()
+{
+	check Z UTC UTC
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case z
+z_head()
+{
+	atf_set "descr" "Verifies that 'z' formatting spec works"
+}
+z_body()
+{
+	check z +0000 +0000
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case pct
+pct_head()
+{
+	atf_set "descr" "Verifies that '%' formatting spec works"
+}
+pct_body()
+{
+	check % % %
+}
+
+# ----------------------------------------------------------------------
+
+atf_test_case plus
+plus_head()
+{
+	atf_set "descr" "Verifies that '+' formatting spec works"
+}
+plus_body()
+{
+	check + "Sat Feb  7 07:04:03 UTC 1970" "Mon Nov 12 21:20:00 UTC 2001"
+}
+
+# ----------------------------------------------------------------------
+# Main test case driving script.
+# ----------------------------------------------------------------------
+
+atf_init_test_cases()
+{
+	atf_add_test_case A
+	atf_add_test_case a
+	atf_add_test_case B
+	atf_add_test_case b
+	atf_add_test_case C
+	atf_add_test_case c
+	atf_add_test_case D
+	atf_add_test_case d
+	atf_add_test_case e
+	atf_add_test_case F
+	atf_add_test_case G
+	atf_add_test_case g
+	atf_add_test_case H
+	atf_add_test_case h
+	atf_add_test_case I
+	atf_add_test_case j
+	atf_add_test_case k
+	atf_add_test_case l
+	atf_add_test_case M
+	atf_add_test_case m
+	atf_add_test_case p
+	atf_add_test_case R
+	atf_add_test_case r
+	atf_add_test_case S
+	atf_add_test_case s
+	atf_add_test_case U
+	atf_add_test_case u
+	atf_add_test_case V
+	atf_add_test_case v
+	atf_add_test_case W
+	atf_add_test_case w
+	atf_add_test_case X
+	atf_add_test_case x
+	atf_add_test_case Y
+	atf_add_test_case y
+	atf_add_test_case Z
+	atf_add_test_case z
+	atf_add_test_case pct
+	atf_add_test_case plus
+}

--Apple-Mail=_AD906FCC-501F-4A0D-9822-A6E8655CA547--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6079AD8F-5EBB-431C-A06B-9B51E2729F5A>