6 # XXX this could be further munged to enable some parts on other
8 unless ($^O =~ /^MSWin/) {
9 print "1..0 # skipped: windows specific test\n";
24 my $testdir = "t e s t";
25 my $exename = "showav";
26 my $plxname = "showargv";
29 die "Could not create '$testdir':$!" unless -d $testdir;
31 open(my $F, ">$testdir/$exename.c")
32 or die "Can't create $testdir/$exename.c: $!";
39 main(int ac, char **av)
43 char *h,*s = GetCommandLine();
57 for (i = 0; i < ac; i++)
58 printf("[%s]", av[i]);
64 open($F, ">$testdir/$plxname.bat")
65 or die "Can't create $testdir/$plxname.bat: $!";
69 if "%OS%" == "Windows_NT" goto WinNT
73 "$^X" -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
79 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
80 if %errorlevel% == 9009 echo You do not have Perl in your PATH.
81 if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
86 print "[$_]" for ($0, @ARGV);
94 # build the executable
97 chdir($cwd) && rmtree("$cwd/$testdir") if -d "$cwd/$testdir";
99 if (open(my $EIN, "$cwd/op/${exename}_exe.uu")) {
100 print "# Unpacking $exename.exe\n";
104 $e = unpack "u", <$EIN>;
107 open my $EOUT, ">$exename.exe" or die "Can't write $exename.exe: $!";
114 if ($Config{cc} eq 'gcc')
116 $minus_o = "-o $exename.exe";
118 print "# Compiling $exename.c\n# $Config{cc} $Config{ccflags} $exename.c\n";
119 if (system("$Config{cc} $Config{ccflags} $minus_o $exename.c >log 2>&1") != 0) {
120 print "# Could not compile $exename.c, status $?\n"
121 ."# Where is your C compiler?\n"
122 ."1..0 # skipped: can't build test executable\n";
125 unless (-f "$exename.exe") {
126 if (open(LOG,'<log'))
133 warn "Cannot open log (in $testdir):$!";
137 copy("$plxname.bat","$plxname.cmd");
139 unless (-x "$testdir/$exename.exe") {
140 print "# Could not build $exename.exe\n"
141 ."1..0 # skipped: can't build test executable\n";
145 open my $T, "$^X -I../lib -w op/system_tests |"
146 or die "Can't spawn op/system_tests: $!";
155 elsif (/^#+\s(.*)$/) {
160 $expect =~ tr/<>/[]/;
161 $expect =~ s/\Q$plxname\E]/$plxname.bat]/;
165 print "# $comment\n" if $comment;
166 print "# want: $expect\n";
167 print "# got : $_\n";