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: $!";
36 main(int ac, char **av)
39 for (i = 0; i < ac; i++)
40 printf("[%s]", av[i]);
46 open($F, ">$testdir/$plxname.bat")
47 or die "Can't create $testdir/$plxname.bat: $!";
51 if "%OS%" == "Windows_NT" goto WinNT
55 "$^X" -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
61 if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
62 if %errorlevel% == 9009 echo You do not have Perl in your PATH.
63 if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
68 print "[$_]" for ($0, @ARGV);
76 # build the executable
79 chdir($cwd) && rmtree("$cwd/$testdir") if -d "$cwd/$testdir";
81 if (open(my $EIN, "$cwd/op/${exename}_exe.uu")) {
82 print "# Unpacking $exename.exe\n";
86 $e = unpack "u", <$EIN>;
89 open my $EOUT, ">$exename.exe" or die "Can't write $exename.exe: $!";
96 if ($Config{cc} eq 'gcc')
98 $minus_o = "-o $exename.exe";
100 print "# Compiling $exename.c\n# $Config{cc} $Config{ccflags} $exename.c\n";
101 if (system("$Config{cc} $Config{ccflags} $minus_o $exename.c >log 2>&1") != 0) {
102 print "# Could not compile $exename.c, status $?\n"
103 ."# Where is your C compiler?\n"
104 ."1..0 # skipped: can't build test executable\n";
107 unless (-f "$exename.exe") {
108 if (open(LOG,'<log'))
115 warn "Cannot open log (in $testdir):$!";
119 copy("$plxname.bat","$plxname.cmd");
121 unless (-x "$testdir/$exename.exe") {
122 print "# Could not build $exename.exe\n"
123 ."1..0 # skipped: can't build test executable\n";
127 open my $T, "$^X -I../lib -w op/system_tests |"
128 or die "Can't spawn op/system_tests: $!";
137 elsif (/^#+\s(.*)$/) {
142 $expect =~ tr/<>/[]/;
143 $expect =~ s/\Q$plxname\E]/$plxname.bat]/;
147 print "# $comment\n" if $comment;
148 print "# want: $expect\n";
149 print "# got : $_\n";