From owner-freebsd-testing@FreeBSD.ORG Mon Jan 20 18:40:43 2014 Return-Path: Delivered-To: freebsd-testing@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFC131B7; Mon, 20 Jan 2014 18:40:43 +0000 (UTC) Received: from mail-pd0-x229.google.com (mail-pd0-x229.google.com [IPv6:2607:f8b0:400e:c02::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 74B201DE0; Mon, 20 Jan 2014 18:40:43 +0000 (UTC) Received: by mail-pd0-f169.google.com with SMTP id v10so7224452pde.0 for ; Mon, 20 Jan 2014 10:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:date:message-id:cc:to:mime-version; bh=t4XgPJf7H2W1x8oF2gGYTvXO4j/DVdaqweykQBA+jD4=; b=0Km50/rh0+5g08Bzp4A1CXJ/TkQCpJRjGEiMom3illKQknmB7NRPAxsx5Mo3DJA1P0 15betvnrBbw9z+446vusRdXGYY2zRrM9fKMHPX88x61bn9TOAqWwSqGZvYcGTY+s4aAy D9q0l2LoC1pi7JxTm6FBwbzjiQJsyXsPfqhnBGDGbktmew2JJCrFsYzpNd9r1AJ4jPUR deb9JcWX2Kwd6XLtuv2oiLuoLpT9gETpSBlCR43zp14u/FBOmoQqCG8sbipDVlOC9gux KXQkipGS2/ZOXkQwxUghM0Z1BhPcgr7heUncYC/PIwlTW+e1r6skYDMYtMERAs8TK/Nd 0+bQ== X-Received: by 10.67.23.135 with SMTP id ia7mr19874594pad.5.1390243242375; Mon, 20 Jan 2014 10:40:42 -0800 (PST) Received: from fuji.zcorp.zonarsystems.com ([64.14.143.130]) by mx.google.com with ESMTPSA id jn12sm5194397pbd.37.2014.01.20.10.40.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 10:40:41 -0800 (PST) From: Garrett Cooper Content-Type: multipart/mixed; boundary="Apple-Mail=_AD906FCC-501F-4A0D-9822-A6E8655CA547" Subject: [PATCH] convert bin/date over to ATF Date: Mon, 20 Jan 2014 10:40:38 -0800 Message-Id: <6079AD8F-5EBB-431C-A06B-9B51E2729F5A@gmail.com> To: Julio Merino Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) X-Mailer: Apple Mail (2.1827) Cc: freebsd-testing@FreeBSD.org, Giorgos Keramidas X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jan 2014 18:40:43 -0000 --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 +.include 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 -# -# $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 +# +# $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--