tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: where are ATF examples? (was: calendar on Sunday shows Wednesday and multiple days are skipped)



On Mon, May 05, 2008 at 01:22:51PM -0500, Jeremy C. Reed wrote:
> I will start writing regression tests for calendar.
> 
> Please point me to the documentation or examples.
> 
> I found /usr/share/doc/atf/README which doesn't help me. I found 
> atf-test-case but still don't know where to begin.

See atf(7).  That should give you an overview of all of the other atf
manual page and the best reading order.

Unforunately, there are no big examples at the moment other than looking
at the code of similar tests.  This is in the process of being resolved.
I have started rewriting all of the API-related documentation for 0.6.

> My plan is to have:
> 
> 1) set of calendar configurations files.
> 
> 2) corresponding set of correct output when using the provide calendar 
> configurations.
> 
> 3) some ATF configuration to run calendar with desired switches using 
> calendar configurations files -- and then compare the results.

Based on this explanation... some sample tests that may serve you are
the ones in tests/atf/formats (source files in dist/atf/tests/atf/formats).

Basically, if you have 1) and 2), you can set up some simple test code
using the atf-sh-api to run calendar with the correct parameters and compare
its output with the prerecorded values.  See the details for the atf_check
function.

> 4) adjust Makefile(s) as needed to run these new 
> tests for src/usr.bin/calendar.

Forget about Makefiles to run tests: this is how it was done before and
is broken because then you need developer tools to run tests :)  With atf,
you use Makefiles to just build and install your tests.  Then, you use
atf-run to execute the tests on the target system.

Hope this helps.

-- 
Julio M. Merino Vidal <jmmv%NetBSD.org@localhost>


Home | Main Index | Thread Index | Old Index