#!/usr/bin/perl # # This is a smoke bot that runs a testing program and outputs the bad results #into an error file. # # It can accept any test suite built with Test::More functionality and parses #out any 'not ok' line (representing failed tests) returned by the test suite. #All of these failed tests are outputted to an errorlog which contains the #date in the error log name. # # Does not output to log when all tests succeed. A message is printed to #the default outstream saying whether or not errors were found, however. use strict; use Time::localtime; my $currenttime = ctime(); my @time = split(/ /, $currenttime); my $outputfile = "errlog_$time[1]-$time[2]-$time[4]"; #Month-Day-Year open(INFILE, $ARGV[0]); my @infile = ; open(OUTFILE, ">$outputfile"); my $line; my $errbool = 0; foreach $line (@infile){ if( $line =~ /^not ok/ ){ #If line starts with 'not ok' print OUTFILE $line; $errbool = 1; } } if($errbool){ print "Errors were found and put into $outputfile\n"; } else{ print "No errors discovered!\n"; }