gitweb on Svarog

projekti pod git sistemom za održavanje verzija -- projects under the git version control system
ant, record transformation times per program
[mjc2wsl.git] / lib / compare-m-w.pl
1 #!/usr/bin/perl
2 #
3 # test if the outputs are the same from MicroJava and WSL
5 sub read_file($) {
6 my ($file) = @_;
7 my $in;
8 open($in, $file) or die "Cannot read $file: $!\n";
9 my $data = join("", <$in>);
10 close($in);
11 return($data);
12 }
14 # quit unless we have the correct number of command-line args
15 $num_args = $#ARGV + 1;
16 if ($num_args != 2) {
17 print "\nUsage: compare-m-w.pl directory base_filename \n";
18 exit;
19 }
21 $dir=@ARGV[0];
22 $base=@ARGV[1];
24 $outm = read_file("$dir/$base.outmj");
25 $outw = read_file("$dir/$base.outwsl");
27 #print "inputs:\n";
28 #print "$outm\n--\n$outw\n\n";
30 #process the MJ output to remove comments
31 $outm=~s/Completion took.*$//s;
33 #process the WSL output to remove comments
34 $outw=~s/^.*Starting Execution...//s;
35 $outw=~s/^.*?\n.*?\n//s;
36 $outw=~s/Execution time:.*//s;
38 if ($outm eq $outw) {
39 print "$base - OK\n";
40 } else {
41 print "$base - difference detected!:\n";
42 print "$outm###\n--\n$outw###\n";
43 die();
44 }
Svarog.pmf.uns.ac.rs/gitweb maintanance Doni Pracner