Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec/S32-io] Add batch file and allow these tests to run on Window…

…s. Confirmed passing on Vista.

git-svn-id: http://svn.pugscode.org/pugs@29082 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit d48a181f418de86d79ad0d884753a632ad5d6dcc 1 parent 533512a
carlin authored
Showing with 47 additions and 8 deletions.
  1. +16 −0 S32-io/IO-Socket-INET.bat
  2. +31 −8 S32-io/IO-Socket-INET.t
View
16 S32-io/IO-Socket-INET.bat
@@ -0,0 +1,16 @@
+@ECHO OFF
+:: script for Windows to supply fork() to rakudo
+:: based on IO-Socket-INET.sh
+SET TEST=%1
+SET PORT=%2
+
+:: clear the status message flag but don't whinge about the file not being there
+DEL t\spec\S32-io\server-ready-flag 2> NUL
+
+:: Use START to fork the server and set the window title so we can kill it later
+START "P6IOSOCKETtest" perl6 t\spec\S32-io\IO-Socket-INET.pl %TEST% %PORT% server
+
+perl6 t\spec\S32-io\IO-Socket-INET.pl %TEST% %PORT% client
+
+:: Clean up any stray processes
+TASKKILL /FI "WINDOWTITLE eq P6IOSOCKETtest" > NUL
View
39 S32-io/IO-Socket-INET.t
@@ -23,8 +23,12 @@ given $*OS {
}
when 'solaris' {
$netstat_cmd = "netstat -an -P tcp -f inet";
- $netstat_pat = regex { [ ^^ .+? '.' (\d+) ' ' .+? ]+ $ };
+ $netstat_pat = regex { [ ^^ .+? '.' (\d+) ' ' .+? ]+ $ }; # same as darwin
}
+ when 'MSWin32' {
+ $netstat_cmd = "netstat -n";
+ $netstat_pat = regex { State .+? [ ^^ .+? ':' (\d+) .+? ]+ $ }; # same as linux
+ }
default {
skip_rest('Operating system not yet supported');
exit 0;
@@ -54,23 +58,38 @@ isa_ok $server, IO::Socket::INET;
# Do not bind to this socket in the parent process, that would prevent a
# child process from using it.
-if $*OS eq any <linux darwin solaris> { # please add more valid OS names
+if $*OS eq any <linux darwin solaris MSWin32> { # please add more valid OS names
+
+ my $is-win;
+ $is-win = True if $*OS eq 'MSWin32';
# test 2 does echo protocol - Internet RFC 862
- $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 2 $port};
+ if $is-win {
+ $received = qqx{t\\spec\\S32-io\\IO-Socket-INET.bat 2 $port};
+ } else {
+ $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 2 $port};
+ }
#warn "TEST 2 $received";
$expected = "echo '0123456789abcdefghijklmnopqrstuvwxyz' received\n";
is $received, $expected, "echo server and client";
# test 3 does discard protocol - Internet RFC 863
- $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 3 $port};
+ if $is-win {
+ $received = qqx{t\\spec\\S32-io\\IO-Socket-INET.bat 3 $port};
+ } else {
+ $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 3 $port};
+ }
#warn "TEST 3 $received";
$expected = "discard '' received\n";
is $received, $expected, "discard server and client";
# test 4 tests recv with a parameter
- $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 4 $port};
- $expected = $received.split("\n");
+ if $is-win {
+ $received = qqx{t\\spec\\S32-io\\IO-Socket-INET.bat 4 $port};
+ } else {
+ $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 4 $port};
+ }
+ $expected = $received.split("\n");
my $i = 0;
is $expected[$i++], '0123456', 'received first 7 characters';
is $expected[$i++], '789', 'received next 3 characters';
@@ -84,8 +103,12 @@ if $*OS eq any <linux darwin solaris> { # please add more valid OS names
#?rakudo 7 skip
# test 5 tests get()
- $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 5 $port};
- $expected = $received.split("\n");
+ if $is-win {
+ $received = qqx{t\\spec\\S32-io\\IO-Socket-INET.bat 5 $port};
+ } else {
+ $received = qqx{sh t/spec/S32-io/IO-Socket-INET.sh 5 $port};
+ }
+ $expected = $received.split("\n");
$i = 0;
is $expected[$i++], "'Twas brillig, and the slithy toves",
'get() with default separator';
Please sign in to comment.
Something went wrong with that request. Please try again.