From owner-svn-src-all@freebsd.org Wed Oct 9 06:22:53 2019 Return-Path: Delivered-To: svn-src-all@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 B9E451423BB; Wed, 9 Oct 2019 06:22:53 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46p3zw6btLz413g; Wed, 9 Oct 2019 06:22:52 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pl1-x62f.google.com with SMTP id e5so537272pls.9; Tue, 08 Oct 2019 23:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=CBUnWycMM1nM7ognf66PGjfST/hgwxZuAsJShyrg2V8=; b=XZnurm+XIK0EGY4glw3RoNDvL3vUzEhRijgoV1tey3TuA0lori5SAGfwPzFK5AxUiO VSIpwkBiZOPQAD1UiYnLe+ECz+Q8+/DSTOl1+ZqdjIotl8o7Anb/tB9b2ky6d8YnAYDi T/xMscqNwqTbnEjs+7oO2bVDLrTI35WKnxe5kzF+d71i7lpsy2jZW/HJMuZNOclFhr2B GKE8iZmK0+L9sDihryWUzeLtzp0fduRDM3mti5AcgXIrbOdoiYphbhQVErsdbhKLs0U1 HA6ralnpkSwGt3Hi0Ko0NkBwFNdBuThdzVqH/ePCWYaF5jN3VO9vKExZy14AS5i9c54n jTlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=CBUnWycMM1nM7ognf66PGjfST/hgwxZuAsJShyrg2V8=; b=kuHE69JjsthC5M0oQEKic6FgEUVmNEHA1RfVKHI5tjVcJt7e6vzujot+dnorGO0J4U ws/270iwAo+H7Rr8lBnsbtFM1toDEuWUbz5hk67/AL/peH3/78zWSw7Y9f3qYlYXdfBg Me7Pcu9TjoSNSWXBlOG+JmG/Wk6w/IiJYoU17UXM4cGcPz3sBk95Pyrfo0sFnp5oNBwT 7JJaCBJWDr3LKc/Y/46/BY4d/BI60EpltxmP3mVML1WhojQNLOfbT64H9w4ALjdxIKDi X76+KEe+PGox2q0JdNO0RmG26AGip/HdnM6Nbwj/DqJgVVTLtDtTebr5hM6eQnaOpbu4 sWww== X-Gm-Message-State: APjAAAUXA6yc+/qR6blBIVEiC5Ti3RlZv2/hxh1s8RSFQJe5xu1FSz5j FDaqPjjWU7AQgxO3J1/iY9c= X-Google-Smtp-Source: APXvYqzLfY+UHHgmCLnCo9wr7ImNAGMz7zLGphSyAYSF0aipdJdc6cYQ62aMOMFrnzVxvIW/7k6CfA== X-Received: by 2002:a17:902:690c:: with SMTP id j12mr1524129plk.183.1570602170954; Tue, 08 Oct 2019 23:22:50 -0700 (PDT) Received: from [192.168.20.12] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id u194sm1503951pgc.30.2019.10.08.23.22.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Oct 2019 23:22:50 -0700 (PDT) From: "Enji Cooper (yaneurabeya)" Message-Id: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353305 - head/tests/sys/kern Date: Tue, 8 Oct 2019 23:22:48 -0700 In-Reply-To: <20191008150438.GE44691@kib.kiev.ua> Cc: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Konstantin Belousov References: <201910081343.x98Dh5bW006905@repo.freebsd.org> <20191008150438.GE44691@kib.kiev.ua> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46p3zw6btLz413g X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=XZnurm+X; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::62f as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-1.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[228.52.19.73.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; IP_SCORE(0.00)[ip: (-9.28), ipnet: 2607:f8b0::/32(-2.53), asn: 15169(-2.14), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[f.2.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Oct 2019 06:22:53 -0000 > On Oct 8, 2019, at 08:04, Konstantin Belousov = wrote: >=20 > On Tue, Oct 08, 2019 at 01:43:05PM +0000, Eric van Gyzen wrote: >> Author: vangyzen >> Date: Tue Oct 8 13:43:05 2019 >> New Revision: 353305 >> URL: https://svnweb.freebsd.org/changeset/base/353305 >>=20 >> Log: >> Fix problems in the kern_maxfiles__increase test >>=20 >> ATF functions such as ATF_REQUIRE do not work correctly in child = processes. >> Use plain C functions to report errors instead. > There are much more tests that fork and use ATF_ in children. > Look e.g. at most ptrace(2) tests. I beg to disagree: 86 /* 87 * A variant of ATF_REQUIRE that is suitable for use in child 88 * processes. This only works if the parent process is tripped up = by 89 * the early exit and fails some requirement itself. 90 */ 91 #define CHILD_REQUIRE(exp) do { = \ 92 if (!(exp)) = \ 93 child_fail_require(__FILE__, __LINE__, = \ 94 #exp " not met"); = \ 95 } while (0) The issue, in this particular case, and the item that evangyzen was = fixing, was the fact that failures in children can result in very = confusing failures from a parent level. In particular, ATF_CHECK does = not trickle up to parents and ATF_REQUIRE* gets thrown up to parents as = abort()=E2=80=99ed processes. The best way to handle this within the atf-c/atf-c++ framework (with = less boilerplate) is to use these APIs: = atf_utils_fork(..)/atf_utils_wait(..). You will still need to use = `_exit` (instead of exit(..)/assert(..)/ATF_CHECK(..)/ATF_REQUIRE(..), = but it=E2=80=99s a lot less boilerplate than writing it yourself. Again, this is why I was driving towards GoogleTest. Despite the fact = that it=E2=80=99s a C++ framework, there=E2=80=99s a lot less confusing = boilerplate involved and context, since things are executed in = relatively the same context, i.e., setup -> test -> teardown, and = they=E2=80=99re easier to follow. The best way to move forward usability-wise with this (I think) is to = probably alias the ATF_* macros to something more sensible when forking = processes. However, given the amount of complaints I=E2=80=99ve heard = about ATF, I think it=E2=80=99s best not to build upon an unstable = foundation, but instead encourage the use of something more = widely-accepted across the open source community/straightforward use = wise. In this case, googletest. Thanks, -Enji=