summaryrefslogtreecommitdiff
path: root/tests/autotest-local.pl
blob: 261852adab87ddbc5e1315b2691b4f51ad9dc82a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/perl

use Config;

sub permute
{
	my @defines = @_;
	my @result = ('');
	
	foreach $define (@defines)
	{
		push @result, map { length($_) == 0 ? $define : "$_,$define" } @result;
	}

	@result;
}

sub gcctoolset
{
	my $gccversion = `gcc -dumpversion`;
	chomp($gccversion);

	return "gcc$gccversion";
}

$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);

print "### autotest begin " . scalar localtime() . "\n";

%results = ();

foreach $toolset (@toolsets)
{
	my $cmdline = "jam";

	# parallel build on non-windows platforms (since jam can't detect processor count)
	$cmdline .= " -j6" if ($^O !~ /MSWin/);
	
	# add toolset
	$cmdline .= " toolset=$toolset";

	# add configurations
	$cmdline .= " configuration=" . join(',', @configurations);

	# add definesets
	$cmdline .= " defines=$stddefine";

	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)
		{
			print "### autotest $Config{archname} $toolset $configuration [$defineset] prepare\n";
		}
	}

	print STDERR "*** testing $toolset... ***\n";

	# launch command
	print "### autotest launch $cmdline\n";

	open PIPE, "$cmdline autotest=on coverage |" || die "$cmdline failed: $!\n";

	# parse build output
	while (<PIPE>)
	{
		### 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;
			}
		}
		else
		{
			print;
		}
	}

	close PIPE;
}

print "### autotest end " . scalar localtime() . "\n";