From owner-svn-src-all@freebsd.org Tue Sep 3 12:12:58 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 96C3DD90AF; Tue, 3 Sep 2019 12:12:58 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from ecc05.stack.nl (ws0.zlo.nu [190.2.135.243]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "*.stack.nl", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N5ST2B15z4H3k; Tue, 3 Sep 2019 12:12:56 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mail04.stack.nl (blade.stack.nl [51.15.111.152]) by ecc05.stack.nl (Postfix) with ESMTPS id 8D9FD1001FD; Tue, 3 Sep 2019 12:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=stack.nl; s=mail; t=1567512765; bh=bntJbwaoQyPDW2Nj4/WwIbY/z2I3AgUYVmCvFJODDYc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AeN1cEjLhVhAgtYQ0A9wLI8Iu2633DuPRb2UdsIVUA0SLTb4pFG+kbjPwOinpfBxL UvFsXnqIIg5sMmKAVKFg2+um93T7314zGOTGI+3KPylcXyKvLVDNWnIHIUFxQZw1zJ 7ZjANLsqPyawt8nQZSw0bLsWsCkfTJ+QlOjOZ/ubz2nuqMw6heq4hYS6HjDJzifdcS K7EkjseWv1ZYW55mVREXTvirtR9pgyLd9DEwuO/1nnRAuLdNuO/5pLVTI7owAEvWSs oDHn9JREEdN0sczslRMMtV15z4i7S/n0Wbl/JsgtFXifPGgM5Jcm1LvnF0jkM+IOSq VjEe9+JMbIjAg== Received: from localhost (localhost.localdomain [127.0.0.1]) by mail04.stack.nl (Postfix) with ESMTP id 5CAA593E; Tue, 3 Sep 2019 12:12:45 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail04.stack.nl Received: from mail04.stack.nl ([127.0.0.1]) by localhost (mail04.stack.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PVSfvpST_0Dn; Tue, 3 Sep 2019 12:12:42 +0000 (UTC) Received: from blade.stack.nl (blade.stack.nl [192.168.122.130]) by mail04.stack.nl (Postfix) with ESMTP id AA8F1373; Tue, 3 Sep 2019 12:12:42 +0000 (UTC) Received: by blade.stack.nl (Postfix, from userid 1677) id 8270320DFE; Tue, 3 Sep 2019 14:12:42 +0200 (CEST) Date: Tue, 3 Sep 2019 14:12:42 +0200 From: Jilles Tjoelker To: Li-Wen Hsu Cc: rgrimes@freebsd.org, Enji Cooper , Warner Losh , "Conrad E. Meyer" , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation Message-ID: <20190903121242.GA23842@stack.nl> References: <201909021549.x82FndM9009860@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 46N5ST2B15z4H3k X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=stack.nl header.s=mail header.b=AeN1cEjL; dmarc=none; spf=pass (mx1.freebsd.org: domain of jilles@stack.nl designates 190.2.135.243 as permitted sender) smtp.mailfrom=jilles@stack.nl X-Spamd-Result: default: False [-3.86 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[stack.nl:s=mail]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:190.2.135.243]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[stack.nl]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[stack.nl:+]; NEURAL_HAM_SHORT(-0.84)[-0.841,0]; RCPT_COUNT_SEVEN(0.00)[8]; IP_SCORE(-0.51)[asn: 49981(-2.59), country: NL(0.01)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:49981, ipnet:190.2.128.0/20, country:NL]; MID_RHS_MATCH_FROM(0.00)[] 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: Tue, 03 Sep 2019 12:12:58 -0000 On Tue, Sep 03, 2019 at 06:42:00PM +0800, Li-Wen Hsu wrote: > On Mon, Sep 2, 2019 at 11:49 PM Rodney W. Grimes > wrote: > > > > On Aug 31, 2019, at 16:29, Warner Losh wrote: > > > >> On Sat, Aug 31, 2019 at 5:29 PM Conrad Meyer wrote: > > > >> Thanks Li-Wen! Might it be less fragile to have the test fixture > > > >> create a file, if the test(s) will expect one to be present to read? > > > > Or just use the realpath $0, which you know has to exist :) > > > I don?t know if this would work, with other some of the dtrace > > > tests are called. Plus, that relies on a FreeBSD utility which > > > doesn?t necessarily exist on Linux and I don?t think exists on > > > IllumOS. > > > It makes more sense to create a file with mktemp and test for it > > > in the loop to make the tests portable over to IllumOS, since > > > that?s where they originally came from and can be contributed back > > > to. > > Agreed, especially if these tests are expected to be portable the > > assumption of existance of /COPYRIGHT is a mistake/bug. > Thanks for the inputs. Indeed, depending on any irrelevant files or > FreeBSD specified tools both do not sound a good solution. After > reading these test cases again, I feel that creating a temp file might > be slightly over engineering because in the end we also need to take > care of cleaning, in normal and abnormal exiting cases. In these > tests, we only need someone calls open(2) and read(2). > How about changing them to `cat / > /dev/null` ? Reading a directory as bytes is not portable. For example, FreeBSD fdescfs and nfs do not allow it, and Linux does not allow it at all. Apart from the fact that the resulting bytes depend on the filesystem type, this operation is problematic because it may expose filenames that were previously deleted. The files /etc/group and /etc/passwd exist on most operating systems, but for optimal portability a temporary file seems unavoidable (assuming that data must come from a regular file). -- Jilles Tjoelker