From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 14849 invoked from network); 7 Apr 2022 12:35:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Apr 2022 12:35:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1649334917; b=RhqdlYC0inxBA+FK2B2wtdCRne0HjvZDa62NPGYFPLitpJMbkk3oLInI4rEYBJ8v06/jHaT1g+ QEAVRgEMOUoIyJWKJwjoC0ahk68viJWoBSlF0tgr7GOAWH5h4o5lvFTUKcI1I8nwsengm3TWMz ikVir8tWxH1pEMI68JUdpD3NcgKUq2axJ+4G8Lm1Gj2qbV2k8a4n6CLem/yVAPQBFbnWqUvgF3 KFKFSiyyJKy0VdXrm7gBX8w0OTRlWJAnwzaIU7jXLTiRsP3rSY1pPWXwx2HyI1dykDyMI6Z9t0 Yqza1vXtZ3p4x+O5LDvFEtzmIHHT4Q/3AYuwfsWzv4ZTkg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1649334917; bh=Z+1HphUcU5eSLqYYpJVgUfZnDW8IxXyASnMNAMIYsTQ=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:To:References:Message-ID:Content-Transfer-Encoding:Date: In-Reply-To:From:Subject:MIME-Version:Content-Type:DKIM-Signature; b=AwhW+LLpvwJIqf7egm7fIGBAxWYMaTVUsyWvgN0lqK/3st7Hqi+ngpWQ2cCHRPe0Tvz4ItFkgr SETiCz03dHPTcHfcU/sValG/uxIwZ2iZqV3wd0jIhQhgKQKFc43+i1xl8uTTJ1Sy3FpZqh3i9A LtkiZGJaHPiV8BfYjtUFrfloZTiKy/d/d8NCqpEa7QPZJ25aIxCRnIeIe/f3bcWe1q+/iVv0Si kinRK7CD6vwjWDrcsm7ySmccDUsDJex/1UJRxbXW6CeTBgPcFJ57xmbP6mpR+G/YmYAtoID1mW mg4Dv0xBn3HkpABSasu8KNnj+UDXhKRV4XFElkrm6rs8Xg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:To:References:Message-Id: Content-Transfer-Encoding:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=kIhYnEi2bloe3HJmw58NxB0ZwGqR3qT1gzOUYe8PRfw=; b=TDFsrt3dDBz74txLqTnWahaXfy +3jKpJllmIM2CBxFVtXR4tU9c3EP3RBwHrgPOZRVRySt3fNzBObXX02nlWdLtTBRXEg5JNeNmmXuF N25XlVaUzVNYWk/yEqyLDwtnUeeB3uuIscbbQt5LpOQaDL9TVtKS7RL0LZpp05sSvx6Ctglv5x3mh kQflePFnDhB7kHbZWsCwjYC6Yn5mBSzrkrOmb34vTQKLNxcLfL9udG7EOW5whwzfcN5qoTQEK/6Xf YuGVBdlj7qmky1TfPTVWLHX9Uir1T3MArYloTU30KZreRjceN0seWb3gYJXZUwNbF8Jf0GcmRa7Ba 7lwhc8Ag==; Received: from authenticated user by zero.zsh.org with local id 1ncRM5-000JGc-Of; Thu, 07 Apr 2022 12:35:17 +0000 Authentication-Results: zsh.org; iprev=pass (snd00007-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.7; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd00007-bg.im.kddi.ne.jp ([27.86.113.7]:16513 helo=dfmta0009.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ncRLl-000Ivc-5M; Thu, 07 Apr 2022 12:34:58 +0000 Received: from mail.biglobe.ne.jp by omta0009.biglobe.ne.jp with ESMTP id <20220407123453416.JTWB.128985.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Thu, 7 Apr 2022 21:34:53 +0900 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: ZTST_continue (was Re: Lots of test failures when --disable-multibyte) From: Jun T X-Priority: 3 In-Reply-To: <728406102.562615.1649252226266@mail2.virginmedia.com> Date: Thu, 7 Apr 2022 21:34:52 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: <58534D69-1D2F-4F0F-B79F-CD272EF6759A@kba.biglobe.ne.jp> References: <1174195730.504727.1649083398497@mail2.virginmedia.com> <42130AB1-3B57-4127-9550-1CF2FF0D5857@kba.biglobe.ne.jp> <728406102.562615.1649252226266@mail2.virginmedia.com> To: zsh-workers@zsh.org X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 50013 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: This is for taking care of the return value of ZTST_prep. ZTST_prep is modified so that if ZTST_unimplemented is set in any chunk then the remaining chunks of %prep are skipped. P01privileged.ztst is split into several chunks, and returns 0 when it sets ZTST_unimplemented. diff --git a/Test/P01privileged.ztst b/Test/P01privileged.ztst index 7c4a1be35..5d45c1a4c 100644 --- a/Test/P01privileged.ztst +++ b/Test/P01privileged.ztst @@ -26,23 +26,23 @@ =20 %prep =20 - # Mind your empty lines here. The logic in this %prep section is = somewhat - # complex compared to most others; to avoid lots of nested/duplicated - # conditions we need to make sure that this all gets executed as a = single - # function from which we can return early + # If ZTST_unimplemented is set to non-null in a chunk then all the + # remaining chunks (and all of %test and %clean sections) will be = skipped. [[ $EUID =3D=3D 0 || -n = $ZSH_TEST_UNPRIVILEGED_UID$ZSH_TEST_UNPRIVILEGED_GID ]] || { ZTST_unimplemented=3D'PRIVILEGED tests require super-user = privileges (or env var)' - return 1 + return 0 } + (( $+commands[perl] )) || { # @todo Eliminate this dependency with a = C wrapper? ZTST_unimplemented=3D'PRIVILEGED tests require Perl' - return 1 + return 0 } + grep -qE '#define HAVE_SETRES?UID' $ZTST_testdir/../config.h || { ZTST_unimplemented=3D'PRIVILEGED tests require = setreuid()/setresuid()' - return 1 + return 0 } - # + ruid=3D euid=3D rgid=3D egid=3D # if [[ -n $ZSH_TEST_UNPRIVILEGED_UID ]]; then @@ -76,13 +76,14 @@ # [[ -n $ruid && -n $euid ]] || { ZTST_unimplemented=3D'PRIVILEGED tests require unprivileged = UID:EUID' - return 1 + return 0 } + [[ -n $rgid || -n $egid ]] || { ZTST_unimplemented=3D'PRIVILEGED tests require unprivileged = GID:EGID' - return 1 + return 0 } - # + print -ru$ZTST_fd \ "Using unprivileged UID $ruid, EUID $euid, GID $rgid, EGID $egid" # diff --git a/Test/ztst.zsh b/Test/ztst.zsh index cdc84b160..190deecfd 100755 --- a/Test/ztst.zsh +++ b/Test/ztst.zsh @@ -299,16 +299,18 @@ ZTST_execchunk() { } =20 # Functions for preparation and cleaning. -# When cleaning up (non-zero string argument), we ignore status. -ZTST_prepclean() { - # Execute indented code chunks. - while ZTST_getchunk; do - ZTST_execchunk >/dev/null || [[ -n $1 ]] || { - [[ -n "$ZTST_unimplemented" ]] || +ZTST_prep ZTST_clean () { + # Execute indented code chunks. If ZTST_unimplemented is set + # in any chunk then we will skip the remaining chunks. + # We ignore return status of chunks when cleaning up. + while [[ -z "$ZTST_unimplemented" ]] && ZTST_getchunk; do + ZTST_execchunk >/dev/null || [[ $0 =3D ZTST_clean ]] || { ZTST_testfailed "non-zero status from preparation code: -$ZTST_code" && return 0 +$ZTST_code" + return 1 } done + return 0 } =20 # diff wrapper @@ -577,27 +579,29 @@ while [[ -z "$ZTST_unimplemented" ]] && = ZTST_getsect $ZTST_skipok; do (prep) if (( ${ZTST_sects[prep]} + ${ZTST_sects[test]} + \ ${ZTST_sects[clean]} )); then ZTST_testfailed "\`prep' section must come first" - exit 1 + break # skip %test and %clean sections, but run = ZTST_cleanup fi - ZTST_prepclean + ZTST_prep || ZTST_skipok=3D1 ZTST_sects[prep]=3D1 ;; (test) if (( ${ZTST_sects[test]} + ${ZTST_sects[clean]} )); then ZTST_testfailed "bad placement of \`test' section" - exit 1 + break # skip %clean section, but run ZTST_cleanup fi - # careful here: we can't execute ZTST_test before || or && - # because that affects the behaviour of traps in the tests. - ZTST_test - (( $? )) && ZTST_skipok=3D1 + if [[ -z "$ZTST_skipok" ]]; then # if no error in %prep + # careful here: we can't execute ZTST_test before || or && + # because that affects the behaviour of traps in the tests. + ZTST_test + (( $? )) && ZTST_skipok=3D1 + fi ZTST_sects[test]=3D1 ;; (clean) if (( ${ZTST_sects[test]} =3D=3D 0 || ${ZTST_sects[clean]} = )); then ZTST_testfailed "bad use of \`clean' section" else - ZTST_prepclean 1 + ZTST_clean ZTST_sects[clean]=3D1 fi ZTST_skipok=3D