1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
|
#!perl
use Config;
use Cwd;
use strict;
BEGIN {
require './test.pl';
}
$| = 1;
my $cwdb = my $cwd = cwd();
$cwd =~ s,\\,/,g;
$cwdb =~ s,/,\\,g;
my $testdir = "t e s t";
my $exename = "showav";
my $plxname = "showargv";
my $exe = "$testdir/$exename";
my $exex = $exe . ".exe";
(my $exeb = $exe) =~ s,/,\\,g;
my $exebx = $exeb . ".exe";
my $bat = "$testdir/$plxname";
my $batx = $bat . ".bat";
(my $batb = $bat) =~ s,/,\\,g;
my $batbx = $batb . ".bat";
my $cmdx = $bat . ".cmd";
my $cmdb = $batb;
my $cmdbx = $cmdb . ".cmd";
my @commands = (
$exe,
$exex,
$exeb,
$exebx,
"./$exe",
"./$exex",
".\\$exeb",
".\\$exebx",
"$cwd/$exe",
"$cwd/$exex",
"$cwdb\\$exeb",
"$cwdb\\$exebx",
$bat,
$batx,
$batb,
$batbx,
"./$bat",
"./$batx",
".\\$batb",
".\\$batbx",
"$cwd/$bat",
"$cwd/$batx",
"$cwdb\\$batb",
"$cwdb\\$batbx",
$cmdx,
$cmdbx,
"./$cmdx",
".\\$cmdbx",
"$cwd/$cmdx",
"$cwdb\\$cmdbx",
[$^X, $batx],
[$^X, $batbx],
[$^X, "./$batx"],
[$^X, ".\\$batbx"],
[$^X, "$cwd/$batx"],
[$^X, "$cwdb\\$batbx"],
);
my @av = (
undef,
"",
" ",
"abc",
"a b\tc",
"\tabc",
"abc\t",
" abc\t",
"\ta b c ",
["\ta b c ", ""],
["\ta b c ", " "],
["", "\ta b c ", "abc"],
[" ", "\ta b c ", "abc"],
['" "', 'a" "b" "c', "abc"],
);
print "1.." . (@commands * @av * 2) . "\n";
for my $cmds (@commands) {
for my $args (@av) {
my @all_args;
my @cmds = defined($cmds) ? (ref($cmds) ? @$cmds : $cmds) : ();
my @args = defined($args) ? (ref($args) ? @$args : $args) : ();
note "####### [@cmds]";
print "<", join('><',
$cmds[$#cmds],
map { my $x = $_; $x =~ s/"//g; $x } @args),
">\n";
if (system(@cmds,@args) != 0) {
print "Failed, status($?)\n";
if ($Config{ccflags} =~ /\bDDEBUGGING\b/) {
print "Running again in debug mode\n";
$^D = 1; # -Dp
system(@cmds,@args);
}
}
$^D = 0;
my $cmdstr = join " ", map { /\s|^$/ && !/\"/
? qq["$_"] : $_ } @cmds, @args;
note "####### '$cmdstr'";
if (system($cmdstr) != 0) {
print "Failed, status($?)\n";
if ($Config{ccflags} =~ /\bDDEBUGGING\b/) {
print "Running again in debug mode\n";
$^D = 1; # -Dp
system($cmdstr);
}
}
$^D = 0;
}
}
|