2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00
Files
build/new/testing.jam
Vladimir Prus f72669f745 Added testing.launcher feature. For example, now unit tests can be
run under valgrind.


[SVN r17063]
2003-01-28 15:12:31 +00:00

68 lines
2.0 KiB
Plaintext

# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
# Testing support.
import targets ;
import class : class new ;
import property ;
import feature ;
import toolset ;
# The feature which controls the name of program used to
# lanch test programs.
feature.feature testing.launcher : : optional free ;
rule unit-test-target-class ( name : project : sources * : requirements *
: default-build * )
{
typed-target.__init__ $(name) : $(project) : EXE : $(sources)
: $(requirements) : $(default-build) ;
rule construct ( source-targets * : properties * )
{
local result =
[ typed-target.construct $(source-targets) : $(properties) ] ;
local exe = $(result[1]) ;
local exe-action = [ $(exe).action ] ;
local timestamp = [ new file-target $(self.name) : : $(self.project)
] ;
$(timestamp).suffix "passed" ;
local a = [ new action $(timestamp) : $(exe) : testing.run :
[ $(exe-action).properties ] ] ;
$(timestamp).action $(a) ;
return $(timestamp) ;
}
}
class unit-test-target-class : typed-target ;
toolset.flags testing.run LAUNCHER <testing.launcher> ;
actions run
{
$(LAUNCHER) $(>) && touch $(<)
}
rule unit-test ( target-name : sources * : requirements * )
{
local project = [ CALLER_MODULE ] ;
# TODO: what to do with default build?
targets.main-target-alternative
[ new unit-test-target-class $(target-name) : $(project) : $(sources)
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
] ;
}
IMPORT $(__name__) : unit-test : : unit-test ;