summaryrefslogtreecommitdiff
path: root/Jamfile.jam
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-06-02 06:25:40 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-06-02 06:25:40 +0000
commitc622ce6fed61e07125c7d764f84fc70bb73c6c78 (patch)
tree8c41468c7cbc33886a45ea8fa67a6b9b63ff454e /Jamfile.jam
parent8a51e7d6d330cdbee6dc17a534e26183e0ceaa47 (diff)
tests: Redesigned test building; now all configurations of a single toolset are built in a single jam run
git-svn-id: http://pugixml.googlecode.com/svn/trunk@493 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'Jamfile.jam')
-rw-r--r--Jamfile.jam78
1 files changed, 57 insertions, 21 deletions
diff --git a/Jamfile.jam b/Jamfile.jam
index bc47f10..28c7f04 100644
--- a/Jamfile.jam
+++ b/Jamfile.jam
@@ -33,37 +33,73 @@ if ( ! $(configuration) )
configuration = "debug" ;
}
-# split defines into list
-defines = [ Split $(defines) : ',' ] ;
-
-# options
-if ( $(defines) )
-{
- BUILD = build/$(toolset)/$(defines:J=_)/$(configuration) ;
-}
-else
+if ( ! $(defines) )
{
- BUILD = build/$(toolset)/standard/$(configuration) ;
+ defines = "PUGIXML_STANDARD" ;
}
+# coverage options
if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{
CCFLAGS = -fprofile-arcs -ftest-coverage ;
LDFLAGS = -fprofile-arcs ;
GCOVFLAGS = -n ;
-
- GCOVFLAGS += -o $(BUILD)/src ; # because stupid gcov can't find files via relative paths
}
+# build folder
+BUILD = build ;
+
+# enable dependency cache
+DEPCACHE.standard = $(BUILD)/.depcache ;
+
# rules
include "Jamrules.jam" ;
-# enable dependency cache
-DEPCACHE.standard = build/.depcache ;
-
-# targets
-Library pugixml : src/pugixml.cpp src/pugixpath.cpp ;
-Application tests : [ Glob tests : *.cpp ] : pugixml ;
-Test run_tests : tests ;
-Coverage coverage : pugixml ;
-Depends coverage : run_tests ;
+# split define sets into list
+local DEFINESETS = [ Split $(defines) : ';' ] ;
+
+# split configurations into list
+local CONFIGURATIONS = [ Split $(configuration) : ',' ] ;
+
+for CONFIG in $(CONFIGURATIONS)
+{
+ for DEFINESET in $(DEFINESETS)
+ {
+ local DEFINES = [ Split $(DEFINESET) : ',' ] ;
+
+ # build folder
+ local CFGBUILD = $(BUILD)/$(toolset)/$(DEFINES:J=_)/$(CONFIG) ;
+
+ # compilation options
+ local CFGFLAGS = $(CCFLAGS) [ GetCFlags $(CONFIG) : $(DEFINES) ] ;
+
+ # build library
+ local PUGIXML = $(CFGBUILD)/pugixml.lib ;
+ Library $(PUGIXML) : src/pugixml.cpp src/pugixpath.cpp : $(CFGFLAGS) ;
+ Alias pugixml : $(PUGIXML) ;
+
+ # build tests
+ local TESTS = $(CFGBUILD)/tests.exe ;
+ Application $(TESTS) : [ Glob tests : *.cpp ] : $(CFGFLAGS) : $(PUGIXML) ;
+ Alias tests : $(TESTS) ;
+
+ # run tests
+ Test $(TESTS)_run : $(TESTS) ;
+ Alias run_tests : $(TESTS)_run ;
+
+ # gather coverage
+ Coverage $(TESTS)_coverage : $(PUGIXML) ;
+ Alias coverage : $(TESTS)_coverage ;
+
+ GCOVFLAGS on $(TESTS)_coverage = $(GCOVFLAGS) -o $(CFGBUILD)/src ; # because stupid gcov can't find files via relative paths
+
+ # add special autotest markers to build log
+ if $(autotest)
+ {
+ COVPREFIX on $(TESTS)_coverage = "### autotest $(CONFIG) [$(DEFINESET)]" ;
+ }
+
+ # gather coverage after tests run
+ Depends $(TESTS)_coverage : $(TESTS)_run ;
+ }
+}