tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Reorganizing src/tests
Julio Merino <jmmv84%gmail.com@localhost> wrote:
>
> This is a proposal to reorganize the contents of src/tests to address
> two major concerns:
>
> A) Tests should be alongside the sources they test. This gives tests
> more visibility and easier access, like manual pages, so it will
> hopefully make people more responsible about keeping them up to date.
Seems reasonable for userland applications.
However, what would you do for kernel tests?
> Tests location
> **************
>
> <...>
>
> I've heard some suggestion to put tests in a 'tests/' subdirectory, so
> you'd have src/bin/cp/tests/. I think that's a bad idea for two
> reasons:
I would second such suggestion; see below.
> 1) If we have this source layout and want to match the installed
> layout, then the tests have to get installed under
> /usr/tests/bin/cp/tests/, which is silly. If we put the tests in
> src/bin/cp/tests/ and install them in /usr/tests/bin/cp/, then we are
> losing consistency which I think is a bad thing. (Note that tests can
> query what their "source directory" is, and such inconsistency will
> cause lots of confusion.)
Why? Convention is consistent:
<subdir>/<app> and /usr/tests/<subdir>/<app>
For <app>/tests/ directory - grouping and being near the source are
the points, not much of "(in)consistency" there.
> 2) By introducing the tests/ subdirectory under each other directory,
> we are still hiding tests. E.g. if I'm editing cp.c and I see right
> next to it a file called cp_test.c, I'll be tempted to edit it. If
> cp_test.c is under tests/cp_test.c, I can easily miss it. Note that
> we don't put manual pages in a man/ subdirectory, and for a good
> reason. Oh, and directories in cvs are expensive (braindead?).
Code should be convenient to work with. Hence, well organized, taking
into account directory level too. Messing up all parts of application
into a single directory would be going to the opposite direction.
Also, I think we should have man/ directories too. :) For example, mix
of these in lib/libpthread is quite irritating to me.
> Naming scheme
> *************
>
> Current test programs are prefixed by 't_'. This is a carry-over from
> atf's original naming scheme, which I now think was stupid. Such a
> prefix is cryptic and also hides tests in directory listings because
> they do not appear right next to the source file.
Agree. I wanted to ask why such prefixing was done..
> It is "easy" to pick a subset of tests from src/tests and move them
> around the source tree, doing all necessary file list adjustments at
> the same time. This will minimize breakage, huge changes to the tree
> all at once and make the modifications to the filelists bearable.
Perhaps adding "make test" facility to each Makefile would be useful?
--
Mindaugas
Home |
Main Index |
Thread Index |
Old Index