Source-Changes-D archive

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

Re: CVS commit: src/external/bsd/atf/dist/atf-sh

On Fri, Jan 10, 2014 at 7:31 PM, Christos Zoulas 
<> wrote:
> I would have preferred that the cleanup functionality was implemented
> differently, running in the context of the shell that ran the test.
> This could have been done by issuing a 'trap test_cleanup 0' before
> invoking the test, instead of all the complex stuff that is currently
> been done (unless I am missing something).

The reason it works like it does is because atf-run takes care of most
cleanup by itself and runs every test case on its own subprocess.

The cleanup routine supports exists only to let the test deconfigure
global resources that it may have affected, like, for example, kernel
modules, file systems, routing table, etc.  The tests that require
this should be a minority, because tests affecting global system state
should be minimized (and, thanks to rump, that can be generally
avoided these days).

Keep in mind that the feature set of the 3 atf libraries must be
identical from the point of view of atf-run.  trap might have worked
on atf-sh, but there is no way you can get proper cleanup like this on
C.  If the program crashes, the cleanup won't run -- and that's why
cleanup is intended to run separately so that it can be executed no
matter what happens to the process that ran the test body.

Changing the way this works in the atf libraries is not an option.
But with the switch to Kyua it wouldn't matter, because Kyua supports
test programs built with different "frameworks" (including "no
framework").  We'd investigate using other unit-testing libraries at
that point that have more traditional fixture definitions, and even
use different approaches for sh and C, all within the same NetBSD test
suite.  I'll be posting an update to the plan in this area soon.

Julio Merino / @jmmv

Home | Main Index | Thread Index | Old Index