From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D9C2315810F for ; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 26BC7E094E; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 08EE9E094E for ; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1FA2D335D83 for ; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8E9BFA94 for ; Sat, 10 Jun 2023 04:22:02 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686361722.be49b00f58db2c62e1a908507e80d11a1bc64611.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: be49b00f58db2c62e1a908507e80d11a1bc64611 X-VCS-Branch: master Date: Sat, 10 Jun 2023 04:22:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d05108c2-a140-4003-a2b2-476ffa348d0c X-Archives-Hash: 9c909b32797f0164939bc08aa398f9d0 commit: be49b00f58db2c62e1a908507e80d11a1bc64611 Author: Kerin Millar plushkava net> AuthorDate: Sat Jun 10 01:45:16 2023 +0000 Commit: Sam James gentoo org> CommitDate: Sat Jun 10 01:48:42 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=be49b00f test-functions: Fix non-conforming TAP 14 output Given that there are no subtests, it isn't permissible to duplicate any of the test numbers. Also, the test_update_cursor_coords() function was not correctly conveying the case where the test is skipped. Signed-off-by: Kerin Millar plushkava.net> test-functions | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test-functions b/test-functions index 34dc8b8..5e04c5f 100755 --- a/test-functions +++ b/test-functions @@ -305,23 +305,28 @@ test_is_visible() { } test_update_cursor_coords() { + printf '%d..%d\n' "${tap_i}" "${tap_i}" + skip() { + print 'ok %d # SKIP\n' "${tap_i}" + } if _has_dumb_terminal; then - printf '1..0 # TERM defines the terminal as being dumb\n' + skip elif ! ctty=$(ps -p "$$" -otty= 2>/dev/null) || [ -z "${ctty}" ]; then - printf '1..0 # the ps(1) implementation is defective or non-compliant\n' + # The ps(1) implementation is defective or non-compliant + skip elif [ "${ctty}" = "?" ]; then - printf '1..0 # no controlling terminal is available\n' + # No controlling terminal is available + skip elif [ ! -e /dev/tty ]; then - printf '1..0 # the /dev/tty character device is missing\n' + skip elif ! _update_winsize /dev/tty; then - printf '1..1\n' - printf 'not ok 1 - ecm48-cpr failed\n' + printf 'not ok %d - _update_cursor_coords\n' "${tap_i}" false else - printf '1..1\n' - printf 'ok 1 - ecm48-cpr succeeded (x = %d, y = %d)\n' "${genfun_x}" "${genfun_y}" + printf 'ok %d - _update_cursor_coords (x = %d, y = %d)\n' "${tap_i}" "${genfun_x}" "${genfun_y}" fi } @@ -369,7 +374,7 @@ iterate_tests() { shift total=$(( $# / slice_width )) - printf '1..%d\n' "${total}" + printf '%d..%d\n' "${tap_i}" "$((tap_i + total - 1))" passed=0 i=0 while [ "$((i += 1))" -le "${total}" ]; do @@ -400,8 +405,9 @@ iterate_tests() { else expected=">=$1" fi - printf 'ok %d - %s (expecting %s)\n' "${i}" "${test_description}" "${expected}" + printf 'ok %d - %s (expecting %s)\n' "${tap_i}" "${test_description}" "${expected}" shift "${slice_width}" + tap_i=$((tap_i + 1)) done return "$(( passed < total ))" } @@ -443,6 +449,7 @@ assign_tmpdir export TEST_GENFUNCS=1 export TZ=UTC +tap_i=1 rc=0 test_chdir || rc=1