svn commit: r351643 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: dtraceUtil speculation

Rodney W. Grimes freebsd at gndrsh.dnsmgr.net
Tue Sep 3 14:42:09 UTC 2019


> On Mon, Sep 2, 2019 at 11:49 PM Rodney W. Grimes
> <freebsd at gndrsh.dnsmgr.net> wrote:
> >
> > >
> > > > On Aug 31, 2019, at 16:29, Warner Losh <imp at bsdimp.com> wrote:
> > > >
> > > >
> > > >
> > > >> On Sat, Aug 31, 2019 at 5:29 PM Conrad Meyer <cem at freebsd.org> 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` ?

Does it have to be cat?
dd if=/dev/zero count=1 >/dev/null
seems far more portable to me.

Permissions may not allow cat /, it is valid to run chmod 511 /

> Best,
> Li-Wen
> 

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the svn-src-all mailing list