From nobody Thu Aug 14 16:03:16 2025 X-Original-To: dev-commits-src-branches@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 4c2qln1YWCz64fhC; Thu, 14 Aug 2025 16:03:17 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c2qlm5tpcz3K3r; Thu, 14 Aug 2025 16:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; 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=sp2hdLWymnd785uLfGoJVKzUcFNqREkxL2rXnIN4n94=; b=RTc3uBu9+gbd/isjWDqdCyKkSBTXOvWHgVwfKPRq4c7vdwdQRWxdYJcGK+EUaMBy8dhSnA li+zcESa53pOjZztFHKaZ+uSnFoT0/QeLJ0hP0L3N2EyYaWcPfjbsGMdqBTqbzdZCx11EI tkhsltwkTFI6Hnumf0WMDoYsPmkkqzOdDMDJYc+ywMBTH6EIHhAx+3pGbDI7TNKAy7p+mP nhAeU28mtqEiK8G1+yqvgVoQHb4WzvMPqG5Aunwu8L1N4UOuItDdcRG5keysHOCzA+f/yx vF4TNnh2oeoReoc5c7Q2wSXvtpSg5+Po4uVy+9fcUrAkl3FoIx24930o1Okxgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1755187396; 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=sp2hdLWymnd785uLfGoJVKzUcFNqREkxL2rXnIN4n94=; b=g4Ptnom6xxjVO00R3x908AdnN0SJpVhKv4yrh3nZ9x9oxTdtZ29uJ5S9IiwPeeFrCYdg9C +Tm7pPEwI5BdKtFJw8mj3WhCGwp+EAszxL44NvrFJoEW4Fkqu8ex0KdAS91rMJnBuit1rK O+Uncr6OLib6E1NN1BR/qUA/j02X5YPSVSsbES/6o6vzMtKV9SKy0A8hLjdHqur0ksrQk5 vtQG4DObnQN1Z+QXo24RqLtn5nvTVjtMbcwxN3G/sSR0NvmJhVWPNpAoKtBYt74VLsNOEY GL7lpeiU4qEIykNPNDzaghi/hiS2U1o2uxIZ7JVvtJ57gsOwVwaIBPp5Ioywdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1755187396; a=rsa-sha256; cv=none; b=QwUm9DRMgYtDCGwj5bhTC0VjPOowutXjrNIEgCYt3yt2lMlqEP+lJBxfhSTNqdgKmBtHQa T752JztobpaTYbmcnutHS9FA9VZVR5OHDb7NnJHeihBw8Joz8hgduQfgmWB566xzPVkX/2 55oD79lEX0Dod3J5T+h/uD7jamql2T8h9GfquY7PFgBESetTYaS7p52eif+aRCVv9CSiVC 0SYovgcmItl9JCRpAAGeblHgCIC1MHEyrFj/+IOmoglM6cKi4zL7ghndEakocMX+pHdDh1 KbLLCw3i+Kx222NXTZ/3NS4X8YQiJcJ3s4wiSzsNyF0sc4AD52I1lgmFgSfYHQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4c2qlm4VlTz10Tk; Thu, 14 Aug 2025 16:03:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 57EG3GPC080096; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57EG3GV8080093; Thu, 14 Aug 2025 16:03:16 GMT (envelope-from git) Date: Thu, 14 Aug 2025 16:03:16 GMT Message-Id: <202508141603.57EG3GV8080093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 831799f6d3a9 - stable/13 - indent: Simplify test script List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 831799f6d3a981ee44fabf1c4a89eb78706c1bd4 Auto-Submitted: auto-generated The branch stable/13 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=831799f6d3a981ee44fabf1c4a89eb78706c1bd4 commit 831799f6d3a981ee44fabf1c4a89eb78706c1bd4 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:33:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-14 14:00:06 +0000 indent: Simplify test script Much of the test script was concerned with working around RCS tags and dealing with cases which don't apply to indent. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51795 (cherry picked from commit 0ecc679fd3da0720d6ba331ebcceca8e0760fa22) --- usr.bin/indent/tests/functional_test.sh | 55 +++++++++------------------------ 1 file changed, 15 insertions(+), 40 deletions(-) diff --git a/usr.bin/indent/tests/functional_test.sh b/usr.bin/indent/tests/functional_test.sh index 44538e5b6e12..3f4431038234 100755 --- a/usr.bin/indent/tests/functional_test.sh +++ b/usr.bin/indent/tests/functional_test.sh @@ -1,3 +1,5 @@ +#- +# SPDX-License-Identifier: BSD-2-Clause # # Copyright 2016 Dell EMC # All rights reserved. @@ -29,61 +31,34 @@ SRCDIR=$(atf_get_srcdir) check() { - local tc=${1}; shift - - local indent=$(atf_config_get usr.bin.indent.test_indent /usr/bin/indent) - - # All of the files need to be in the ATF sandbox in order for the tests - # to pass. - atf_check cp ${SRCDIR}/${tc}* . + local tc=${1} + local profile_flag - # Remove $FreeBSD$ RCS expansions because they get re-indented, which - # changes the output - local out_file="${tc}.stdout" - if [ -f "${out_file}" ]; then - parsed_file=output_file.parsed + cp "${SRCDIR}/${tc%.[0-9]}".* . - atf_check -o save:$parsed_file sed -e '/\$FreeBSD.*\$/d' \ - ${tc}.stdout - out_flag="-o file:$parsed_file" - fi - local profile_file="${tc}.pro" - if [ -f "${profile_file}" ]; then - profile_flag="-P${profile_file}" + if [ -f "${tc}.pro" ]; then + profile_flag="-P${tc}.pro" else # Make sure we don't implicitly use ~/.indent.pro from the test # host, for determinism purposes. profile_flag="-npro" fi - sed -e '/\$FreeBSD.*\$/d' ${tc} > input_file.parsed - atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed + atf_check -s exit:${tc##*.} -o file:"${tc}.stdout" \ + indent ${profile_flag} < "${tc}" } -add_testcase() +add_legacy_testcase() { local tc=${1} - local tc_escaped word - - case "${tc%.*}" in - *-*) - local IFS="-" - for word in ${tc%.*}; do - tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" - done - ;; - *) - tc_escaped=${tc%.*} - ;; - esac - atf_test_case ${tc_escaped} - eval "${tc_escaped}_body() { check ${tc}; }" - atf_add_test_case ${tc_escaped} + atf_test_case ${tc%.[0-9]} + eval "${tc%.[0-9]}_body() { check ${tc}; }" + atf_add_test_case ${tc%.[0-9]} } atf_init_test_cases() { - for path in $(find -Es "${SRCDIR}" -regex '.*\.[0-9]+$'); do - add_testcase ${path##*/} + for tc in $(find -s "${SRCDIR}" -name '*.[0-9]'); do + add_legacy_testcase "${tc##*/}" done }