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
This commit is contained in:
arseny.kapoulkine 2010-06-02 06:25:40 +00:00
parent 8a51e7d6d3
commit c622ce6fed
5 changed files with 359 additions and 245 deletions

View File

@ -33,37 +33,73 @@ if ( ! $(configuration) )
configuration = "debug" ; configuration = "debug" ;
} }
# split defines into list if ( ! $(defines) )
defines = [ Split $(defines) : ',' ] ;
# options
if ( $(defines) )
{ {
BUILD = build/$(toolset)/$(defines:J=_)/$(configuration) ; defines = "PUGIXML_STANDARD" ;
}
else
{
BUILD = build/$(toolset)/standard/$(configuration) ;
} }
# coverage options
if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{ {
CCFLAGS = -fprofile-arcs -ftest-coverage ; CCFLAGS = -fprofile-arcs -ftest-coverage ;
LDFLAGS = -fprofile-arcs ; LDFLAGS = -fprofile-arcs ;
GCOVFLAGS = -n ; 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 # rules
include "Jamrules.jam" ; include "Jamrules.jam" ;
# enable dependency cache # split define sets into list
DEPCACHE.standard = build/.depcache ; local DEFINESETS = [ Split $(defines) : ';' ] ;
# targets # split configurations into list
Library pugixml : src/pugixml.cpp src/pugixpath.cpp ; local CONFIGURATIONS = [ Split $(configuration) : ',' ] ;
Application tests : [ Glob tests : *.cpp ] : pugixml ;
Test run_tests : tests ; for CONFIG in $(CONFIGURATIONS)
Coverage coverage : pugixml ; {
Depends coverage : run_tests ; 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 ;
}
}

View File

@ -11,30 +11,42 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
GCCPATH = "%$(toolset)_PATH%\\bin\\" ; GCCPATH = "%$(toolset)_PATH%\\bin\\" ;
} }
CCFLAGS += -D$(defines) ;
if ( $(configuration) = "debug" )
{
CCFLAGS += -D_DEBUG ;
}
else
{
CCFLAGS += -DNDEBUG -O3 ;
}
if ( PUGIXML_NO_EXCEPTIONS in $(defines) )
{
CCFLAGS += -fno-exceptions ;
}
if ( $(OS) != MACOSX ) if ( $(OS) != MACOSX )
{ {
LDFLAGS += -static-libgcc -static ; LDFLAGS += -static-libgcc -static ;
} }
rule GetCFlags CONFIG : DEFINES
{
local RESULT = -D$(DEFINES) ;
RESULT += -W -Wall -Wextra -Werror -pedantic ;
if ( $(fulldebug) )
{
RESULT += -g ;
}
if ( $(CONFIG) = "debug" )
{
RESULT += -D_DEBUG ;
}
else
{
RESULT += -DNDEBUG -O3 ;
}
if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
{
RESULT += -fno-exceptions ;
}
return $(RESULT) ;
}
actions ObjectAction actions ObjectAction
{ {
"$(GCCPATH)gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS) "$(GCCPATH)gcc" -c $(>) -o $(<) $(CCFLAGS)
} }
actions LibraryAction actions LibraryAction
@ -46,68 +58,14 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{ {
"$(GCCPATH)g++" $(>) -o $(<) $(LDFLAGS) "$(GCCPATH)g++" $(>) -o $(<) $(LDFLAGS)
} }
actions maxtargets 1 CoverageAction
{
"$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl
}
} }
else if ( $(toolset:I=^msvc) ) else if ( $(toolset:I=^msvc) )
{ {
CCFLAGS += /D$(defines) ;
if ( $(fulldebug) ) if ( $(fulldebug) )
{ {
CCFLAGS += /Z7 ;
LDFLAGS += /DEBUG ; LDFLAGS += /DEBUG ;
} }
if ( $(configuration) = "debug" )
{
CCFLAGS += /D_DEBUG /MTd ;
}
else
{
CCFLAGS += /DNDEBUG /Ox /MT ;
}
if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
{
CCFLAGS += /Wp64 ; # Wp64 is deprecated from msvc9
}
if ( $(toolset) != msvc6 )
{
CCFLAGS += /W4 ;
}
else
{
CCFLAGS += /W3 ; # lots of warnings at W4 in standard library
}
if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
{
CCFLAGS += "/I\"%$(toolset)_PATH%\\PlatformSDK\\include\"" ;
}
else if ( $(toolset) != msvc6 )
{
CCFLAGS += "/I\"%WINSDK_PATH%\\Include\"" ;
}
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) )
{
CCFLAGS += /EHsc ;
}
else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" )
{
# No no-exception STL in MSVC6, buggy no-exception STL in MSVC71
CCFLAGS += /EHsc ;
}
else
{
CCFLAGS += /D_HAS_EXCEPTIONS=0 ;
}
if ( $(toolset:I=x64$) ) if ( $(toolset:I=x64$) )
{ {
postfix = "\\amd64" ; postfix = "\\amd64" ;
@ -120,9 +78,58 @@ else if ( $(toolset:I=^msvc) )
sdk_postfix = "" ; sdk_postfix = "" ;
} }
rule GetCFlags CONFIG : DEFINES
{
local RESULT = /D$(DEFINES) ;
if ( $(fulldebug) )
{
RESULT += /Z7 ;
}
if ( $(CONFIG) = "debug" )
{
RESULT += /D_DEBUG /MTd ;
}
else
{
RESULT += /DNDEBUG /Ox /MT ;
}
if ( $(toolset) = msvc7 || $(toolset) = msvc71 || $(toolset) = msvc8 )
{
RESULT += /Wp64 ; # Wp64 is deprecated from msvc9
}
if ( $(toolset) != msvc6 )
{
RESULT += /W4 ;
}
else
{
RESULT += /W3 ; # lots of warnings at W4 in standard library
}
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
{
RESULT += /EHsc ;
}
else if ( $(toolset) = "msvc6" || $(toolset) = "msvc71" )
{
# No no-exception STL in MSVC6, buggy no-exception STL in MSVC71
RESULT += /EHsc ;
}
else
{
RESULT += /D_HAS_EXCEPTIONS=0 ;
}
return $(RESULT) ;
}
actions ObjectAction actions ObjectAction
{ {
"%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS) "%$(toolset)_PATH%\bin$(postfix)\cl.exe" /WX /I"%$(toolset)_PATH%\include" /I"%$(toolset)_PATH%\PlatformSDK\include" /I"%WINSDK_PATH%\Include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
} }
actions LibraryAction actions LibraryAction
@ -134,10 +141,6 @@ else if ( $(toolset:I=^msvc) )
{ {
"%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) /PDB:$(<:S=.pdb) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib$(postfix)" /LIBPATH:"%WINSDK_PATH%\Lib$(sdk_postfix)" $(LDFLAGS) "%$(toolset)_PATH%\bin$(postfix)\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) /PDB:$(<:S=.pdb) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(toolset)_PATH%\PlatformSDK\lib$(postfix)" /LIBPATH:"%WINSDK_PATH%\Lib$(sdk_postfix)" $(LDFLAGS)
} }
actions CoverageAction
{
}
} }
else if ( $(toolset:I=^ic) ) else if ( $(toolset:I=^ic) )
{ {
@ -173,31 +176,38 @@ else if ( $(toolset:I=^ic) )
msvc_postfix = "" ; msvc_postfix = "" ;
} }
CCFLAGS += /D$(defines) ; rule GetCFlags CONFIG : DEFINES
{
local RESULT = /D$(DEFINES) ;
RESULT += /W3 /WX /Qvec_report0 ;
if ( $(toolset) != ic8 ) if ( $(toolset) != ic8 )
{ {
CCFLAGS += /fp:precise ; RESULT += /fp:precise ;
} }
if ( $(configuration) = "debug" ) if ( $(CONFIG) = "debug" )
{ {
CCFLAGS += /D_DEBUG /Od /MTd ; RESULT += /D_DEBUG /Od /MTd ;
} }
else else
{ {
CCFLAGS += /DNDEBUG /Ox /MT ; RESULT += /DNDEBUG /Ox /MT ;
} }
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
{ {
CCFLAGS += /EHsc ; RESULT += /EHsc ;
}
return $(RESULT) ;
} }
actions ObjectAction actions ObjectAction
{ {
set PATH=%$(msvc)_PATH%\bin set PATH=%$(msvc)_PATH%\bin
"%$(toolset)_PATH%\bin$(postfix)\icl.exe" /W3 /WX /Qvec_report0 /I"%$(msvc)_PATH%\include" /I"%$(msvc)_PATH%\PlatformSDK\Include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS) "%$(toolset)_PATH%\bin$(postfix)\icl.exe" /I"%$(msvc)_PATH%\include" /I"%$(msvc)_PATH%\PlatformSDK\Include" /I"%$(toolset)_PATH%\include" /c $(>) /Fo$(<) /nologo $(CCFLAGS)
} }
actions LibraryAction actions LibraryAction
@ -209,32 +219,35 @@ else if ( $(toolset:I=^ic) )
{ {
"%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(msvc)_PATH%\lib$(msvc_postfix)" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib$(msvc_postfix)" $(LDFLAGS) "%$(msvc)_PATH%\bin\link.exe" /SUBSYSTEM:CONSOLE /NOLOGO /OUT:$(<) $(>) /LIBPATH:"%$(toolset)_PATH%\lib$(postfix)" /LIBPATH:"%$(msvc)_PATH%\lib$(msvc_postfix)" /LIBPATH:"%$(msvc)_PATH%\PlatformSDK\lib$(msvc_postfix)" $(LDFLAGS)
} }
actions CoverageAction
{
}
} }
else if ( $(toolset:I=^dmc) ) else if ( $(toolset:I=^dmc) )
{ {
CCFLAGS += -D$(defines) ; rule GetCFlags CONFIG : DEFINES
if ( $(configuration) = "debug" )
{ {
CCFLAGS += -D_DEBUG ; local RESULT = -D$(DEFINES) ;
RESULT += -wx -f ;
if ( $(CONFIG) = "debug" )
{
RESULT += -D_DEBUG ;
} }
else else
{ {
CCFLAGS += -DNDEBUG ; RESULT += -DNDEBUG -o ;
} }
if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) )
{ {
CCFLAGS += -Ae ; RESULT += -Ae ;
}
return $(RESULT) ;
} }
actions ObjectAction actions ObjectAction
{ {
"%$(toolset)_PATH%\bin\dmc.exe" -c -f -I%$(toolset)_PATH%\stlport\stlport -wx $(>) -o$(<) $(CCFLAGS) "%$(toolset)_PATH%\bin\dmc.exe" -c -I%$(toolset)_PATH%\stlport\stlport $(>) -o$(<) $(CCFLAGS)
} }
actions LibraryAction actions LibraryAction
@ -246,33 +259,37 @@ else if ( $(toolset:I=^dmc) )
{ {
"%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) -L/co/ma "%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) -L/co/ma
} }
actions CoverageAction
{
}
} }
else if ( $(toolset:I=^cw) ) else if ( $(toolset:I=^cw) )
{ {
cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ; cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ;
CCFLAGS += -D$(defines) ;
if ( $(configuration) = "debug" ) rule GetCFlags CONFIG : DEFINES
{ {
CCFLAGS += -D_DEBUG ; local RESULT = -D$(DEFINES) ;
RESULT += -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted ;
if ( $(CONFIG) = "debug" )
{
RESULT += -D_DEBUG ;
} }
else else
{ {
CCFLAGS += -DNDEBUG -O4 ; RESULT += -DNDEBUG -O4 ;
} }
if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
{ {
CCFLAGS += -Cpp_exceptions off ; RESULT += -Cpp_exceptions off ;
}
return $(RESULT) ;
} }
actions ObjectAction actions ObjectAction
{ {
"$(cw_bin)\mwcc.exe" -c -cwd include -ansi strict -iso_templates on -msext off -w all,cmdline,iserror,nonotused,nonotinlined,noimplicitconv,nounwanted $(>) -o $(<) $(CCFLAGS) "$(cw_bin)\mwcc.exe" -c $(>) -o $(<) $(CCFLAGS)
} }
actions LibraryAction actions LibraryAction
@ -284,27 +301,30 @@ else if ( $(toolset:I=^cw) )
{ {
"$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS) "$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS)
} }
actions CoverageAction
{
}
} }
else if ( $(toolset:I=^bcc) ) else if ( $(toolset:I=^bcc) )
{ {
CCFLAGS += -D$(defines) ; rule GetCFlags CONFIG : DEFINES
if ( $(configuration) = "debug" )
{ {
CCFLAGS += -D_DEBUG ; local RESULT = -D$(DEFINES) ;
RESULT += -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 ;
if ( $(CONFIG) = "debug" )
{
RESULT += -D_DEBUG ;
} }
else else
{ {
CCFLAGS += -DNDEBUG -Ox ; RESULT += -DNDEBUG -Ox ;
}
return $(RESULT) ;
} }
actions ObjectAction actions ObjectAction
{ {
"%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 -o $(<) $(>) "%$(toolset)_PATH%\bin\bcc32.exe" $(CCFLAGS) -c -q -Q -o $(<) $(>)
} }
actions LibraryAction actions LibraryAction
@ -316,32 +336,35 @@ else if ( $(toolset:I=^bcc) )
{ {
"%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32 "%$(toolset)_PATH%\bin\ilink32.exe" -L"%$(toolset)_PATH%\lib" -Tpe -ap -Gn -x -c "%$(toolset)_PATH%\lib\c0x32.obj" $(>:\\) , $(<:\\) , , $(LDFLAGS:\\) cw32 import32
} }
actions CoverageAction
{
}
} }
else if ( $(toolset:I=^suncc) ) else if ( $(toolset:I=^suncc) )
{ {
CCFLAGS += -D$(defines) ; rule GetCFlags CONFIG : DEFINES
if ( $(configuration) = "debug" )
{ {
CCFLAGS += -D_DEBUG ; local RESULT = -D$(DEFINES) ;
RESULT += +w -xwe ;
if ( $(CONFIG) = "debug" )
{
RESULT += -D_DEBUG ;
} }
else else
{ {
CCFLAGS += -DNDEBUG -O ; RESULT += -DNDEBUG -O ;
} }
if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) )
{ {
CCFLAGS += -noex ; RESULT += -noex ;
}
return $(RESULT) ;
} }
actions ObjectAction actions ObjectAction
{ {
sunCC $(CCFLAGS) +w -xwe -c -o $(<) $(>) sunCC $(CCFLAGS) -c -o $(<) $(>)
} }
actions LibraryAction actions LibraryAction
@ -353,16 +376,30 @@ else if ( $(toolset:I=^suncc) )
{ {
sunCC $(>) -o $(<) $(LDFLAGS) sunCC $(>) -o $(<) $(LDFLAGS)
} }
actions CoverageAction
{
}
} }
else else
{ {
exit "Unknown toolset $(toolset)!" ; exit "Unknown toolset $(toolset)!" ;
} }
COVSUCCESS = "echo $" "(COVPREFIX) success" ;
if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) )
{
actions maxtargets 1 CoverageAction
{
@($(COVSUCCESS:J=):A)
"$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl $(COVPREFIX)$(SPACE)gcov
}
}
else
{
actions CoverageAction
{
@($(COVSUCCESS:J=):A)
}
}
if ( $(UNIX) ) if ( $(UNIX) )
{ {
actions screenoutput RunAction actions screenoutput RunAction
@ -413,17 +450,21 @@ rule Alias TARGET : SOURCE
Depends $(TARGET) : $(SOURCE) ; Depends $(TARGET) : $(SOURCE) ;
} }
rule Object TARGET : SOURCE rule Object TARGET : SOURCE : CCFLAGS
{ {
HDRRULE on $(SOURCE) = C.HdrRule ; HDRRULE on $(SOURCE) = C.HdrRule ;
HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ; HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ;
MakeFileDir $(TARGET) ; MakeFileDir $(TARGET) ;
ObjectAction $(TARGET) : $(SOURCE) ; ObjectAction $(TARGET) : $(SOURCE) ;
Depends $(TARGET) : $(SOURCE) ; Depends $(TARGET) : $(SOURCE) ;
CCFLAGS on $(TARGET) = $(CCFLAGS) ;
UseCommandLine $(TARGET) : $(CCFLAGS) ;
} }
rule Objects SOURCES rule Objects BUILD : SOURCES : CCFLAGS
{ {
local OBJECTS ; local OBJECTS ;
@ -431,56 +472,40 @@ rule Objects SOURCES
{ {
local OBJECT = $(BUILD)/$(SOURCE:S=.o) ; local OBJECT = $(BUILD)/$(SOURCE:S=.o) ;
Object $(OBJECT) : $(SOURCE) ; Object $(OBJECT) : $(SOURCE) : $(CCFLAGS) ;
OBJECTS += $(OBJECT) ; OBJECTS += $(OBJECT) ;
} }
return $(OBJECTS) ; return $(OBJECTS) ;
} }
rule Library TARGET : SOURCES rule Library TARGET : SOURCES : CCFLAGS
{ {
# build object files # build object files
local OBJECTS = [ Objects $(SOURCES) ] ; local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ;
# build library # build library
local LIBRARY = $(BUILD)/$(TARGET).a ; MakeFileDir $(TARGET) ;
LibraryAction $(TARGET) : $(OBJECTS) ;
MakeFileDir $(LIBRARY) ; Depends $(TARGET) : $(OBJECTS) ;
LibraryAction $(LIBRARY) : $(OBJECTS) ;
Depends $(LIBRARY) : $(OBJECTS) ;
# make alias
Alias $(TARGET) : $(LIBRARY) ;
# remember library path for linking
$(TARGET)_path = $(LIBRARY) ;
# remember library objects for coverage # remember library objects for coverage
$(TARGET)_objects = $(OBJECTS) ; $(TARGET)_objects = $(OBJECTS) ;
} }
rule Application TARGET : SOURCES : LIBRARIES rule Application TARGET : SOURCES : CCFLAGS : LIBRARIES
{ {
# build object files # build object files
local OBJECTS = [ Objects $(SOURCES) ] ; local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ;
# get binary path
local EXECUTABLE = $(BUILD)/$(TARGET).exe ;
# set libraries # set libraries
LDFLAGS on $(EXECUTABLE) = $(LDFLAGS) $($(LIBRARIES)_path) ; LDFLAGS on $(TARGET) = $(LDFLAGS) $(LIBRARIES) ;
# build application # build application
MakeFileDir $(EXECUTABLE) ; MakeFileDir $(TARGET) ;
LinkAction $(EXECUTABLE) : $(OBJECTS) ;
Depends $(EXECUTABLE) : $(OBJECTS) $($(LIBRARIES)_path) ;
# make alias LinkAction $(TARGET) : $(OBJECTS) ;
Alias $(TARGET) : $(EXECUTABLE) ; Depends $(TARGET) : $(OBJECTS) $(LIBRARIES) ;
# remember executable path for running
$(TARGET)_path = $(EXECUTABLE) ;
# remember executable objects for coverage # remember executable objects for coverage
$(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ; $(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ;
@ -510,7 +535,7 @@ rule Test TARGET : SOURCE
Alias $(TARGET) : $(SOURCE) ; Alias $(TARGET) : $(SOURCE) ;
# run tests # run tests
RunAction $(TARGET) : $($(SOURCE)_path) ; RunAction $(TARGET) : $(SOURCE) ;
# remember executable objects for coverage # remember executable objects for coverage
$(TARGET)_objects = $($(SOURCE)_objects) ; $(TARGET)_objects = $($(SOURCE)_objects) ;

View File

@ -27,10 +27,12 @@ $fast = (shift eq 'fast');
@toolsets = ($^O =~ /MSWin/) ? (bcc, cw, dmc, ic8, ic9, ic9_x64, ic10, ic10_x64, ic11, ic11_x64, mingw34, mingw44, mingw45, mingw46_x64, msvc6, msvc7, msvc71, msvc8, msvc8_x64, msvc9, msvc9_x64, msvc10, msvc10_x64) : ($^O =~ /solaris/) ? (suncc) : (&gcctoolset()); @toolsets = ($^O =~ /MSWin/) ? (bcc, cw, dmc, ic8, ic9, ic9_x64, ic10, ic10_x64, ic11, ic11_x64, mingw34, mingw44, mingw45, mingw46_x64, msvc6, msvc7, msvc71, msvc8, msvc8_x64, msvc9, msvc9_x64, msvc10, msvc10_x64) : ($^O =~ /solaris/) ? (suncc) : (&gcctoolset());
@configurations = (debug, release); @configurations = (debug, release);
@defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE); @defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE);
$stddefine = 'PUGIXML_STANDARD';
if ($fast) if ($fast)
{ {
@defines = (PUGIXML_WCHAR_MODE); @defines = (PUGIXML_WCHAR_MODE);
@configurations = (debug);
} }
@definesets = permute(@defines); @definesets = permute(@defines);
@ -41,35 +43,69 @@ print "### autotest begin " . scalar localtime() . "\n";
foreach $toolset (@toolsets) foreach $toolset (@toolsets)
{ {
foreach $configuration (@configurations) my $cmdline = "jam toolset=$toolset";
{
# add configurations
$cmdline .= " configuration=" . join(',', @configurations);
# add definesets
$cmdline .= " defines=$stddefine";
foreach $defineset (@definesets) foreach $defineset (@definesets)
{ {
if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_EXCEPTIONS/) { next; } if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_EXCEPTIONS/) { next; }
if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_STL/) { next; } if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_STL/) { next; }
print STDERR "*** testing $toolset/$configuration ($defineset) ... ***\n"; $cmdline .= ";$defineset" if ($defineset ne '');
# launch command # any configuration with prepare but without result is treated as failed
my $cmdline = "jam toolset=$toolset configuration=$configuration defines=$defineset"; foreach $configuration (@configurations)
{
print "### autotest launch $cmdline\n"; print "### autotest $Config{archname} $toolset $configuration [$defineset] prepare\n";
}
my $coverage = `$cmdline coverage`;
my $result = $? >> 8;
# print build output
print $coverage;
# parse coverage
my $coverage_pugixml = $1 if ($coverage =~ /pugixml\.cpp' executed:([^%]+)%/);
my $coverage_pugixpath = $1 if ($coverage =~ /pugixpath\.cpp' executed:([^%]+)%/);
# print build report
print "### autotest $Config{archname} $toolset $configuration [$defineset] result $result $coverage_pugixml $coverage_pugixpath\n";
} }
last if ($fast); print STDERR "*** testing $toolset... ***\n";
# launch command
print "### autotest launch $cmdline\n";
my $coverage = `$cmdline autotest=on coverage`;
# parse build output
foreach (split /\n/, $coverage)
{
### autotest release [wchar] success
if (/^### autotest (\S+) \[(.*?)\] success/)
{
my $configuration = $1;
my $defineset = ($2 eq $stddefine) ? '' : $2;
print "### autotest $Config{archname} $toolset $configuration [$defineset] success\n";
}
### autotest release [wchar] gcov
elsif (/^### autotest (\S+) \[(.*?)\] gcov/)
{
my $configuration = $1;
my $defineset = ($2 eq $stddefine) ? '' : $2;
my $file;
$file = "pugixml $1" if (/pugixml\.cpp' executed:([^%]+)%/);
$file = "pugixpath $1" if (/pugixpath\.cpp' executed:([^%]+)%/);
if (defined($file))
{
print "### autotest $Config{archname} $toolset $configuration [$defineset] coverage $file\n";
}
else
{
print "$_\n";
}
}
else
{
print "$_\n";
}
} }
} }

View File

@ -58,18 +58,29 @@ sub insertindex
while (<>) while (<>)
{ {
### autotest i386-freebsd-64int gcc release [wchar] result 0 97.78 98.85 ### autotest i386-freebsd-64int gcc release [wchar] result 0 97.78 98.85
if (/^### autotest (\S+) (\S+) (\S+) \[(.*?)\] result (\S+) (\S*) (\S*)/) if (/^### autotest (\S+) (\S+) (\S+) \[(.*?)\] (.*)/)
{ {
my ($platform, $toolset, $configuration, $defineset, $result, $coverage_pugixml, $coverage_pugixpath) = ($1, $2, $3, $4, $5, $6, $7); my ($platform, $toolset, $configuration, $defineset, $info) = ($1, $2, $3, $4, $5);
die "Detected duplicate build information $_\n" if defined $results{"$toolset $platform"}{$configuration}{$defineset};
my $fulltool = &prettyplatform($platform) . ' ' . &prettytoolset($toolset); my $fulltool = &prettyplatform($platform) . ' ' . &prettytoolset($toolset);
my $fullconf = "$configuration $defineset"; my $fullconf = "$configuration $defineset";
$results{$fulltool}{$fullconf}{result} = $result; if ($info =~ /^prepare/)
$results{$fulltool}{$fullconf}{coverage_pugixml} = $coverage_pugixml; {
$results{$fulltool}{$fullconf}{coverage_pugixpath} = $coverage_pugixpath; $results{$fulltool}{$fullconf}{result} = 1;
}
elsif ($info =~ /^success/)
{
$results{$fulltool}{$fullconf}{result} = 0;
}
elsif ($info =~ /^coverage (\S+) (\S+)/)
{
$results{$fulltool}{$fullconf}{"coverage_$1"} = $2;
}
else
{
print STDERR "Unrecognized autotest infoline $_";
}
&insertindex(\%toolsets, $fulltool); &insertindex(\%toolsets, $fulltool);

View File

@ -1,7 +1,13 @@
#!/usr/bin/perl #!/usr/bin/perl
$lines = join('', <>); $prefix = join(' ', @ARGV);
$prefix .= ' ' if ($prefix ne '');
$lines = join('', <STDIN>);
$lines =~ s/File (.+)\nLines (.+)\n(.+\n)*\n/$1 $2\n/g; $lines =~ s/File (.+)\nLines (.+)\n(.+\n)*\n/$1 $2\n/g;
$lines =~ s/.+include\/c\+\+.+\n//g; $lines =~ s/.+include\/c\+\+.+\n//g;
print $lines; foreach $line (split /\n/, $lines)
{
print "$prefix$line\n";
}