From nobody Fri Oct 09 15:12:42 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j1Vj62sPCz6vbwM for ; Fri, 09 Oct 2026 15:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j1Vj62BYqz4Ty7 for ; Fri, 09 Oct 2026 15:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791558762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nl+pQcnHcuDLNMbH1uJcCOWp+N2ah0RIBEF6N6fcqqY=; b=C/R7CSPv3tfU9ZicsWe7poFf1324BBv1E2UvDMF3crUdOVjrFQotMLr6925ICt1aQDq+7N +yhVf4RDI6GJt8FQ1Cj11V/YObPaPwtobX58P3AK6b0Z3VTFY7XfDm7eHXydnKgEoWisMx ojbDx7f+AoL4Qp3iRNoJfQRns0kIljd1W3hxDRZCvVBTbyDZt7BAEBPv2qdyqJQs8cKPBz 3qQFQ0vhrpJ2JH5kBjR9oKPMwOq0OM/dYfZAqJj0IC2iACDdjB4R+LfBU3M/1PyGnIHN9/ hSU6AcOrOP/Kw7AT/W91PegHf/anyjHLMI3gbjz4m9RLd7wGz0/mlaZKNKNIMg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791558762; b=SmJR0R3lz2kR3XA/vJWnn3YBYcC7UPsIP8LBxyj+iSb11HhhSgDGaYf+rRpvbtW98sXPG8 mw+46uB9ZyC9JCban70rZG5QctszvLX2VZNitx3CKHr/sHU1x5Dng7WSLQAetlddxYujQ8 jTgDrcefpBonhd669PHMS4H/OtHNrnJs5nVUPH2w6oWexkFKzZ25XHEGIXc8W1YA/45Chq JY7OPtpCQlsnqIRpwbJASUCkDPJ9tJIaapx0unmosCae0H9/PRh6khQZDFjuNIgw3bKudW g0+KDu+j6rA3EXk1EhSwYtsltxtKIQEFshO/yr+Umc7XJTm7D9wumwc2hFVW5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791558762; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Nl+pQcnHcuDLNMbH1uJcCOWp+N2ah0RIBEF6N6fcqqY=; b=NaWpaNWsrtDtt+SEO/BpHU/JDEeiz4CfKQ4WPV1CbYeC5eSZfRPN7mhTmP9iKAPFS0Yvpa 92xCaMoG64mkTgGBAgB5UYsMZP6gX3RxGsVnFDIlPGg4pjiiJ7u1QukkQxSPu/RvWKmwwH tVeooq54LkFjyStxi9y5ODyxeKMc17Ult8nBqMO9Aco0zW5nY2zByFObC+OO+yoDaqZieO 1kXjRCbm3dNQKUx7mEZctyWbjDjGohBDwcRMdkPfeVnkCrbJL1XKrM3AqcnyDEhYdeQ3Al FL68L9e5Pg1Zi7kAigoklAf0/cwVEgqrDSQ1WJin5aFwinP3jOCsbLOzGcwSHw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j1Vj61CkPzFbs for ; Fri, 09 Oct 2026 15:12:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3aeb5 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 09 Oct 2026 15:12:42 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 570d050f4e18 - main - ncal: convert legacy TAP tests to ATF List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 570d050f4e182ea2cd6c26a996b69fde6049ac4f Auto-Submitted: auto-generated Date: Fri, 09 Oct 2026 15:12:42 +0000 Message-Id: <6ac9046a.3aeb5.2167016d@gitrepo.freebsd.org> The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=570d050f4e182ea2cd6c26a996b69fde6049ac4f commit 570d050f4e182ea2cd6c26a996b69fde6049ac4f Author: Alan Somers AuthorDate: 2026-10-08 19:19:54 +0000 Commit: Alan Somers CommitDate: 2026-10-09 15:11:04 +0000 ncal: convert legacy TAP tests to ATF MFC after: 2 weeks Sponsored by: ConnectWise Pull Request: https://github.com/freebsd/freebsd-src/pull/2465 Reviewed by: imp --- ObsoleteFiles.inc | 4 ++ usr.bin/ncal/tests/Makefile | 3 +- usr.bin/ncal/tests/legacy_test.sh | 5 -- usr.bin/ncal/tests/ncal_test.sh | 148 ++++++++++++++++++++++++++++++++++++++ usr.bin/ncal/tests/regress.sh | 79 -------------------- 5 files changed, 153 insertions(+), 86 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 93a31ad8e6ac..0f6ebd3c8e78 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -51,6 +51,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20261008: replaced with ATF test +OLD_FILES+=usr/tests/usr.bin/ncal/legacy_test +OLD_FILES+=usr/tests/usr.bin/ncal/regress.sh + # 20260930: apm(8) only displays ACPI status OLD_FILES+=etc/rc.d/apm diff --git a/usr.bin/ncal/tests/Makefile b/usr.bin/ncal/tests/Makefile index 96b9751c43e1..c270e28b12f2 100644 --- a/usr.bin/ncal/tests/Makefile +++ b/usr.bin/ncal/tests/Makefile @@ -1,6 +1,6 @@ PACKAGE= tests -TAP_TESTS_SH= legacy_test +ATF_TESTS_SH= ncal_test ${PACKAGE}FILES+= regress.b-3m200901-jd-nhl.out ${PACKAGE}FILES+= regress.b-3m200901-md-nhl.out @@ -91,6 +91,5 @@ ${PACKAGE}FILES+= regress.s-r-B-nhl.out ${PACKAGE}FILES+= regress.s-r-gmgy-nhl.out ${PACKAGE}FILES+= regress.s-r-m-nhl.out ${PACKAGE}FILES+= regress.s-r-mgy-nhl.out -${PACKAGE}FILES+= regress.sh .include diff --git a/usr.bin/ncal/tests/legacy_test.sh b/usr.bin/ncal/tests/legacy_test.sh deleted file mode 100644 index 3c7842d07bf0..000000000000 --- a/usr.bin/ncal/tests/legacy_test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -SRCDIR="$(dirname "${0}")"; export SRCDIR - -m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/regress.sh" | sh diff --git a/usr.bin/ncal/tests/ncal_test.sh b/usr.bin/ncal/tests/ncal_test.sh new file mode 100644 index 000000000000..51bc99a888cc --- /dev/null +++ b/usr.bin/ncal/tests/ncal_test.sh @@ -0,0 +1,148 @@ +# +# SPDX-License-Identifier: BSD-2-Clause +# + +export LC_ALL=C + +ncal_out() +{ + local name="$1" + shift + + atf_check -s exit:0 \ + -o "file:$(atf_get_srcdir)/regress.${name}.out" -e empty \ + ncal "$@" +} + +ncal_err() +{ + local name="$1" + shift + + atf_check -s exit:64 \ + -o empty -e "file:$(atf_get_srcdir)/regress.${name}.out" \ + ncal "$@" +} + +atf_test_case year_md +year_md_head() +{ + atf_set "descr" "Full-year calendars in month-day format" +} +year_md_body() +{ + local y + + for y in 2008 2009 2010 2011; do + ncal_out "r-y${y}-md-nhl" -N -h "${y}" + ncal_out "b-y${y}-md-nhl" -C -h "${y}" + done +} + +atf_test_case year_jd +year_jd_head() +{ + atf_set "descr" "Full-year calendars in Julian-day format" +} +year_jd_body() +{ + local y + + for y in 2008 2009 2010 2011; do + ncal_out "r-y${y}-jd-nhl" -N -jh "${y}" + ncal_out "b-y${y}-jd-nhl" -C -jh "${y}" + done +} + +atf_test_case three_month_md +three_month_md_head() +{ + atf_set "descr" "Three-month calendars in month-day format" +} +three_month_md_body() +{ + local m + + for m in $(jot -w %02d 12); do + ncal_out "r-3m2009${m}-md-nhl" -N -h3 "${m}" 2009 + ncal_out "b-3m2009${m}-md-nhl" -C -h3 "${m}" 2009 + done +} + +atf_test_case three_month_jd +three_month_jd_head() +{ + atf_set "descr" "Three-month calendars in Julian-day format" +} +three_month_jd_body() +{ + local m + + for m in $(jot -w %02d 12); do + ncal_out "r-3m2009${m}-jd-nhl" -N -jh3 "${m}" 2009 + ncal_out "b-3m2009${m}-jd-nhl" -C -jh3 "${m}" 2009 + done +} + +atf_test_case invalid_args +invalid_args_head() +{ + atf_set "descr" "Unsupported option combinations" +} +invalid_args_body() +{ + ncal_err f-3y-nhl -N -3 -y + ncal_err f-3A-nhl -N -3 -A 3 + ncal_err f-3B-nhl -N -3 -B 3 + ncal_err f-3gy-nhl -N -3 2008 + ncal_err f-3AB-nhl -N -3 -A 3 -B 3 + ncal_err f-mgm-nhl -N -m 3 2 2008 + ncal_err f-ym-nhl -N -y -m 2 + ncal_err f-ygm-nhl -N -y 2 2008 + ncal_err f-yA-nhl -N -y -A 3 + ncal_err f-yB-nhl -N -y -B 3 + ncal_err f-yAB-nhl -N -y -A 3 -B 3 +} + +atf_test_case cal_options +cal_options_head() +{ + atf_set "descr" "cal-mode -3, -A, -B, and -m combinations" +} +cal_options_body() +{ + ncal_out s-b-3-nhl -C -d 2008.03 -3 + ncal_out s-b-A-nhl -C -d 2008.03 -A 1 + ncal_out s-b-B-nhl -C -d 2008.03 -B 1 + ncal_out s-b-AB-nhl -C -d 2008.03 -A 1 -B 1 + ncal_out s-b-m-nhl -C -d 2008.03 -m 1 + ncal_out s-b-mgy-nhl -C -d 2008.03 -m 1 2007 + ncal_out s-b-gmgy-nhl -C -d 2008.03 1 2007 +} + +atf_test_case ncal_options +ncal_options_head() +{ + atf_set "descr" "ncal-mode -3, -A, -B, and -m combinations" +} +ncal_options_body() +{ + ncal_out s-r-3-nhl -N -d 2008.03 -3 + ncal_out s-r-A-nhl -N -d 2008.03 -A 1 + ncal_out s-r-B-nhl -N -d 2008.03 -B 1 + ncal_out s-r-AB-nhl -N -d 2008.03 -A 1 -B 1 + ncal_out s-r-m-nhl -N -d 2008.03 -m 1 + ncal_out s-r-mgy-nhl -N -d 2008.03 -m 1 2007 + ncal_out s-r-gmgy-nhl -N -d 2008.03 1 2007 +} + +atf_init_test_cases() +{ + atf_add_test_case year_md + atf_add_test_case year_jd + atf_add_test_case three_month_md + atf_add_test_case three_month_jd + atf_add_test_case invalid_args + atf_add_test_case cal_options + atf_add_test_case ncal_options +} diff --git a/usr.bin/ncal/tests/regress.sh b/usr.bin/ncal/tests/regress.sh deleted file mode 100644 index cced1f3f1c72..000000000000 --- a/usr.bin/ncal/tests/regress.sh +++ /dev/null @@ -1,79 +0,0 @@ - -CAL_BIN="ncal" -CAL="${CAL_BIN} -C" -NCAL="${CAL_BIN} -N" -YEARS="2008 2009 2010 2011" -ONEYEAR="2009" - -echo 1..89 - -REGRESSION_START($1) - -# -# The first tests are layout tests, to make sure that the output is still the -# same despite varying months. -# - -# Full year calendars - -for y in ${YEARS}; do - # Regular calendar, Month days, No-highlight - REGRESSION_TEST(`r-y${y}-md-nhl', `$NCAL -h ${y}') - # Backwards calendar, Month days, No-highlight - REGRESSION_TEST(`b-y${y}-md-nhl', `$CAL -h ${y}') - # Regular calendar, Julian days, No-highlight - REGRESSION_TEST(`r-y${y}-jd-nhl', `$NCAL -jh ${y}') - # Backwards calendar, Julian days, No-highlight - REGRESSION_TEST(`b-y${y}-jd-nhl', `$CAL -jh ${y}') -done - -# 3 month calendars - -for m in $(jot -w %02d 12); do - # Regular calendar, Month days, No-highlight - REGRESSION_TEST(`r-3m${ONEYEAR}${m}-md-nhl', - `$NCAL -h3 ${m} ${ONEYEAR}') - # Backwards calendar, Month days, No-highlight - REGRESSION_TEST(`b-3m${ONEYEAR}${m}-md-nhl', `$CAL -h3 ${m} ${ONEYEAR}') - # Regular calendar, Julian days, No-highlight - REGRESSION_TEST(`r-3m${ONEYEAR}${m}-jd-nhl', - `$NCAL -jh3 ${m} ${ONEYEAR}') - # Backwards calendar, Julian days, No-highlight - REGRESSION_TEST(`b-3m${ONEYEAR}${m}-jd-nhl', `$CAL -jh3 ${m} ${ONEYEAR}') -done - -# -# The next tests are combinations of the various arguments. -# - -# These should fail -REGRESSION_TEST(`f-3y-nhl', `$NCAL -3 -y 2>&1') -REGRESSION_TEST(`f-3A-nhl', `$NCAL -3 -A 3 2>&1') -REGRESSION_TEST(`f-3B-nhl', `$NCAL -3 -B 3 2>&1') -REGRESSION_TEST(`f-3gy-nhl', `$NCAL -3 2008 2>&1') -REGRESSION_TEST(`f-3AB-nhl', `$NCAL -3 -A 3 -B 3 2>&1') -REGRESSION_TEST(`f-mgm-nhl', `$NCAL -m 3 2 2008 2>&1') -REGRESSION_TEST(`f-ym-nhl', `$NCAL -y -m 2 2>&1') -REGRESSION_TEST(`f-ygm-nhl', `$NCAL -y 2 2008 2>&1') -REGRESSION_TEST(`f-yA-nhl', `$NCAL -y -A 3 2>&1') -REGRESSION_TEST(`f-yB-nhl', `$NCAL -y -B 3 2>&1') -REGRESSION_TEST(`f-yAB-nhl', `$NCAL -y -A 3 -B 3 2>&1') - -# These should be successful - -REGRESSION_TEST(`s-b-3-nhl', `$CAL -d 2008.03 -3') -REGRESSION_TEST(`s-b-A-nhl', `$CAL -d 2008.03 -A 1') -REGRESSION_TEST(`s-b-B-nhl', `$CAL -d 2008.03 -B 1') -REGRESSION_TEST(`s-b-AB-nhl', `$CAL -d 2008.03 -A 1 -B 1') -REGRESSION_TEST(`s-b-m-nhl', `$CAL -d 2008.03 -m 1') -REGRESSION_TEST(`s-b-mgy-nhl', `$CAL -d 2008.03 -m 1 2007') -REGRESSION_TEST(`s-b-gmgy-nhl', `$CAL -d 2008.03 1 2007') -REGRESSION_TEST(`s-r-3-nhl', `$NCAL -d 2008.03 -3') -REGRESSION_TEST(`s-r-A-nhl', `$NCAL -d 2008.03 -A 1') -REGRESSION_TEST(`s-r-B-nhl', `$NCAL -d 2008.03 -B 1') -REGRESSION_TEST(`s-r-AB-nhl', `$NCAL -d 2008.03 -A 1 -B 1') -REGRESSION_TEST(`s-r-m-nhl', `$NCAL -d 2008.03 -m 1') -REGRESSION_TEST(`s-r-mgy-nhl', `$NCAL -d 2008.03 -m 1 2007') -REGRESSION_TEST(`s-r-gmgy-nhl', `$NCAL -d 2008.03 1 2007') - -REGRESSION_END()