File indexing completed on 2025-08-03 08:22:07
0001
0002 use strict;
0003 use English;
0004
0005 my $proggy = $ARGV[0];
0006 my $workdir = $ARGV[3];
0007 my $curdir = $ARGV[2];
0008 my $bin_dir = $ARGV[1];
0009
0010 if(0){
0011 print "prog = $proggy\n";
0012 print "workdir = $workdir\n";
0013 print "curdir = $curdir\n";
0014 print "bin_dir = $bin_dir\n";
0015
0016 }
0017
0018
0019 my @infiles = `ls $curdir/$proggy.in*`;
0020 my $file;
0021 my $cnt = 1;
0022 foreach $file (@infiles) {
0023 chomp $file;
0024
0025 my @parts = split('/',$file);
0026 my $infile = $parts[$#parts];
0027 my $outfile = $infile;
0028 $outfile =~s/\.in/.out/;
0029 my @opts = `cat $file`;
0030 my $opts;
0031 my $line;
0032 foreach $line(@opts){
0033 next if $line=~/^\
0034 next if $line=~/^\s+$/;
0035 $opts = $opts.$line;
0036 }
0037 chomp $opts;
0038 my $cmd = "cd $bin_dir ; $proggy $opts &> $workdir/$outfile";
0039 print "<**executing**> $proggy $opts";
0040 `$cmd`;
0041
0042 if($CHILD_ERROR){
0043 print "\nWARNING: $proggy with options '$opts' exited with signal " ,( $CHILD_ERROR >> 8) ;
0044 }
0045
0046 if($workdir ne $curdir){
0047 my @diff = `diff $workdir/$outfile $curdir/$outfile`;
0048 if($#diff == -1){
0049 print ".... PASSED\n";
0050 }else{
0051 print ".... FAILED\n";
0052 print "--------------------------------------------\n";
0053 print " < what test program did \n";
0054 print " > expected output \n";
0055 print "--------------------------------------------\n";
0056 print @diff;
0057 }
0058 }else{
0059 print "\n";
0060 }
0061 }