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
10 unless ($^O =~ /^MSWin/) {
11 print "1..0 # skipped: windows specific test\n";
26 my $testdir = "t e s t";
27 my $exename = "showav";
28 my $plxname = "showargv";
31 die "Could not create '$testdir':$!" unless -d $testdir;
33 open(my $F, ">$testdir/$exename.c")
34 or die "Can't create $testdir/$exename.c: $!";
41 main(int ac, char **av)
45 char *s = GetCommandLine();
59 for (i = 0; i < ac; i++)
60 printf("[%s]", av[i]);
66 open($F, ">$testdir/$plxname.bat")
67 or die "Can't create $testdir/$plxname.bat: $!";
71 if "%OS%" == "Windows_NT" goto WinNT
75 "$^X" -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
81 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
82 if %errorlevel% == 9009 echo You do not have Perl in your PATH.
83 if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
88 print "[$_]" for ($0, @ARGV);
96 # build the executable
99 chdir($cwd) && rmtree("$cwd/$testdir") if -d "$cwd/$testdir";
101 if (open(my $EIN, "$cwd/win32/${exename}_exe.uu")) {
102 print "# Unpacking $exename.exe\n";
106 $e = unpack "u", <$EIN>;
109 open my $EOUT, ">$exename.exe" or die "Can't write $exename.exe: $!";
116 if ($Config{cc} =~ /^gcc/i)
118 $minus_o = "-o $exename.exe";
120 print "# Compiling $exename.c\n# $Config{cc} $Config{ccflags} $exename.c\n";
121 if (system("$Config{cc} $Config{ccflags} $minus_o $exename.c >log 2>&1") != 0) {
122 print "# Could not compile $exename.c, status $?\n"
123 ."# Where is your C compiler?\n"
124 ."1..0 # skipped: can't build test executable\n";
127 unless (-f "$exename.exe") {
128 if (open(LOG,'<log'))
135 warn "Cannot open log (in $testdir):$!";
139 copy("$plxname.bat","$plxname.cmd");
141 unless (-x "$testdir/$exename.exe") {
142 print "# Could not build $exename.exe\n"
143 ."1..0 # skipped: can't build test executable\n";
147 open my $T, "$^X -I../lib -w win32/system_tests |"
148 or die "Can't spawn win32/system_tests: $!";
157 elsif (/^#+\s(.*)$/) {
162 $expect =~ tr/<>/[]/;
163 $expect =~ s/\Q$plxname\E]/$plxname.bat]/;
167 print "# $comment\n" if $comment;
168 print "# want: $expect\n";
169 print "# got : $_\n";