From nobody Thu Aug 07 23:34:42 2025 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 4byk5t6bB4z63g9y; Thu, 07 Aug 2025 23:34: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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4byk5t5Hvpz3PsQ; Thu, 07 Aug 2025 23:34:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754609682; 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=CGMzbnskbaMW6hqctM0oKrHx2J2uOF5A4EUD4igxm3s=; b=DnBGyqYxIQwUa+2yw3KmeAr3Au595p0E8ctNlvwTm7c04wvh+Rnec1CZ7L5CjL3KymMqjS FQQOtaY2WbDsoR+uc2eDfjOotOxk7SULbKptWPwb2CGLeHseCieLWLxivu4Cx0dbEjuIz+ Dt/c77x9is9+91pg29IdjOC0oDXqAVDS+k6Koj41YI7Elb3RUcZ1YMXSJn3jBCgU1pwmR+ 5IgCqkHCn6+zUOAPK9GMBOgZjbiwq5lGwcxy9lU4dkpav8udbH2OhyaT5SirnYqSjmNomY JqT8rTsy0Yz9BJOsRsrs6ENk32biGPu2uTj2LTxWCSCM8fzgV9Z2L/5xlsNQOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754609682; 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=CGMzbnskbaMW6hqctM0oKrHx2J2uOF5A4EUD4igxm3s=; b=Vqf4GKTurSHepNx8mnyf6Yh589VSBexqCKgQfIrt87jSl21dYGbbbFB2y5uwQdkHS1HfTX IrE+9sTG9ors1gqEZooaCy37Y799pu0JVmPb6Rmu3bYtdhM4651J0rUYx3LvOSuOb6yw2X L/JJa/EwrlGBKZbR6ka7Wcuc8yKRYw4AXCgAORTPtT0gJSRYkSrXNLq/7gkei+0l9SdVnk uMnNtdJYFmbXingZ1RjM8/28aEp0sM2jKgI235eVrX7tU3YNTYEal0ia1cymLic1bkZUlk XwsX5V//X6kd1WP+GPaQTXYOQ5v0zlwFFSh8SuXMoob6ERIKKpXCf3H6ma3pag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754609682; a=rsa-sha256; cv=none; b=jvhz2gaVn4gyHIXdpLf4bIh/Oib2W4LLMPzV3gyjZGPXrsmmB6u8qYBE9Y4lMK/jDHz//m RzJJFl7F/mURHzCTnvTUQy/aezdLpMu5C2IDH4TlN+erD2m9iI5Zx2KrcKVW/Ga7SeczY6 CKdm1umo7CCCjwISO+ARfbIhXQcNdVdsqY+62geRmzWsI1LuUSrZ1Hs5S0fYWSRycfWEM7 rbEd54KLx7kdypFDa7h2srwg/tiR9I5udIFDUeSuidM2wuOA7+QP/JU/+GZOioEmRnfeqg I02YNnhAorEB34+x4Fq4/cwC4QfHjq5AEDbaQo54RKNjiP1WJrWmZ239Am5GuQ== 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 4byk5t4Pmfz1QHt; Thu, 07 Aug 2025 23:34:42 +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 577NYgPV060657; Thu, 7 Aug 2025 23:34:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 577NYg8F060654; Thu, 7 Aug 2025 23:34:42 GMT (envelope-from git) Date: Thu, 7 Aug 2025 23:34:42 GMT Message-Id: <202508072334.577NYg8F060654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: 0ecc679fd3da - main - indent: Simplify test script List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 0ecc679fd3da0720d6ba331ebcceca8e0760fa22 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=0ecc679fd3da0720d6ba331ebcceca8e0760fa22 commit 0ecc679fd3da0720d6ba331ebcceca8e0760fa22 Author: Dag-Erling Smørgrav AuthorDate: 2025-08-07 23:33:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2025-08-07 23:33:56 +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 --- 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 }