From owner-dev-commits-src-main@freebsd.org Thu May 13 13:35:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 494A7640CE1; Thu, 13 May 2021 13:35:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fgt2J0ZfCz4v9g; Thu, 13 May 2021 13:35:20 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 E7D7F1FC07; Thu, 13 May 2021 13:35:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 14DDZJ7S067390; Thu, 13 May 2021 13:35:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 14DDZJcY067389; Thu, 13 May 2021 13:35:19 GMT (envelope-from git) Date: Thu, 13 May 2021 13:35:19 GMT Message-Id: <202105131335.14DDZJcY067389@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: f9e565abca9b - main - sort: Make NetBSD sort tests compatible with our sort MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9e565abca9b5880fe3203ba67c90eaf3e906e95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 May 2021 13:35:20 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f9e565abca9b5880fe3203ba67c90eaf3e906e95 commit f9e565abca9b5880fe3203ba67c90eaf3e906e95 Author: Cyril Zhang AuthorDate: 2021-05-13 12:50:23 +0000 Commit: Mark Johnston CommitDate: 2021-05-13 13:33:47 +0000 sort: Make NetBSD sort tests compatible with our sort This diff primarily adds/removes flags to make the tests compatible with sort. Two tests are removed. One test is changed to expect fail due to a bug. Reviewed by: markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30217 --- contrib/netbsd-tests/usr.bin/sort/t_sort.sh | 57 ++++++++++++++++++----------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh index a36457cb41ec..431d23b69f96 100755 --- a/contrib/netbsd-tests/usr.bin/sort/t_sort.sh +++ b/contrib/netbsd-tests/usr.bin/sort/t_sort.sh @@ -25,6 +25,13 @@ # POSSIBILITY OF SUCH DAMAGE. # +# The -S flag in NetBSD sort enables non-stable sorting order. This flag +# doesn't exist in FreeBSD sort, and instead indicates buffer size, so all +# instances of this flag should be removed. +# +# For tests that expect exact output, but where some lines may compare +# the same, the flag -s should be added to enforce an expected sorting order. + atf_test_case basic basic_head() { @@ -57,9 +64,9 @@ empty_file_head() empty_file_body() { touch empty - atf_check -o empty sort -S empty - atf_check sort -S -c empty - atf_check sort -S -c -u empty + atf_check -o empty sort empty + atf_check sort -c empty + atf_check sort -c -u empty } atf_test_case end_of_options @@ -70,8 +77,8 @@ end_of_options_head() end_of_options_body() { echo x >-k - atf_check -o file:-k -x "sort -S -- -k in - atf_check -o inline:'\0a\n\0b\n' sort -S in + atf_check -o inline:'\0a\n\0b\n' sort in } atf_test_case long_records @@ -126,7 +133,7 @@ long_file_head() long_file_body() { awk 'BEGIN { for(i=0; i<20000; i++) print rand() }' >in - sort -S -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out + sort -r in | awk '$0 "x" != x { print ; x = $0 "x" }' >out atf_check -o file:out sort -u -r in } @@ -155,6 +162,7 @@ bflag_head() } bflag_body() { + atf_expect_fail "Behavior differs from NetBSD" cat >in <xx" + atf_check -x "sort -k2b -k2 in >xx" atf_check -e ignore sort -c -t: -k2n xx - atf_check -x "sort -S -k2,2.1b -k2 in >xx" + atf_check -x "sort -k2,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k3n xx - atf_check -x "sort -S -k2.3 -k2 in >xx" + atf_check -x "sort -k2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k4n xx - atf_check -x "sort -S -k2b,2.3 -k2 in >xx" + atf_check -x "sort -k2b,2.3 -k2 in >xx" atf_check -e ignore sort -c -t: -k5n xx - atf_check -x "sort -S -k2.3,2.1b -k2 in >xx" + atf_check -x "sort -k2.3,2.1b -k2 in >xx" atf_check -e ignore sort -c -t: -k6n xx - atf_check -x "sort -S -k2,2.1b -k2r in >xx" + atf_check -x "sort -k2,2.1b -k2r in >xx" atf_check -e ignore sort -c -t: -k7n xx - atf_check -x "sort -S -b -k2,2 -k2 in >xx" + atf_check -x "sort -b -k2,2 -k2 in >xx" atf_check -e ignore sort -c -t: -k8n xx # XXX This test is broken. The standard is not clear on the behavior. @@ -442,7 +452,7 @@ c ca EOF - atf_check -o file:out sort -S -m in1 in2 + atf_check -o file:out sort -m in1 in2 } atf_test_case mflag_uflag @@ -585,7 +595,7 @@ oflag_displaced_head() } oflag_displaced_body() { - atf_check sort -S /dev/null -o out + atf_check sort /dev/null -o out test -f out || atf_fail "File not created" } @@ -757,7 +767,7 @@ EOF b c EOF - atf_check -o file:out sort -S -k2 in + atf_check -o file:out sort -k2 in cat >out <./+0 echo 'more contents' >in cat ./+0 in >expout @@ -926,6 +937,8 @@ plus_rflag_invalid_head() } plus_rflag_invalid_body() { + atf_expect_fail "-R flag not available on FreeBSD" + ( echo 'z b m f' echo 'y c o e'