Skip to content

Commit

Permalink
Using substring instead of regexp for crash bugs
Browse files Browse the repository at this point in the history
compare failure message using substring rather than
regexp match
  • Loading branch information
chenyang78 committed Oct 31, 2011
1 parent 140cd7f commit 00b76e4
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion utah/scripts/reduce/simple_delta.pl
Expand Up @@ -89,6 +89,21 @@ ($\@$)
return $cnt;
}

sub read_file_with_substring($\@$) {
my ($input, $out, $substring) = @_;
my $cnt = 0;
open INF1, "<$input" or die;
while (my $line = <INF1>) {
chomp $line;
if (index($line, $substring) != -1) {
push @$out, $line;
$cnt++;
}
}
close INF1;
return $cnt;
}

sub compile($$$$) {
my ($compiler, $src_file, $exe, $out) = @_;
my $res = 0;
Expand Down Expand Up @@ -233,7 +248,7 @@ ($$)
my $res;
$res = compile($COMPILER1, $test_file, "$EXE1$test_count", "$COMPILER_OUT1$test_count");
if ($res) {
if (read_file("$COMPILER_OUT1$test_count", @tmp, $match)) {
if (read_file_with_substring("$COMPILER_OUT1$test_count", @tmp, $match)) {
print "$indent crash string $match found for $test_file with $COMPILER1\n";
return 1;
}
Expand Down

0 comments on commit 00b76e4

Please sign in to comment.