My first ATF test

Mehmet Erol Sanliturk m.e.sanliturk at
Tue Feb 25 17:12:40 UTC 2014

On Tue, Feb 25, 2014 at 11:47 AM, Alan Somers <asomers at> wrote:

> On Tue, Feb 25, 2014 at 9:11 AM, Peter Holm <peter at> wrote:
> > In order to understand how ATF works I wrote a small test so I had
> > something to work with:
> >
> > 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, 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

More information about the freebsd-testing mailing list