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 (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7EA7F158232 for ; Mon, 9 Dec 2024 18:49:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6BF6AE0974; Mon, 9 Dec 2024 18:49:45 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 59371E09A7 for ; Mon, 9 Dec 2024 18:49:44 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 85794343136 for ; Mon, 9 Dec 2024 18:49:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A32DA188D for ; Mon, 9 Dec 2024 18:49:41 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1733770091.15b4410cd8b6c90b3a614ecde3a5a719b0a8350c.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/tests/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/tests/eapi9-pipestatus.sh X-VCS-Directories: eclass/tests/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 15b4410cd8b6c90b3a614ecde3a5a719b0a8350c X-VCS-Branch: master Date: Mon, 9 Dec 2024 18:49:41 +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: 2a97ea79-2a53-4ca9-9dcd-9042100f8af5 X-Archives-Hash: cf99993a9e928eaf516a8c88cc45ec35 commit: 15b4410cd8b6c90b3a614ecde3a5a719b0a8350c Author: Ulrich Müller gentoo org> AuthorDate: Sun Dec 8 21:59:57 2024 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Mon Dec 9 18:48:11 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15b4410c eclass/tests: New test for eapi9-pipestatus.eclass Signed-off-by: Ulrich Müller gentoo.org> eclass/tests/eapi9-pipestatus.sh | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/eclass/tests/eapi9-pipestatus.sh b/eclass/tests/eapi9-pipestatus.sh new file mode 100755 index 000000000000..6264b63d9440 --- /dev/null +++ b/eclass/tests/eapi9-pipestatus.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +source tests-common.sh || exit + +inherit eapi9-pipestatus + +tps() { + local exp_ret=${1} cmd=${2} + local have_ret + tbegin "${cmd} -> ret: ${exp_ret}" + eval "${cmd}; pipestatus" + have_ret=$? + [[ ${have_ret} -eq ${exp_ret} ]] + tend $? "returned: ${have_ret}" +} + +tpsv() { + local exp_ret=${1} exp_out=${2} cmd=${3} + local have_ret have_out + tbegin "${cmd} -> ret: ${exp_ret}, out: ${exp_out}" + have_out=$(eval "${cmd}; pipestatus -v") + have_ret=$? + [[ ${have_ret} -eq ${exp_ret} && ${have_out} == "${exp_out}" ]] + tend $? "returned: ${have_ret}, output: ${have_out}" +} + +txf() { + local out + tbegin "XFAIL: $*" + out=$("$@" 2>&1) + [[ ${out} == die:* ]] + tend $? "function did not die" +} + +ret() { + return ${1} +} + +tps 0 "true" +tps 1 "false" +tps 0 "true | true" +tps 1 "false | true" +tps 2 "ret 2 | true" +tps 1 "true | false | true" +tps 5 "true | false | ret 5 | true" +tpsv 0 "0 0 0" "true | true | true" +tpsv 1 "1 0" "false | true" +tpsv 2 "3 2 0" "ret 3 | ret 2 | true" + +txf pipestatus bad_arg +txf pipestatus -v extra_arg + +texit