modseq_check.pl 757 Bytes
#!/usr/bin/perl
#

@check_sequence = (
		   "io_mon.*removed", 
		   "0x00000032",
		   "io_mon.*inserted",
		   "io_mon.*removed",
		   "0x00000034",
		   "io_mon.*inserted"		   
		   );


$indx = 0;

open(logfile, "@ARGV[0]") || die "Cannot open log file @ARGV[0].\n";
while (($indx <= $#check_sequence) && ($line = <logfile>)) {
    if (($line =~ /@ARGV[1]/) && ($line =~ /cbus/)) {
	$checkline = 1;
    }
    elsif ($checkline == 1){
	if (@check_sequence[$indx] =~ /0x/ 
	    && $line =~ /@check_sequence[$indx]/) {
            $indx += 1;
	}
	$checkline = 0;
    }

    if (@check_sequence[$indx] =~ /io_mon/
	&& $line =~ /@check_sequence[$indx]/) {
	$indx += 1;
    }
}
close(logfile);

if ($indx == ($#check_sequence + 1)) {
    exit(0);
}

exit(1);