tests: try to be compatible with cygwin

This commit is contained in:
Gregory Hainaut 2016-01-23 18:35:34 +01:00
parent e36f1d3128
commit 8ff78378cd
1 changed files with 17 additions and 1 deletions

View File

@ -10,6 +10,7 @@ use File::Basename;
use File::Find; use File::Find;
use File::Spec; use File::Spec;
use File::Copy::Recursive qw(fcopy rcopy dircopy); use File::Copy::Recursive qw(fcopy rcopy dircopy);
use File::Which;
use Tie::File; use Tie::File;
use Cwd; use Cwd;
use Cwd 'abs_path'; use Cwd 'abs_path';
@ -53,9 +54,10 @@ EOS
} }
my $mt_timeout :shared; my $mt_timeout :shared;
my ($o_suite, $o_help, $o_exe, $o_cfg, $o_max_cpu, $o_timeout, $o_show_diff, $o_debug_me, $o_test_name, $o_regression, $o_dry_run, %o_pcsx2_opt); my ($o_suite, $o_help, $o_exe, $o_cfg, $o_max_cpu, $o_timeout, $o_show_diff, $o_debug_me, $o_test_name, $o_regression, $o_dry_run, %o_pcsx2_opt, $o_cygwin);
# default value # default value
$o_cygwin = 0;
$o_max_cpu = 1; $o_max_cpu = 1;
$o_timeout = 20; $o_timeout = 20;
$o_help = 0; $o_help = 0;
@ -124,6 +126,14 @@ unless (-d $o_cfg) {
help(); help();
} }
if (defined(which("cygpath"))) {
$o_cygwin = 1;
}
if ($o_cygwin) {
$o_cfg = `cygpath -w $o_cfg`;
}
my %blacklist; my %blacklist;
if (defined $o_regression) { if (defined $o_regression) {
# Blacklist bad test # Blacklist bad test
@ -332,6 +342,12 @@ sub run_elf {
sub test_cmd { sub test_cmd {
my $elf = shift; my $elf = shift;
my $cfg = shift; my $cfg = shift;
if ($o_cygwin) {
$elf = `cygpath -w $elf`;
$cfg = `cygpath -w $cfg`;
}
if ($elf =~ /\.elf/) { if ($elf =~ /\.elf/) {
return "$o_exe --elf $elf --cfgpath=$cfg" return "$o_exe --elf $elf --cfgpath=$cfg"
} else { } else {