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

2019-09-03 Thread Rodney W. Grimes
> 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` ?

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 rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-09-03 Thread Jilles Tjoelker
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
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-09-03 Thread Li-Wen Hsu
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` ?

Best,
Li-Wen
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-09-02 Thread Rodney W. Grimes
> 
> > 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,
> -Enji
-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-09-01 Thread Enji Cooper

> 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.

Thanks,
-Enji
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-08-31 Thread Warner Losh
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 :)

Warner


> On Sat, Aug 31, 2019 at 7:42 AM Li-Wen Hsu  wrote:
> >
> > Author: lwhsu
> > Date: Sat Aug 31 14:41:58 2019
> > New Revision: 351643
> > URL: https://svnweb.freebsd.org/changeset/base/351643
> >
> > Log:
> >   Fix tests use /etc/motd after r350184 by using an always existing file
> >
> >   Sponsored by: The FreeBSD Foundation
> >
> > Modified:
> >
>  
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> >
>  
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> >
>  
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
> >
> > Modified:
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> >
> ==
> > ---
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> Sat Aug 31 13:24:22 2019(r351642)
> > +++
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> Sat Aug 31 14:41:58 2019(r351643)
> > @@ -43,7 +43,7 @@ reader()
> > while true
> > do
> > sleep 0.1
> > -   cat /etc/motd > /dev/null
> > +   cat /COPYRIGHT > /dev/null
> > done
> >  }
> >
> >
> > Modified:
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> >
> ==
> > ---
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   Sat Aug 31 13:24:22 2019(r351642)
> > +++
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   Sat Aug 31 14:41:58 2019(r351643)
> > @@ -44,7 +44,7 @@ reader()
> > while true
> > do
> > sleep 0.1
> > -   cat /etc/motd > /dev/null
> > +   cat /COPYRIGHT > /dev/null
> > done
> >  }
> >
> >
> > Modified:
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
> >
> ==
> > ---
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>  Sat Aug 31 13:24:22 2019(r351642)
> > +++
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>  Sat Aug 31 14:41:58 2019(r351643)
> > @@ -26,5 +26,5 @@
> >  while true
> >  do
> > sleep 0.1
> > -   cat /etc/motd > /dev/null
> > +   cat /COPYRIGHT > /dev/null
> >  done
> >
>
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-08-31 Thread Conrad Meyer
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?

On Sat, Aug 31, 2019 at 7:42 AM Li-Wen Hsu  wrote:
>
> Author: lwhsu
> Date: Sat Aug 31 14:41:58 2019
> New Revision: 351643
> URL: https://svnweb.freebsd.org/changeset/base/351643
>
> Log:
>   Fix tests use /etc/motd after r350184 by using an always existing file
>
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
>   Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
>   Sat Aug 31 14:41:58 2019(r351643)
> @@ -43,7 +43,7 @@ reader()
> while true
> do
> sleep 0.1
> -   cat /etc/motd > /dev/null
> +   cat /COPYRIGHT > /dev/null
> done
>  }
>
>
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> Sat Aug 31 14:41:58 2019(r351643)
> @@ -44,7 +44,7 @@ reader()
> while true
> do
> sleep 0.1
> -   cat /etc/motd > /dev/null
> +   cat /COPYRIGHT > /dev/null
> done
>  }
>
>
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>Sat Aug 31 14:41:58 2019(r351643)
> @@ -26,5 +26,5 @@
>  while true
>  do
> sleep 0.1
> -   cat /etc/motd > /dev/null
> +   cat /COPYRIGHT > /dev/null
>  done
>
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-08-31 Thread Rodney W. Grimes
> Author: lwhsu
> Date: Sat Aug 31 14:41:58 2019
> New Revision: 351643
> URL: https://svnweb.freebsd.org/changeset/base/351643
> 
> Log:
>   Fix tests use /etc/motd after r350184 by using an always existing file

If the tests is dependent on "always existing" shouldnt the test
insure that itself by actually creating the file?


>   Sponsored by:   The FreeBSD Foundation
> 
> Modified:
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
> 
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
> Sat Aug 31 14:41:58 2019(r351643)
> @@ -43,7 +43,7 @@ reader()
>   while true
>   do
>   sleep 0.1
> - cat /etc/motd > /dev/null
> + cat /COPYRIGHT > /dev/null
>   done
>  }
>  
> 
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
>   Sat Aug 31 14:41:58 2019(r351643)
> @@ -44,7 +44,7 @@ reader()
>   while true
>   do
>   sleep 0.1
> - cat /etc/motd > /dev/null
> + cat /COPYRIGHT > /dev/null
>   done
>  }
>  
> 
> Modified: 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
> ==
> --- 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>  Sat Aug 31 13:24:22 2019(r351642)
> +++ 
> head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
>  Sat Aug 31 14:41:58 2019(r351643)
> @@ -26,5 +26,5 @@
>  while true
>  do
>   sleep 0.1
> - cat /etc/motd > /dev/null
> + cat /COPYRIGHT > /dev/null
>  done
> 
> 

-- 
Rod Grimes rgri...@freebsd.org
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2019-08-31 Thread Li-Wen Hsu
Author: lwhsu
Date: Sat Aug 31 14:41:58 2019
New Revision: 351643
URL: https://svnweb.freebsd.org/changeset/base/351643

Log:
  Fix tests use /etc/motd after r350184 by using an always existing file
  
  Sponsored by: The FreeBSD Foundation

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
  Sat Aug 31 13:24:22 2019(r351642)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.DestructWithFunction.d.ksh
  Sat Aug 31 14:41:58 2019(r351643)
@@ -43,7 +43,7 @@ reader()
while true
do
sleep 0.1
-   cat /etc/motd > /dev/null
+   cat /COPYRIGHT > /dev/null
done
 }
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
Sat Aug 31 13:24:22 2019(r351642)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.ZeroFunctionProbes.d.ksh
Sat Aug 31 14:41:58 2019(r351643)
@@ -44,7 +44,7 @@ reader()
while true
do
sleep 0.1
-   cat /etc/motd > /dev/null
+   cat /COPYRIGHT > /dev/null
done
 }
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
   Sat Aug 31 13:24:22 2019(r351642)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/speculation/tst.NoSpecBuffer.exe
   Sat Aug 31 14:41:58 2019(r351643)
@@ -26,5 +26,5 @@
 while true
 do
sleep 0.1
-   cat /etc/motd > /dev/null
+   cat /COPYRIGHT > /dev/null
 done
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"