Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix use of verbatim sections
[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 open LOG,(">checkall.log") || die "Cannot open log file: $!";
15
16 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
17 print LOG "Build started on $hour:$min:$sec $mon/$mday/$year\n\n";
18 open MAKE,("make |") || die "Cannot fork a make: $!";
19 while (<MAKE>) {
20     print     $_;
21     print LOG $_;
22 }
23 if (!close MAKE) {
24     my $str = "# The source don't compile! Go fix it before running make check #";
25     my $dashes = $str;
26     $dashes =~ s/./#/g;
27     print LOG "\n$dashes\n$str\n$dashes\n\n";
28     print     "\n$dashes\n$str\n$dashes\n\n";
29     close LOG;
30     exit 1;
31 }
32     
33 open CHECK,("make -k check|") || die "Cannot fork a make check: $!";
34 while (<CHECK>) {
35     print     $_;
36     print LOG $_;
37     chomp;
38     if (/Entering directory .([^']*)'/) { #})){
39       $dir = $1;
40       $dir =~ s|$ENV{PWD}/||;
41     }
42     push @pass, "$dir/$1"   if (/^PASS: (.*)$/);
43     push @xpass,"$dir/$1"   if (/^XPASS: (.*)$/);  
44     push @fail, "$dir/$1"   if (/^FAIL: (.*)$/);
45     push @xfail,"$dir/$1"   if (/^XFAIL: (.*)$/);   
46     push @skip, "$dir/$1"   if (/^SKIP: (.*)$/);
47 }
48 close CHECK;
49
50 my $all = scalar @fail + scalar @xfail + scalar @pass + scalar @xpass + scalar @skip;
51 my $banner;
52
53 if (scalar @fail == 0) {
54     if (scalar @xfail == 0) {
55         $banner="All $all tests passed. Congratulation.";
56     } else {
57         $banner="All $all tests behaved as expected (".(scalar @xfail)." expected failures)";
58     }
59 } elsif (scalar @xpass == 0) {
60     $banner=(scalar @fail)." of $all tests failed"; 
61 } else {
62     $banner=(scalar @fail+scalar @xpass)." of $all tests did not behave as expected (".(scalar @xpass)." unexpected passes)"; 
63 }
64 $banner = "# $banner #";
65 my $dashes = $banner;
66 $dashes =~ s/./#/g;
67 print LOG "\n$dashes\n$banner\n$dashes\n\n";
68 print     "\n$dashes\n$banner (full logs in checkall.log)\n$dashes\n\n";
69
70 if (scalar @skip) {
71     print LOG "* ".(scalar @skip)." skipped tests:\n";
72     print     "* ".(scalar @skip)." skipped tests:\n";
73     map {print "  $_\n";print LOG "  $_\n"} @skip;
74 }
75 if (scalar @xpass) {
76     print LOG "* ".(scalar @xpass)." unexpected pass:\n";
77     print     "* ".(scalar @xpass)." unexpected pass:\n";
78     map {print "  $_\n";print LOG "  $_\n"} @xpass;
79 }
80 if (scalar @xfail) {
81     print LOG "* ".(scalar @xfail)." expected failures:\n";
82     print     "* ".(scalar @xfail)." expected failures:\n";
83     map {print "  $_\n";print LOG "  $_\n"} @xfail;
84 }
85 if (scalar @fail) {
86     print LOG "* ".(scalar @fail)." failed tests:\n";
87     print     "* ".(scalar @fail)." failed tests:\n";
88     map {print "  $_\n";print LOG "  $_\n"} @fail;
89 }
90
91 exit scalar @fail == 0;