#! /usr/bin/perl use strict; $ENV{LC_ALL} = "C"; # avoid NLS nuisance my @fail; my @xfail; my @pass; my @xpass; my @skip; my $dir; if (-e "CMakeLists.txt") { # launched from dart chdir ".."; } open LOG,(">checkall.log") || die "Cannot open log file: $!"; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); print LOG "Build started on $hour:$min:$sec $mon/$mday/$year\n"; print LOG "Current svn version is: ".qx(svnversion)."\n\n"; print LOG "\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"; print LOG "XXX Include config.log since it contains valuable information XXX\n"; print LOG "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"; open CFG,") { print LOG "$_"; } close CFG; print LOG "\nXXXXXXXXXXXXXXXX\n"; print LOG "XXX Run make XXX\n"; print LOG "XXXXXXXXXXXXXXXX\n"; open MAKE,("make 2>&1 |") || die "Cannot fork a make: $!"; while () { print $_; print LOG $_; } if (!close MAKE) { my $str = "# The source don't compile! Go fix it before running make check #"; my $dashes = $str; $dashes =~ s/./#/g; print LOG "\n$dashes\n$str\n$dashes\n\n"; print "\n$dashes\n$str\n$dashes\n\n"; close LOG; exit 1; } print LOG "\nXXXXXXXXXXXXXXXXXXXXXX\n"; print LOG "XXX Run make check XXX\n"; print LOG "XXXXXXXXXXXXXXXXXXXXXX\n"; open CHECK,("make -k check 2>&1 |") || die "Cannot fork a make check: $!"; while () { print $_; print LOG $_; chomp; if (/Entering directory .([^']*)'/) { #})){ $dir = $1; $dir =~ s|$ENV{PWD}/||; } push @pass, "$dir/$1" if (/^PASS: (.*)$/); push @xpass,"$dir/$1" if (/^XPASS: (.*)$/); push @fail, "$dir/$1" if (/^FAIL: (.*)$/); push @xfail,"$dir/$1" if (/^XFAIL: (.*)$/); push @skip, "$dir/$1" if (/^SKIP: (.*)$/); } close CHECK; my $all = scalar @fail + scalar @xfail + scalar @pass + scalar @xpass + scalar @skip; my $banner; if (scalar @fail == 0) { if (scalar @xfail == 0) { $banner="All $all tests passed. Congratulation."; } else { $banner="All $all tests behaved as expected (".(scalar @xfail)." expected failures)"; } } elsif (scalar @xpass == 0) { $banner=(scalar @fail)." of $all tests failed"; } else { $banner=(scalar @fail+scalar @xpass)." of $all tests did not behave as expected (".(scalar @xpass)." unexpected passes)"; } $banner = "# $banner #"; my $dashes = $banner; $dashes =~ s/./X/g; print LOG "\n$dashes\n$banner\n$dashes\n\n"; print "\n$dashes\n$banner (full logs in checkall.log)\n$dashes\n\n"; if (scalar @skip) { print LOG "* ".(scalar @skip)." skipped tests:\n"; print "* ".(scalar @skip)." skipped tests:\n"; map {print " $_\n";print LOG " $_\n"} @skip; } if (scalar @xpass) { print LOG "* ".(scalar @xpass)." unexpected pass:\n"; print "* ".(scalar @xpass)." unexpected pass:\n"; map {print " $_\n";print LOG " $_\n"} @xpass; } if (scalar @xfail) { print LOG "* ".(scalar @xfail)." expected failures:\n"; print "* ".(scalar @xfail)." expected failures:\n"; map {print " $_\n";print LOG " $_\n"} @xfail; } if (scalar @fail) { print LOG "* ".(scalar @fail)." failed tests:\n"; print "* ".(scalar @fail)." failed tests:\n"; map {print " $_\n";print LOG " $_\n"} @fail; } exit scalar @fail == 0;