[Scons-users] HOWTO model a test suite using SCons
Stefan Seefeld
stefan at seefeld.name
Sun Jan 3 19:13:05 EST 2016
On 03.01.2016 10:52, William Blevins wrote:
>
>
> On Sun, Jan 3, 2016 at 7:00 AM, Stefan Seefeld <stefan at seefeld.name
> <mailto:stefan at seefeld.name>> wrote:
>
> Hi,
>
> thanks all for the helpful replies.
>
> On 01.01.2016 15:12, William Blevins wrote:
> > Stefan,
> >
> > I have always used something simple
> > like https://bitbucket.org/scons/scons/wiki/UnitTests
> >
> > I just compile my test suite and create a target for running the
> > suite. Obviously passing parameters to the suite via commandline is
> > hard, but depending on the scale of the tests, that is usually
> > irrelevant. You can of course make a whole pipeline using SCons
> > targets which may include piping the test outputs to a file and
> using
> > that file as a target to a document generator, etc.
>
> Yes, I think this is precisely what I'm looking for: while I
> already can
> run tests "normally" (even generate some simple output like "PASS" and
> "FAIL"), the output is typically very noisy due to various reasons
> (compiler warnings, say), so I'd like to add a "reporter" that
> post-processes the test results (such as to print a nice summary
> to stdout).
> While I'm able to set things up manually, I would like to find a
> way to
> do this automatically:
>
> My SConscript file contains a bunch of "Test(...)" declarations (each
> defining a test that produces a specific <name>.result test-result
> file). Is there a way to pre-define a "Report" generator such that all
> the above *.result files are automatically added as sources for
> it, such
> that when I run `scons test`, it runs all tests, followed by the
> report
> generator ?
>
> Is this a sensible approach at all ?
>
>
> You can make a Command or Builder for the report generator
> action: https://bitbucket.org/scons/scons/wiki/ToolsForFools
>
> Then just pass the output of Test calls (the targets) as sources to
> the ReportGenerator builder.
Right, I understand. My question was whether there is a way to do that
implicitly. My current SConscript code looks like this:
env.Test('foo')
env.Test('bar')
...
To add a report generator I'd need to add something akin to
env.Report(['foo', 'bar',...])
and I'm wondering whether I can synthesize that last line based on the
above env.Test() invocations, so I don't have to modify two locations
whenever I add new tests.
Thanks,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
More information about the Scons-users
mailing list