From c622ce6fed61e07125c7d764f84fc70bb73c6c78 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 2 Jun 2010 06:25:40 +0000 Subject: 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 --- Jamfile.jam | 78 ++++++--- Jamrules.jam | 399 +++++++++++++++++++++++++---------------------- tests/autotest-local.pl | 78 ++++++--- tests/autotest-report.pl | 25 ++- tests/gcov-filter.pl | 10 +- 5 files changed, 352 insertions(+), 238 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 ; + } +} diff --git a/Jamrules.jam b/Jamrules.jam index 9ceb265..ab99e13 100644 --- a/Jamrules.jam +++ b/Jamrules.jam @@ -11,30 +11,42 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) GCCPATH = "%$(toolset)_PATH%\\bin\\" ; } - CCFLAGS += -D$(defines) ; - - if ( $(configuration) = "debug" ) - { - CCFLAGS += -D_DEBUG ; - } - else + if ( $(OS) != MACOSX ) { - CCFLAGS += -DNDEBUG -O3 ; + LDFLAGS += -static-libgcc -static ; } - if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += -fno-exceptions ; - } + local RESULT = -D$(DEFINES) ; - if ( $(OS) != MACOSX ) - { - LDFLAGS += -static-libgcc -static ; + 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 { - "$(GCCPATH)gcc" -W -Wall -Wextra -Werror -pedantic -c $(>) -o $(<) $(CCFLAGS) + "$(GCCPATH)gcc" -c $(>) -o $(<) $(CCFLAGS) } actions LibraryAction @@ -46,68 +58,14 @@ if ( $(toolset:I=^mingw) || $(toolset:I=^gcc) ) { "$(GCCPATH)g++" $(>) -o $(<) $(LDFLAGS) } - - actions maxtargets 1 CoverageAction - { - "$(GCCPATH)gcov" $(>) $(GCOVFLAGS) | perl tests/gcov-filter.pl - } } else if ( $(toolset:I=^msvc) ) { - CCFLAGS += /D$(defines) ; - if ( $(fulldebug) ) { - CCFLAGS += /Z7 ; 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$) ) { postfix = "\\amd64" ; @@ -120,9 +78,58 @@ else if ( $(toolset:I=^msvc) ) 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 { - "%$(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 @@ -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) } - - actions CoverageAction - { - } } else if ( $(toolset:I=^ic) ) { @@ -173,31 +176,38 @@ else if ( $(toolset:I=^ic) ) msvc_postfix = "" ; } - CCFLAGS += /D$(defines) ; - - if ( $(toolset) != ic8 ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += /fp:precise ; - } + local RESULT = /D$(DEFINES) ; - if ( $(configuration) = "debug" ) - { - CCFLAGS += /D_DEBUG /Od /MTd ; - } - else - { - CCFLAGS += /DNDEBUG /Ox /MT ; - } + RESULT += /W3 /WX /Qvec_report0 ; - if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) - { - CCFLAGS += /EHsc ; + if ( $(toolset) != ic8 ) + { + RESULT += /fp:precise ; + } + + if ( $(CONFIG) = "debug" ) + { + RESULT += /D_DEBUG /Od /MTd ; + } + else + { + RESULT += /DNDEBUG /Ox /MT ; + } + + if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) + { + RESULT += /EHsc ; + } + + return $(RESULT) ; } actions ObjectAction { 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 @@ -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) } - - actions CoverageAction - { - } } else if ( $(toolset:I=^dmc) ) { - CCFLAGS += -D$(defines) ; - - if ( $(configuration) = "debug" ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += -D_DEBUG ; - } - else - { - CCFLAGS += -DNDEBUG ; - } + local RESULT = -D$(DEFINES) ; - if ( ! ( PUGIXML_NO_EXCEPTIONS in $(defines) ) ) - { - CCFLAGS += -Ae ; + RESULT += -wx -f ; + + if ( $(CONFIG) = "debug" ) + { + RESULT += -D_DEBUG ; + } + else + { + RESULT += -DNDEBUG -o ; + } + + if ( ! ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) ) + { + RESULT += -Ae ; + } + + return $(RESULT) ; } 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 @@ -246,33 +259,37 @@ else if ( $(toolset:I=^dmc) ) { "%$(toolset)_PATH%\bin\link.exe" $(>:\\) , $(<:\\) , nul , $(LDFLAGS:\\) -L/co/ma } - - actions CoverageAction - { - } } else if ( $(toolset:I=^cw) ) { cw_bin = "%$(toolset)_PATH%\\Other Metrowerks Tools\\Command Line Tools" ; - CCFLAGS += -D$(defines) ; - if ( $(configuration) = "debug" ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += -D_DEBUG ; - } - else - { - CCFLAGS += -DNDEBUG -O4 ; - } + local RESULT = -D$(DEFINES) ; - if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) - { - CCFLAGS += -Cpp_exceptions off ; + 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 + { + RESULT += -DNDEBUG -O4 ; + } + + if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) + { + RESULT += -Cpp_exceptions off ; + } + + return $(RESULT) ; } 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 @@ -284,27 +301,30 @@ else if ( $(toolset:I=^cw) ) { "$(cw_bin)\mwld.exe" -subsystem console -o $(<) $(>) $(LDFLAGS) } - - actions CoverageAction - { - } } else if ( $(toolset:I=^bcc) ) { - CCFLAGS += -D$(defines) ; - - if ( $(configuration) = "debug" ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += -D_DEBUG ; - } - else - { - CCFLAGS += -DNDEBUG -Ox ; + local RESULT = -D$(DEFINES) ; + + RESULT += -fp -w -w! -w-8026 -w-8027 -w-8091 -w-8004 ; + + if ( $(CONFIG) = "debug" ) + { + RESULT += -D_DEBUG ; + } + else + { + RESULT += -DNDEBUG -Ox ; + } + + return $(RESULT) ; } 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 @@ -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 } - - actions CoverageAction - { - } } else if ( $(toolset:I=^suncc) ) { - CCFLAGS += -D$(defines) ; - - if ( $(configuration) = "debug" ) + rule GetCFlags CONFIG : DEFINES { - CCFLAGS += -D_DEBUG ; - } - else - { - CCFLAGS += -DNDEBUG -O ; - } + local RESULT = -D$(DEFINES) ; - if ( PUGIXML_NO_EXCEPTIONS in $(defines) ) - { - CCFLAGS += -noex ; + RESULT += +w -xwe ; + + if ( $(CONFIG) = "debug" ) + { + RESULT += -D_DEBUG ; + } + else + { + RESULT += -DNDEBUG -O ; + } + + if ( PUGIXML_NO_EXCEPTIONS in $(DEFINES) ) + { + RESULT += -noex ; + } + + return $(RESULT) ; } actions ObjectAction { - sunCC $(CCFLAGS) +w -xwe -c -o $(<) $(>) + sunCC $(CCFLAGS) -c -o $(<) $(>) } actions LibraryAction @@ -353,14 +376,28 @@ else if ( $(toolset:I=^suncc) ) { sunCC $(>) -o $(<) $(LDFLAGS) } +} +else +{ + exit "Unknown toolset $(toolset)!" ; +} - actions CoverageAction +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 { - exit "Unknown toolset $(toolset)!" ; + actions CoverageAction + { + @($(COVSUCCESS:J=):A) + } } if ( $(UNIX) ) @@ -413,17 +450,21 @@ rule Alias TARGET : SOURCE Depends $(TARGET) : $(SOURCE) ; } -rule Object TARGET : SOURCE +rule Object TARGET : SOURCE : CCFLAGS { HDRRULE on $(SOURCE) = C.HdrRule ; HDRSCAN on $(SOURCE) = $(C.HDRPATTERN) ; MakeFileDir $(TARGET) ; + ObjectAction $(TARGET) : $(SOURCE) ; Depends $(TARGET) : $(SOURCE) ; + + CCFLAGS on $(TARGET) = $(CCFLAGS) ; + UseCommandLine $(TARGET) : $(CCFLAGS) ; } -rule Objects SOURCES +rule Objects BUILD : SOURCES : CCFLAGS { local OBJECTS ; @@ -431,56 +472,40 @@ rule Objects SOURCES { local OBJECT = $(BUILD)/$(SOURCE:S=.o) ; - Object $(OBJECT) : $(SOURCE) ; + Object $(OBJECT) : $(SOURCE) : $(CCFLAGS) ; OBJECTS += $(OBJECT) ; } return $(OBJECTS) ; } -rule Library TARGET : SOURCES +rule Library TARGET : SOURCES : CCFLAGS { # build object files - local OBJECTS = [ Objects $(SOURCES) ] ; + local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ; # build library - local LIBRARY = $(BUILD)/$(TARGET).a ; - - MakeFileDir $(LIBRARY) ; - LibraryAction $(LIBRARY) : $(OBJECTS) ; - Depends $(LIBRARY) : $(OBJECTS) ; - - # make alias - Alias $(TARGET) : $(LIBRARY) ; - - # remember library path for linking - $(TARGET)_path = $(LIBRARY) ; + MakeFileDir $(TARGET) ; + LibraryAction $(TARGET) : $(OBJECTS) ; + Depends $(TARGET) : $(OBJECTS) ; # remember library objects for coverage $(TARGET)_objects = $(OBJECTS) ; } -rule Application TARGET : SOURCES : LIBRARIES +rule Application TARGET : SOURCES : CCFLAGS : LIBRARIES { # build object files - local OBJECTS = [ Objects $(SOURCES) ] ; - - # get binary path - local EXECUTABLE = $(BUILD)/$(TARGET).exe ; + local OBJECTS = [ Objects $(TARGET:D) : $(SOURCES) : $(CCFLAGS) ] ; # set libraries - LDFLAGS on $(EXECUTABLE) = $(LDFLAGS) $($(LIBRARIES)_path) ; + LDFLAGS on $(TARGET) = $(LDFLAGS) $(LIBRARIES) ; # build application - MakeFileDir $(EXECUTABLE) ; - LinkAction $(EXECUTABLE) : $(OBJECTS) ; - Depends $(EXECUTABLE) : $(OBJECTS) $($(LIBRARIES)_path) ; - - # make alias - Alias $(TARGET) : $(EXECUTABLE) ; + MakeFileDir $(TARGET) ; - # remember executable path for running - $(TARGET)_path = $(EXECUTABLE) ; + LinkAction $(TARGET) : $(OBJECTS) ; + Depends $(TARGET) : $(OBJECTS) $(LIBRARIES) ; # remember executable objects for coverage $(TARGET)_objects = $(OBJECTS) $($(LIBRARIES)_objects) ; @@ -510,7 +535,7 @@ rule Test TARGET : SOURCE Alias $(TARGET) : $(SOURCE) ; # run tests - RunAction $(TARGET) : $($(SOURCE)_path) ; + RunAction $(TARGET) : $(SOURCE) ; # remember executable objects for coverage $(TARGET)_objects = $($(SOURCE)_objects) ; diff --git a/tests/autotest-local.pl b/tests/autotest-local.pl index 736c045..469221a 100644 --- a/tests/autotest-local.pl +++ b/tests/autotest-local.pl @@ -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()); @configurations = (debug, release); @defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE); +$stddefine = 'PUGIXML_STANDARD'; if ($fast) { @defines = (PUGIXML_WCHAR_MODE); + @configurations = (debug); } @definesets = permute(@defines); @@ -41,35 +43,69 @@ print "### autotest begin " . scalar localtime() . "\n"; 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_STL/) { next; } + + $cmdline .= ";$defineset" if ($defineset ne ''); + + # any configuration with prepare but without result is treated as failed + foreach $configuration (@configurations) { - if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_EXCEPTIONS/) { next; } - if ($defineset !~ /NO_XPATH/ && $defineset =~ /NO_STL/) { next; } + print "### autotest $Config{archname} $toolset $configuration [$defineset] prepare\n"; + } + } - print STDERR "*** testing $toolset/$configuration ($defineset) ... ***\n"; + print STDERR "*** testing $toolset... ***\n"; - # launch command - my $cmdline = "jam toolset=$toolset configuration=$configuration defines=$defineset"; - - print "### autotest launch $cmdline\n"; + # launch command + print "### autotest launch $cmdline\n"; - my $coverage = `$cmdline coverage`; - my $result = $? >> 8; + my $coverage = `$cmdline autotest=on coverage`; - # print build output - print $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; - # 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"; + 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"; } - - last if ($fast); } } diff --git a/tests/autotest-report.pl b/tests/autotest-report.pl index 71c840d..47fed38 100644 --- a/tests/autotest-report.pl +++ b/tests/autotest-report.pl @@ -58,18 +58,29 @@ sub insertindex while (<>) { ### 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); - - die "Detected duplicate build information $_\n" if defined $results{"$toolset $platform"}{$configuration}{$defineset}; + my ($platform, $toolset, $configuration, $defineset, $info) = ($1, $2, $3, $4, $5); my $fulltool = &prettyplatform($platform) . ' ' . &prettytoolset($toolset); my $fullconf = "$configuration $defineset"; - $results{$fulltool}{$fullconf}{result} = $result; - $results{$fulltool}{$fullconf}{coverage_pugixml} = $coverage_pugixml; - $results{$fulltool}{$fullconf}{coverage_pugixpath} = $coverage_pugixpath; + if ($info =~ /^prepare/) + { + $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); diff --git a/tests/gcov-filter.pl b/tests/gcov-filter.pl index 8a581d0..8cbccc5 100644 --- a/tests/gcov-filter.pl +++ b/tests/gcov-filter.pl @@ -1,7 +1,13 @@ #!/usr/bin/perl -$lines = join('', <>); +$prefix = join(' ', @ARGV); +$prefix .= ' ' if ($prefix ne ''); + +$lines = join('', ); $lines =~ s/File (.+)\nLines (.+)\n(.+\n)*\n/$1 $2\n/g; $lines =~ s/.+include\/c\+\+.+\n//g; -print $lines; +foreach $line (split /\n/, $lines) +{ + print "$prefix$line\n"; +} -- cgit v1.2.3