5 # We need '../../lib' as well as '../lib' because parts of Config are
6 # delay-loaded, after we've chdir()'ed into $testdir.
7 @INC = ('../lib', '../../lib');
8 # XXX this could be further munged to enable some parts on other
14 unless ($^O =~ /^MSWin/) {
15 skip_all 'windows specific test';
29 my $testdir = "t e s t";
30 my $exename = "showav";
31 my $plxname = "showargv";
34 die "Could not create '$testdir':$!" unless -d $testdir;
36 open(my $F, ">$testdir/$exename.c")
37 or die "Can't create $testdir/$exename.c: $!";
41 main(int ac, char **av)
44 for (i = 0; i < ac; i++)
45 printf("[%s]", av[i]);
51 open($F, ">$testdir/$plxname.bat")
52 or die "Can't create $testdir/$plxname.bat: $!";
56 if "%OS%" == "Windows_NT" goto WinNT
60 "$^X" -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
66 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
67 if %errorlevel% == 9009 echo You do not have Perl in your PATH.
68 if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
73 print "[$_]" for ($0, @ARGV);
81 # build the executable
84 chdir($cwd) && rmtree("$cwd/$testdir") if -d "$cwd/$testdir";
86 if (open(my $EIN, "$cwd/win32/${exename}_exe.uu")) {
87 note "Unpacking $exename.exe";
91 $e = unpack "u", <$EIN>;
94 open my $EOUT, ">$exename.exe" or die "Can't write $exename.exe: $!";
101 if ($Config{cc} =~ /\bgcc/i)
103 $minus_o = "-o $exename.exe";
105 note "Compiling $exename.c";
106 note "$Config{cc} $Config{ccflags} $exename.c";
107 if (system("$Config{cc} $Config{ccflags} $minus_o $exename.c >log 2>&1") != 0) {
108 note "Could not compile $exename.c, status $?";
109 note "Where is your C compiler?";
110 skip_all "can't build test executable";
112 unless (-f "$exename.exe") {
113 if (open(LOG,'<log'))
120 warn "Cannot open log (in $testdir):$!";
124 copy("$plxname.bat","$plxname.cmd");
126 unless (-x "$testdir/$exename.exe") {
127 note "Could not build $exename.exe";
128 skip_all "can't build test executable";
131 open my $T, "$^X -I../lib -w win32/system_tests |"
132 or die "Can't spawn win32/system_tests: $!";
140 elsif (/^#+\s(.*)$/) {
145 $expect =~ tr/<>/[]/;
146 $expect =~ s/\Q$plxname\E]/$plxname.bat]/;
150 note $comment if $comment;
151 note "want: $expect";
154 ok($expect eq $_, $comment // '');