[GRASS-dev] Test suite for GRASS - proposal, discussion welcome

Markus Metz markus.metz.giswork at googlemail.com
Tue May 24 03:44:40 EDT 2011


On Mon, May 23, 2011 at 4:04 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Anne Ghisla wrote:
>
>> > I'd suggest adding a "test" target to the various *.make files, so you
>> > can do e.g.:
>> >
>> >     make -C display test
>> >     make -C display/d.rast test
>>
>> Good idea. Sadly I don't know makefile system well, so most of my
>> questions are basic. Your suggestion is to explicitely run tests on a
>> given module. Would it also be possible to run tests in one run,
>> launching 'make' in the code root folder?
>
> Yes. In Dir.make (used for directories) the "test" target would be
> recursive, i.e. it would run "make -C $dir test" for each
> subdirectory, the same way that the "clean" target is handled. This
> target would literally be just:
>
>        test: test-recursive
>
> Dir.make already has a pattern rule for "%-recursive", which makes the
> stem (whatever the "%" matches) for each subdirectory.

There is already a test in the vector libs [0], performed during
compilation because there is no test target in the GRASS make system.
Maybe looking at [0] gives you an idea how to add tests to the make
system. In [0], a test target is added and always called when running
make (default calls test). It's pretty much like Glynn suggested: have
a reference file *.ok, create a test file, compare reference and test
file, here with diff. Files differ -> test failed. That was pretty
convenient when I implemented vector LFS and tested it on different
platforms.

Markus M

[0] https://trac.osgeo.org/grass/browser/grass/trunk/lib/vector/diglib/Makefile#L26


More information about the grass-dev mailing list