I've been using this rule which makes use of the testing module in boost-build:
rule build-tests ( sources + : requirements * : args * : input-files * : default-build * )
{
import testing ;
modules.poke testing : preserve-test-targets : true ;
local result ;
#ECHO Test Targets: $(sources) ;
#ECHO Test Requirements: $(requirements) ;
#ECHO Test args: $(args) ;
#ECHO Test input-files: $(input-files) ;
for source in $(sources) {
local file = [ regex.split $(source) "\\." ] ;
local target-name = $(file[1]) ;
#ECHO Test Target: $(target-name) ;
result += [ testing.run $(source) : $(args) : $(input-files) : $(requirements) : $(target-name) : $(default-build) ] ;
#ECHO Test Result: $(result) ;
#ECHO Test Result type: @result.type ;
}
return $(result) ;
}
I'll invoke it this way:
build-tests [ glob test_*.cpp ] ;
This works great and runs the unit tests, unless a unit test has a file that needs to be installed with the test for runtime only.
For normal exe targets, I'll use something like:
make net.conf : net.conf.in : @common.copy ;
But that doesn't work while making use of the testing module because testing.run specifies a new build location with: <location-prefix>$(real-name).test
How do I use this rule so that it installs a runtime dependent file along with the test?
Thanks!
Derek