Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
- corrected test on -map
[simgrid.git] / checkall
1 #! /usr/bin/perl
2
3 use strict;
4 $ENV{LC_ALL} = "C"; # avoid NLS nuisance
5
6 my @fail;
7 my @xfail;
8 my @pass;
9 my @xpass;
10 my @skip;
11
12 my $dir;
13
14 if (-e "CMakeLists.txt") { # launched from dart
15     chdir "..";
16 }
17
18 open LOG,(">checkall.log") || die "Cannot open log file: $!";
19
20 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
21 print LOG "Build started on $hour:$min:$sec $mon/$mday/$year\n";
22 print LOG "Current svn version is: ".qx(svnversion)."\n\n";
23
24 print LOG "\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n";
25 print LOG "XXX Include config.log since it contains valuable information XXX\n";
26 print LOG "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n";
27 open CFG,"<config.log" || die "Cannot open config.log: $!*";
28 while (<CFG>) {
29     print LOG "$_";
30 }
31 close CFG;
32
33 print LOG "\nXXXXXXXXXXXXXXXX\n";
34 print LOG "XXX Run make XXX\n";
35 print LOG "XXXXXXXXXXXXXXXX\n";
36 open MAKE,("make 2>&1 |") || die "Cannot fork a make: $!";
37 while (<MAKE>) {
38     print     $_;
39     print LOG $_;
40 }
41 if (!close MAKE) {
42     my $str = "# The source don't compile! Go fix it before running make check #";
43     my $dashes = $str;
44     $dashes =~ s/./#/g;
45     print LOG "\n$dashes\n$str\n$dashes\n\n";
46     print     "\n$dashes\n$str\n$dashes\n\n";
47     close LOG;
48     exit 1;
49 }
50     
51 print LOG "\nXXXXXXXXXXXXXXXXXXXXXX\n";
52 print LOG "XXX Run make check XXX\n";
53 print LOG "XXXXXXXXXXXXXXXXXXXXXX\n";
54 open CHECK,("make -k check 2>&1 |") || die "Cannot fork a make check: $!";
55 while (<CHECK>) {
56     print     $_;
57     print LOG $_;
58     chomp;
59     if (/Entering directory .([^']*)'/) { #})){
60       $dir = $1;
61       $dir =~ s|$ENV{PWD}/||;
62     }
63     push @pass, "$dir/$1"   if (/^PASS: (.*)$/);
64     push @xpass,"$dir/$1"   if (/^XPASS: (.*)$/);  
65     push @fail, "$dir/$1"   if (/^FAIL: (.*)$/);
66     push @xfail,"$dir/$1"   if (/^XFAIL: (.*)$/);   
67     push @skip, "$dir/$1"   if (/^SKIP: (.*)$/);
68 }
69 close CHECK;
70
71 my $all = scalar @fail + scalar @xfail + scalar @pass + scalar @xpass + scalar @skip;
72 my $banner;
73
74 if (scalar @fail == 0) {
75     if (scalar @xfail == 0) {
76         $banner="All $all tests passed. Congratulation.";
77     } else {
78         $banner="All $all tests behaved as expected (".(scalar @xfail)." expected failures)";
79     }
80 } elsif (scalar @xpass == 0) {
81     $banner=(scalar @fail)." of $all tests failed"; 
82 } else {
83     $banner=(scalar @fail+scalar @xpass)." of $all tests did not behave as expected (".(scalar @xpass)." unexpected passes)"; 
84 }
85 $banner = "# $banner #";
86 my $dashes = $banner;
87 $dashes =~ s/./X/g;
88 print LOG "\n$dashes\n$banner\n$dashes\n\n";
89 print     "\n$dashes\n$banner (full logs in checkall.log)\n$dashes\n\n";
90
91 if (scalar @skip) {
92     print LOG "* ".(scalar @skip)." skipped tests:\n";
93     print     "* ".(scalar @skip)." skipped tests:\n";
94     map {print "  $_\n";print LOG "  $_\n"} @skip;
95 }
96 if (scalar @xpass) {
97     print LOG "* ".(scalar @xpass)." unexpected pass:\n";
98     print     "* ".(scalar @xpass)." unexpected pass:\n";
99     map {print "  $_\n";print LOG "  $_\n"} @xpass;
100 }
101 if (scalar @xfail) {
102     print LOG "* ".(scalar @xfail)." expected failures:\n";
103     print     "* ".(scalar @xfail)." expected failures:\n";
104     map {print "  $_\n";print LOG "  $_\n"} @xfail;
105 }
106 if (scalar @fail) {
107     print LOG "* ".(scalar @fail)." failed tests:\n";
108     print     "* ".(scalar @fail)." failed tests:\n";
109     map {print "  $_\n";print LOG "  $_\n"} @fail;
110 }
111
112 exit scalar @fail == 0;