From f542c5ebb8068ccd4f9176684eb62183afbe7e5c Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Thu, 6 May 2010 20:28:36 +0000 Subject: Integrated changes from unicode branch to trunk git-svn-id: http://pugixml.googlecode.com/svn/trunk@383 99668b35-9821-0410-8761-19e4c4f06640 --- tests/autotest.pl | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 tests/autotest.pl (limited to 'tests/autotest.pl') diff --git a/tests/autotest.pl b/tests/autotest.pl new file mode 100644 index 0000000..683d4c3 --- /dev/null +++ b/tests/autotest.pl @@ -0,0 +1,141 @@ +#!/usr/bin/perl + +sub permute +{ + my @defines = @_; + my @result = (''); + + foreach $define (@defines) + { + push @result, map { length($_) == 0 ? $define : "$_,$define" } @result; + } + + @result; +} + +$fast = (shift eq 'fast'); +@toolsets = ($^O =~ /win/i) ? (bcc, cw, dmc, ic8, mingw34, mingw44, mingw45, msvc6, msvc7, msvc71, msvc8, msvc9, msvc9_x64, msvc10) : (gcc); +@configurations = (debug, release); +@defines = (PUGIXML_NO_XPATH, PUGIXML_NO_EXCEPTIONS, PUGIXML_NO_STL, PUGIXML_WCHAR_MODE); +@definesabbr = (noxpath, noexcept, nostl, wchar); + +if ($fast) +{ + @defines = (PUGIXML_WCHAR_MODE); + @definesabbr = (wchar); +} + +@definesets = permute(@defines); + +$fail = 0; + +system("echo ### autotest begin >autotest.log"); + +%results = (); + +foreach $toolset (@toolsets) +{ + foreach $configuration (@configurations) + { + foreach $defineset (@definesets) + { + $defineabbr = $defineset; + $defineabbr =~ s/,/ /g; + + for ($i = 0; $i < $#definesabbr + 1; ++$i) + { + $defineabbr =~ s/$defines[$i]/$definesabbr[$i]/; + } + + if ($defineabbr !~ /noxpath/ && $defineabbr =~ /noexcept/) { next; } + if ($defineabbr !~ /noxpath/ && $defineabbr =~ /nostl/) { next; } + + print "*** testing $toolset/$configuration ($defineabbr) ... ***\n"; + + my $cmdline = "jam toolset=$toolset configuration=$configuration defines=$defineset"; + my $coverage_pugixml = 0; + my $coverage_pugixpath = 0; + + system("echo ^# $cmdline run_tests >>autotest.log"); + $result = system("$cmdline run_tests >>autotest.log"); + + # get coverage + if ($result == 0 && $toolset =~ /mingw|gcc/) + { + $coverage = `$cmdline coverage`; + + $coverage_pugixml = $1 if ($coverage =~ /pugixml\.cpp' executed:([^%]+)%/); + $coverage_pugixpath = $1 if ($coverage =~ /pugixpath\.cpp' executed:([^%]+)%/); + } + + # record failures + $fail = 1 if ($result != 0); + + # print build report + my $report = ""; + + if ($result == 0) + { + my $align = ($coverage_pugixml > 0 || $coverage_pugixpath > 0) ? 'left' : 'center'; + + $report .= "passed"; + + if ($coverage_pugixml > 0 || $coverage_pugixpath > 0) + { + $report .= " $coverage_pugixml% / $coverage_pugixpath%"; + } + + $report .= "" + + } + else + { + $report .= "failed" + } + + $results{"$configuration $defineabbr"}{$toolset} = $report; + } + + last if ($fast); + } +} + +system("echo ### autotest end >>autotest.log"); + +$date = scalar localtime; + +$report = <pugixml autotest report +

pugixml autotest report

+ + +END + +foreach $toolset (@toolsets) +{ + $report .= ""; +} + +$report .= "\n"; + +foreach $k (sort {$a cmp $b} keys %results) +{ + $report .= ""; + + foreach $toolset (@toolsets) + { + $report .= $results{$k}{$toolset}; + } + + $report .= "\n"; +} + +$report .= <
+Generated on $date + +END + +open FILE, ">autotest.html"; +print FILE $report; +close FILE; -- cgit v1.2.3
$toolset
$k