Date: Tue, 25 Feb 2014 19:36:11 +0100 From: Peter Holm <peter@holm.cc> To: Mehmet Erol Sanliturk <m.e.sanliturk@gmail.com> Cc: "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org> Subject: Re: My first ATF test Message-ID: <20140225183611.GA70774@x2.osted.lan> In-Reply-To: <CAOgwaMv1pqibdR6WJUB9gzDCOJpdDLdFOOvdgjeLJfd5pqbN_g@mail.gmail.com> References: <20140225161129.GA59741@x2.osted.lan> <CAOtMX2hQA8SP7zXsOQHd-kAV7R8ziw12Cfz=nWQbBCaS1hS48g@mail.gmail.com> <CAOgwaMv1pqibdR6WJUB9gzDCOJpdDLdFOOvdgjeLJfd5pqbN_g@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 25, 2014 at 12:12:38PM -0500, Mehmet Erol Sanliturk wrote: > On Tue, Feb 25, 2014 at 11:47 AM, Alan Somers <[1]asomers@freebsd.org> > wrote: > > On Tue, Feb 25, 2014 at 9:11 AM, Peter Holm <peter@holm.cc> wrote: > > In order to understand how ATF works I wrote a small test so I had > > something to work with: > > [2]http://people.freebsd.org/~pho/kern_descrip_test.diff > > Did I get it right? > ATF-wise, it looks good. Â However, it's a bad idea to use random > numbers in test code, except in stress tests. Â Random numbers > result > in irreproducible tests. Â How about replacing the body of > dup2_r234131 > with something like this? > Â int fd1, fd2, ret; > Â fd1 = Â open("/etc/passwd", O_RDONLY); > Â fd2 = INT_MAX; > Â ret = dup2(fd1, fd2); > Â ATF_CHECK_EQ(-1, ret); > Â ATF_CHECK_EQ(EBADF, errno); > On a side note, perhaps WARNS should be set in [3]atf.test.mk, so we > won't have to set it in every other Makefile. > -Alan > _______________________________________________ > > When random numbers are used , it is possible to make the runs > reproducible in the following way : > Generate a specified number of random numbers and store them into a > file . > During usage , for random numbers , traverse that file . > This may be repeated any number of times for different other parameters > . > All of the runs will use the same random numbers . > Then the results ( which they are generated from the same distribution > ) may be compared with suitable statistical tests . > Thank you very much . > Mehmet Erol Sanliturk > I guess I'm too used to using random values in tests :) Using random(3) with an initial seed of "1" could have been an alternative, but ... - Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140225183611.GA70774>