| 1 |
#!/usr/bin/perl |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
use Cwd qw(realpath); |
| 5 |
|
| 6 |
my ($bindir, $sep) = $0 =~ /^(.*)(\\|\/).*/; |
| 7 |
$bindir = realpath $bindir; |
| 8 |
chdir $bindir or die("Error: Could not change directory to $bindir !"); |
| 9 |
|
| 10 |
# Search paths for the binary |
| 11 |
my @binlist = ( |
| 12 |
"../build/src/vislcg3", |
| 13 |
"../../build/VS17/src/Debug/vislcg3", |
| 14 |
"../../build/VS17/src/Release/vislcg3", |
| 15 |
"../src/Debug/vislcg3", |
| 16 |
"../src/Release/vislcg3", |
| 17 |
"../Debug/vislcg3", |
| 18 |
"../Release/vislcg3", |
| 19 |
"../src/vislcg3", |
| 20 |
"../vislcg3", |
| 21 |
); |
| 22 |
my $binary = "vislcg3"; |
| 23 |
|
| 24 |
foreach (@binlist) { |
| 25 |
if (-x $_ && int(`$_ --min-binary-revision 2>/dev/null`) >= 10373) { |
| 26 |
$binary = $_; |
| 27 |
last; |
| 28 |
} |
| 29 |
elsif (-x $_.".exe" && int(`$_.exe --min-binary-revision 2>/dev/null`) >= 10373) { |
| 30 |
$binary = $_.".exe"; |
| 31 |
last; |
| 32 |
} |
| 33 |
elsif (-x "../".$_ && int(`../$_ --min-binary-revision 2>/dev/null`) >= 10373) { |
| 34 |
$binary = "../".$_; |
| 35 |
last; |
| 36 |
} |
| 37 |
elsif (-x "../".$_.".exe" && int(`../$_.exe --min-binary-revision 2>/dev/null`) >= 10373) { |
| 38 |
$binary = "../".$_.".exe"; |
| 39 |
last; |
| 40 |
} |
| 41 |
} |
| 42 |
$binary = realpath $binary; |
| 43 |
$binary =~ s@/([^/]+)$@/@; |
| 44 |
print STDERR "Binaries found at: $binary\n"; |
| 45 |
|
| 46 |
print STDERR "\nRunning tests...\n"; |
| 47 |
|
| 48 |
my @tests = grep { -x } glob('./T*/run.pl'); |
| 49 |
foreach (@tests) { |
| 50 |
if ($ARGV[0] && $ARGV[0] ne "" && !(/$ARGV[0]/i)) { |
| 51 |
next; |
| 52 |
} |
| 53 |
chdir $bindir or die("Error: Could not change directory to $bindir !"); |
| 54 |
my ($test) = m/^.*?(T[^\/]+).*$/; |
| 55 |
print STDERR "$test: "; |
| 56 |
if (-s "./$test/byline.txt") { |
| 57 |
print STDERR "(".`cat "./$test/byline.txt"`.") "; |
| 58 |
} |
| 59 |
if (-e "./".$test."/diff.txt") { |
| 60 |
unlink "./".$test."/diff.txt"; |
| 61 |
} |
| 62 |
if (-e "./".$test."/output.txt") { |
| 63 |
unlink "./".$test."/output.txt"; |
| 64 |
} |
| 65 |
my $c = '""'; |
| 66 |
if ($ARGV[1] && $ARGV[1] ne "") { |
| 67 |
$c = '"'.$ARGV[1].'"'; |
| 68 |
} |
| 69 |
`$_ "$binary" \Q$c\E`; |
| 70 |
} |
| 71 |
|
| 72 |
print STDERR "\n"; |