Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] minitest on Win32 is broken #14318

Closed
p5pRT opened this issue Dec 9, 2014 · 23 comments
Closed

[PATCH] minitest on Win32 is broken #14318

p5pRT opened this issue Dec 9, 2014 · 23 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 9, 2014

Migrated from rt.perl.org#123394 (status was 'resolved')

Searchable as RT123394$

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

minitest on Win32 has been broken for a while, starting it fails because it uses harness, which uses Test​::Harness which requires IO, which miniperl can't load.

This series of patches switches from harness to TEST and fixes most of the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll commit them.

Tony

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0001-use-TEST-for-minitest-same-as-POSIX-systems.patch
From 267e216978c642361b23a9b9373336440f86dd15 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 10:48:32 +1100
Subject: use TEST for minitest, same as POSIX systems

Test::Harness now requires IO at all times, which means it can't
be used with miniperl

many tests fail with minitest at this point
---
 win32/Makefile    |    2 +-
 win32/makefile.mk |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/win32/Makefile b/win32/Makefile
index b8e86c7..f09c362 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1319,7 +1319,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils $(UNIDATAFILES)
 	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
 	attrib -r ..\t\*.*
 	cd ..\t && \
-	$(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
 
 test-prep : all utils ../pod/perltoc.pod
 	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 12e4cf3..718e289 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1596,7 +1596,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
 	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
 	attrib -r ..\t\*.*
 	cd ..\t && \
-	$(MINIPERL) -I..\lib harness base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
 
 test-prep : all utils ..\pod\perltoc.pod
 	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0002-t-TEST-glob-the-supplied-filenames-on-Win32.patch
From 0d1a8a2ba8a45ea38123122436989067047cea4a Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 11:01:34 +1100
Subject: t/TEST: glob the supplied filenames on Win32

since Win32 perl doesn't glob by default

at this point the following tests fail:

io/dup.t
io/fs.t
io/open.t
io/perlio_leaks.t
op/coreamp.t
op/filetest.t
op/fork.t
op/fresh_perl_utf8.t
op/glob.t
op/heredoc.t
op/magic.t
op/read.t
op/readline.t
op/sselect.t
op/stat.t
op/substr.t
op/tie_fetch_count.t
op/write.t
---
 t/TEST |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/t/TEST b/t/TEST
index 7c26372..4333eed 100755
--- a/t/TEST
+++ b/t/TEST
@@ -123,6 +123,9 @@ $| = 1;
 
 # remove empty elements due to insertion of empty symbols via "''p1'" syntax
 @ARGV = grep($_,@ARGV) if $^O eq 'VMS';
+
+@ARGV = map glob, @ARGV if $^O eq 'MSWin32';
+
 our $show_elapsed_time = $ENV{HARNESS_TIMER} || 0;
 
 # Cheesy version of Getopt::Std.  We can't replace it with that, because we
@@ -220,7 +223,7 @@ sub _scan_test {
 
     close $script;
 
-    my $perl = './perl';
+    my $perl = $^O eq 'MSWin32' ? '.\perl' : './perl';
     my $lib  = '../lib';
     my $run_dir;
     my $return_dir;
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0003-build-miniperl-with-PerlIO.patch
From d860beb3f75bd271409eeccb9d0407d53d2cce7d Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 11:26:22 +1100
Subject: build miniperl with PerlIO

Several tests use PerlIO layers (:utf8, :pop) without testing for it.

non-PerlIO builds were vaguely deprecated in 5.18.0 and can no longer be
enabled on POSIX systems through Configure, so making miniperl PerlIO
on Win32 is no big stretch

minitests failing now:

io/data.t
io/fs.t
op/coreamp.t
op/filetest.t
op/fork.t
op/glob.t
op/heredoc.t
op/magic.t
op/sselect.t
op/stat.t
op/tie_fetch_count.t
---
 win32/Makefile    |    4 ++--
 win32/makefile.mk |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/win32/Makefile b/win32/Makefile
index f09c362..09034ff 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1002,10 +1002,10 @@ $(MINIDIR) :
 	if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*F).c
+	$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ ..\$(*F).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*F).c
+	$(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ $(*F).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 718e289..22b04c4 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1235,10 +1235,10 @@ $(MINIDIR) :
 	if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
+	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ ..\$(*B).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
+	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ $(*B).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0004-use-textmode-when-opening-scripts-in-miniperl-to-mat.patch
From 70d5fab94f708ce4a5890c348bd88371177e7399 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 11:39:24 +1100
Subject: use textmode when opening scripts in miniperl to match perl

fixes io/data.t

This could be considered a bug in io/data.t, since it writes the scripts
in text mode, but making miniperl behave closer to perl may fix
other issues too.
---
 win32/Makefile    |    4 ++--
 win32/makefile.mk |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/win32/Makefile b/win32/Makefile
index 09034ff..934fa4d 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1002,10 +1002,10 @@ $(MINIDIR) :
 	if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ ..\$(*F).c
+	$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO -DPERL_TEXTMODE_SCRIPTS $(OBJOUT_FLAG)$@ ..\$(*F).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ $(*F).c
+	$(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL -DUSE_PERLIO -DPERL_TEXTMODE_SCRIPTS $(OBJOUT_FLAG)$@ $(*F).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # This is the only file that depends on perlhost.h, vmem.h, and vdir.h
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 22b04c4..a11ac25 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1235,10 +1235,10 @@ $(MINIDIR) :
 	if not exist "$(MINIDIR)" mkdir "$(MINIDIR)"
 
 $(MINICORE_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ ..\$(*B).c
+	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL -DUSE_PERLIO -DPERL_TEXTMODE_SCRIPTS $(OBJOUT_FLAG)$@ ..\$(*B).c
 
 $(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
-	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL -DUSE_PERLIO $(OBJOUT_FLAG)$@ $(*B).c
+	$(CC) -c $(CFLAGS) $(MINIBUILDOPT) -DPERL_IS_MINIPERL -DUSE_PERLIO -DPERL_TEXTMODE_SCRIPTS $(OBJOUT_FLAG)$@ $(*B).c
 
 # -DPERL_IMPLICIT_SYS needs C++ for perllib.c
 # rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0005-disable-Win32-sloppy-stat-in-io-fs.t-io-stat.t.patch
From b6bf7354d6e1e1c6ffc0192fd9fdd90726fefc4c Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 11:44:52 +1100
Subject: disable Win32 sloppy stat in io/fs.t, io/stat.t

8ce7a7e8b08f added a line to write_buildcustomize.pl to enable
${^WIN32_SLOPPY_STAT} in lib/buildcustomize.pl on Win32.

This meant the nlink value from stat wasn't being populated correctly
causing the link count tests to fail
---
 t/io/fs.t   |    6 ++++++
 t/op/stat.t |    5 +++++
 2 files changed, 11 insertions(+)

diff --git a/t/io/fs.t b/t/io/fs.t
index 9b41e65..6719a0a 100644
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -10,6 +10,12 @@ use Config;
 
 my $Is_VMSish = ($^O eq 'VMS');
 
+if ($^O eq 'MSWin32') {
+    # under minitest, buildcustomize sets this to 1, which means
+    # nlinks isn't populated properly, allow our tests to pass
+    ${^WIN32_SLOPPY_STAT} = 0;
+}
+
 if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
     $wd = `cd`;
 }
diff --git a/t/op/stat.t b/t/op/stat.t
index 2c28e1e..1461b52 100644
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -19,6 +19,11 @@ if(eval {require File::Spec; 1}) {
     diag("\ncontinuing, assuming '.' for current directory. Some tests will be skipped.");
 }
 
+if ($^O eq 'MSWin32') {
+    # under minitest, buildcustomize sets this to 1, which means
+    # nlinks isn't populated properly, allow nlinks tests to pass
+    ${^WIN32_SLOPPY_STAT} = 0;
+}
 
 plan tests => 113;
 
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0006-some-socket-functions-aren-t-available-under-Win32-m.patch
From e63f3ddc2402a86a912669d93a04cf858a1de5fe Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 12:56:07 +1100
Subject: some socket functions aren't available under Win32 miniperl

This only skips for bind, connect, accept() and select().

Other functions are tested in coreamp.t, but either aren't called with
valid handles, so don't reach the "unimplemented" errors, or don't
trigger the errors for other reasons.

fixes: op/coreamp.t, op/sselect.t, op/tie_fetch_count.t
---
 t/op/coreamp.t         |   69 +++++++++++++++++++++++++++++++-----------------
 t/op/sselect.t         |    3 +++
 t/op/tie_fetch_count.t |    3 +++
 3 files changed, 51 insertions(+), 24 deletions(-)

diff --git a/t/op/coreamp.t b/t/op/coreamp.t
index 9a9ab48..9005306 100644
--- a/t/op/coreamp.t
+++ b/t/op/coreamp.t
@@ -276,32 +276,45 @@ is __SUB__test, \&__SUB__test, '&__SUB__';                  ++ $tests;
 
 test_proto 'abs', -5, 5;
 
-test_proto 'accept';
-$tests += 6; eval q{
-  is &CORE::accept(qw{foo bar}), undef, "&accept";
-  lis [&{"CORE::accept"}(qw{foo bar})], [undef], "&accept in list context";
-
-  &myaccept(my $foo, my $bar);
-  is ref $foo, 'GLOB', 'CORE::accept autovivifies its first argument';
-  is $bar, undef, 'CORE::accept does not autovivify its second argument';
-  use strict;
-  undef $foo;
-  eval { 'myaccept'->($foo, $bar) };
-  like $@, qr/^Can't use an undefined value as a symbol reference at/,
+SKIP:
+{
+    if ($^O eq "MSWin32" && is_miniperl) {
+        $tests += 8;
+        skip "accept() not available in Win32 miniperl", 8
+    }
+    $tests += 6;
+    test_proto 'accept';
+    eval q{
+      is &CORE::accept(qw{foo bar}), undef, "&accept";
+      lis [&{"CORE::accept"}(qw{foo bar})], [undef], "&accept in list context";
+
+      &myaccept(my $foo, my $bar);
+      is ref $foo, 'GLOB', 'CORE::accept autovivifies its first argument';
+      is $bar, undef, 'CORE::accept does not autovivify its second argument';
+      use strict;
+      undef $foo;
+      eval { 'myaccept'->($foo, $bar) };
+      like $@, qr/^Can't use an undefined value as a symbol reference at/,
       'CORE::accept will not accept undef 2nd arg under strict';
-  is ref $foo, 'GLOB', 'CORE::accept autovivs its first arg under strict';
-};
+      is ref $foo, 'GLOB', 'CORE::accept autovivs its first arg under strict';
+    };
+}
 
 test_proto 'alarm';
 test_proto 'atan2';
 
 test_proto 'bind';
 $tests += 3;
-is &CORE::bind('foo', 'bear'), undef, "&bind";
-lis [&CORE::bind('foo', 'bear')], [undef], "&bind in list context";
-eval { &mybind(my $foo, "bear") };
-like $@, qr/^Bad symbol for filehandle at/,
-     'CORE::bind dies with undef first arg';
+SKIP:
+{
+    skip "bind() not available in Win32 miniperl", 3
+      if $^O eq "MSWin32" && is_miniperl();
+    is &CORE::bind('foo', 'bear'), undef, "&bind";
+    lis [&CORE::bind('foo', 'bear')], [undef], "&bind in list context";
+    eval { &mybind(my $foo, "bear") };
+    like $@, qr/^Bad symbol for filehandle at/,
+         'CORE::bind dies with undef first arg';
+}
 
 test_proto 'binmode';
 $tests += 3;
@@ -397,8 +410,13 @@ lis [&CORE::closedir(foo)], [undef], '&CORE::closedir in list context';
 
 test_proto 'connect';
 $tests += 2;
-is &CORE::connect('foo','bar'), undef, '&connect';
-lis [&myconnect('foo','bar')], [undef], '&connect in list context';
+SKIP:
+{
+    skip "connect() not available in Win32 miniperl", 2
+      if $^O eq "MSWin32" && is_miniperl();
+    is &CORE::connect('foo','bar'), undef, '&connect';
+    lis [&myconnect('foo','bar')], [undef], '&connect in list context';
+}
 
 test_proto 'continue';
 $tests ++;
@@ -781,9 +799,12 @@ like $@, qr/^Not enough arguments for select system call at /,
 eval { &myselect(1,2,3,4,5) };
 like $@, qr/^Too many arguments for select system call at /,
       ,'&myselect($a,$total,$of,$five,$args)';
-&myselect((undef)x3,.25);
-# Just have to assume that worked. :-) If we get here, at least it didn’t
-# crash or anything.
+unless ($^O eq "MSWin32" && is_miniperl) {
+    &myselect((undef)x3,.25);
+    # Just have to assume that worked. :-) If we get here, at least it didn’t
+    # crash or anything.
+    # select() is unimplemented in Win32 miniperl
+}
 
 test_proto "sem$_" for qw "ctl get op";
 
diff --git a/t/op/sselect.t b/t/op/sselect.t
index d0dc33b..212c69a 100644
--- a/t/op/sselect.t
+++ b/t/op/sselect.t
@@ -9,6 +9,9 @@ BEGIN {
 
 require './test.pl';
 
+skip_all("Win32 miniperl has no socket select")
+  if $^O eq "MSWin32" && is_miniperl();
+
 plan (15);
 
 my $blank = "";
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t
index 28a4355..d2fb4d6 100644
--- a/t/op/tie_fetch_count.t
+++ b/t/op/tie_fetch_count.t
@@ -251,7 +251,10 @@ $dummy  =   crypt $var,0; check_count 'crypt $tied_utf8, ...';
 $var = substr(chr 256,0,0);
 $dummy  =   crypt 0,$var; check_count 'crypt ..., $tied_utf8';
 
+SKIP:
 {
+    skip "select not implemented on Win32 miniperl", 3
+        if $^O eq "MSWin32" and is_miniperl;
     no warnings;
     $var = *foo;
     $dummy  =  select $var, undef, undef, 0
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0007-miniperl-on-Win32-doesn-t-have-fork.patch
From 13cbd7a01e5af8005f30bdc9251874a308740f26 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 13:27:35 +1100
Subject: miniperl on Win32 doesn't have fork()

---
 t/op/fork.t |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/t/op/fork.t b/t/op/fork.t
index 734e223..77cc7b7 100644
--- a/t/op/fork.t
+++ b/t/op/fork.t
@@ -9,6 +9,8 @@ BEGIN {
     require Config;
     skip_all('no fork')
 	unless ($Config::Config{d_fork} or $Config::Config{d_pseudofork});
+    skip_all('no fork')
+        if $^O eq 'MSWin32' && is_miniperl;
 }
 
 $|=1;
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0008-Win32-minitest-k-is-never-available-on-Win32.patch
From 3b20cde01269794ffe6fa9b1dc658faef428f9e4 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Mon, 8 Dec 2014 15:11:29 +1100
Subject: Win32 minitest: -k is never available on Win32

Given the structure of the tests and the code, I can only assume
S_ISVTX is only unavailable on Win32 out of the systems we run
minitest on.
---
 t/op/filetest.t |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/t/op/filetest.t b/t/op/filetest.t
index 91ebe9c..8883381 100644
--- a/t/op/filetest.t
+++ b/t/op/filetest.t
@@ -223,11 +223,18 @@ for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") {
 
     my ($exp, $is) = (1, "is");
     if (
-	!$fcntl_not_available and (
-        $op eq "u" and not eval { Fcntl::S_ISUID() } or
-        $op eq "g" and not eval { Fcntl::S_ISGID() } or
-        $op eq "k" and not eval { Fcntl::S_ISVTX() }
+	(
+	  !$fcntl_not_available and
+	  (
+	    $op eq "u" and not eval { Fcntl::S_ISUID() } or
+	    $op eq "g" and not eval { Fcntl::S_ISGID() } or
+	    $op eq "k" and not eval { Fcntl::S_ISVTX() }
+	  )
 	)
+	||
+	# the Fcntl test is meaningless in miniperl and
+	# S_ISVTX isn't available on Win32
+	( $^O eq 'MSWin32' && $op eq 'k' && is_miniperl )
     ) {
         ($exp, $is) = (0, "not");
     }
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0009-minitest-op-magic.t-skip-the-env_is-tests-on-Win32-m.patch
From 21fe068807e590383534855b00286a77012727b0 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 9 Dec 2014 14:38:38 +1100
Subject: minitest op/magic.t: skip the env_is() tests on Win32 miniperl

Since 1070c8d6 env_is() requires the Win32 module on Win32, which
miniperl can't load
---
 t/op/magic.t |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/op/magic.t b/t/op/magic.t
index bb9d175..3fbec7b 100644
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -684,8 +684,10 @@ is $_, undef, '${^E_NCODING} is undef';
 # ^^^^^^^^^ New tests go here ^^^^^^^^^
 
 SKIP: {
-    skip("%ENV manipulations fail or aren't safe on $^O", 19)
+    skip("%ENV manipulations fail or aren't safe on $^O", 20)
 	if $Is_Dos;
+    skip "Win32 needs XS for env/shell tests", 20
+        if $Is_MSWin32 && is_miniperl;
 
  SKIP: {
 	skip("clearing \%ENV is not safe when running under valgrind or on VMS")
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0010-minitest-miniperl-on-win32-always-uses-the-x86-arch-.patch
From a360a52bb6e964bcc7a0a08aa8ced2dee192edc7 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 9 Dec 2014 15:06:05 +1100
Subject: minitest: miniperl on win32 always uses the x86 arch, so skip
 testing it

---
 t/run/switches.t |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/t/run/switches.t b/t/run/switches.t
index 09b77c7..78915e0 100644
--- a/t/run/switches.t
+++ b/t/run/switches.t
@@ -298,13 +298,17 @@ is runperl(stderr => 1, prog => '#!perl -M'),
     local $TODO = '';   # these ones should work on VMS
     # there are definitely known build configs where this test will fail
     # DG/UX comes to mind. Maybe we should remove these special cases?
-    my $v = sprintf "%vd", $^V;
-    my $ver = $Config{PERL_VERSION};
-    my $rel = $Config{PERL_SUBVERSION};
-    like( runperl( switches => ['-v'] ),
-	  qr/This is perl 5, version \Q$ver\E, subversion \Q$rel\E \(v\Q$v\E(?:[-*\w]+| \([^)]+\))?\) built for \Q$Config{archname}\E.+Copyright.+Larry Wall.+Artistic License.+GNU General Public License/s,
-          '-v looks okay' );
-
+  SKIP:
+    {
+        skip "Win32 miniperl produces a default archname in -v", 1
+	  if $^O eq 'MSWin32' && is_miniperl;
+        my $v = sprintf "%vd", $^V;
+        my $ver = $Config{PERL_VERSION};
+        my $rel = $Config{PERL_SUBVERSION};
+        like( runperl( switches => ['-v'] ),
+	      qr/This is perl 5, version \Q$ver\E, subversion \Q$rel\E \(v\Q$v\E(?:[-*\w]+| \([^)]+\))?\) built for \Q$Config{archname}\E.+Copyright.+Larry Wall.+Artistic License.+GNU General Public License/s,
+              '-v looks okay' );
+    }
 }
 
 # Tests for -h
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

0011-minitest-run-the-sames-tests-on-win32-as-on-POSIXish.patch
From d2a14dca8024b7ab93ce7d6dfcc37ef07d94f6c3 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 9 Dec 2014 15:13:04 +1100
Subject: minitest: run the sames tests on win32 as on POSIXish systems

---
 win32/Makefile    |    2 +-
 win32/makefile.mk |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/win32/Makefile b/win32/Makefile
index 934fa4d..dda2829 100644
--- a/win32/Makefile
+++ b/win32/Makefile
@@ -1319,7 +1319,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) utils $(UNIDATAFILES)
 	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
 	attrib -r ..\t\*.*
 	cd ..\t && \
-	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t pragma/*.t
 
 test-prep : all utils ../pod/perltoc.pod
 	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
diff --git a/win32/makefile.mk b/win32/makefile.mk
index a11ac25..6d8a28c 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1596,7 +1596,7 @@ minitest : $(MINIPERL) $(GLOBEXE) $(CONFIGPM) $(UNIDATAFILES) utils
 	$(XCOPY) $(GLOBEXE) ..\t\$(NULL)
 	attrib -r ..\t\*.*
 	cd ..\t && \
-	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t io/*.t opbasic/*.t op/*.t pragma/*.t
+	$(MINIPERL) -I..\lib TEST base/*.t comp/*.t cmd/*.t run/*.t io/*.t re/*.t opbasic/*.t op/*.t uni/*.t perf/*.t pragma/*.t
 
 test-prep : all utils ..\pod\perltoc.pod
 	$(XCOPY) $(PERLEXE) ..\t\$(NULL)
-- 
1.7.10.4

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @cpansprout

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

I have glanced through them and see no problems. I am especially delighted by the PerlIO bit. I wondered why Windows miniperl didn’t support PerlIO, which was annoying.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @bulk88

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

Tony


From d860beb Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 11​:26​:22 +1100
Subject​: build miniperl with PerlIO

Several tests use PerlIO layers (​:utf8, :pop) without testing for it.

non-PerlIO builds were vaguely deprecated in 5.18.0 and can no longer be
enabled on POSIX systems through Configure, so making miniperl PerlIO
on Win32 is no big stretch


I'd rather not see PerlIO on miniperl for perf and debugging reasons. Debugging reasons being fixing/analyzing the problem in miniperl without the overhead of full perl building (make_ext.pl, etc) and my_perl, and PERL_IMPLICIT_SYS/perlhost.h and stepping through all of that extra code. PerlIO falls into more things to step and more things for CC to recompile, and more things for my disassembler to chew through on reloading the binary (miniperl is 200-300 KB smaller than perl521.dll).


From 70d5fab Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 11​:39​:24 +1100
Subject​: use textmode when opening scripts in miniperl to match perl

fixes io/data.t

This could be considered a bug in io/data.t, since it writes the scripts
in text mode, but making miniperl behave closer to perl may fix
other issues too.


This should be fixed in win32.h or perl.h, not with more -Ds on cmd line to CC. You will notice Unix Perl has 1 to 0 -Ds on its command line.


From e63f3dd Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 12​:56​:07 +1100
Subject​: some socket functions aren't available under Win32 miniperl

This only skips for bind, connect, accept() and select().

Other functions are tested in coreamp.t, but either aren't called with
valid handles, so don't reach the "unimplemented" errors, or don't
trigger the errors for other reasons.


I disabled and removed winsock from miniperl for performance reasons. It was also part of effort to offer a full perl build option to disable sockets that I didn't see a reason to finish. Someone (not me) might want to compile out sockets on Win32 for security reasons or something.

I've considered adding a target called "fasttest" or "quicktest" to the win32 makefiles that takes the minitest harness glob patterns and runs those files with full perl, so I can send out more patches to RT per day or per hour. IDK if that is still needed after your patches. I dont see


From d2a14dc Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Tue, 9 Dec 2014 15​:13​:04 +1100
Subject​: minitest​: run the sames tests on win32 as on POSIXish systems


adding porting/*.t to the minitest.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @bulk88

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

Tony


0d1a8a2 Mon Sep 17 00​:00​:00 2001 From​: Tony Cook <tony@​develop-help.com> Date​: Mon, 8 Dec 2014 11​:01​:34 +1100 Subject​: t/TEST​: glob the supplied filenames on Win32 since Win32 perl doesn't glob by default


Why doesn't full perl use setargv.obj? why doesn't miniperl use it? there is an option for setargv.obj ive never tried in win32/Makefile.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Dec 9, 2014

From @tonycoz

On Mon Dec 08 22​:17​:28 2014, bulk88 wrote​:

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most
of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

Tony

--------------------------------------------------------------------

From d860beb Mon Sep 17 00​:00​:00
2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 11​:26​:22 +1100
Subject​: build miniperl with PerlIO

Several tests use PerlIO layers (​:utf8, :pop) without testing for it.

non-PerlIO builds were vaguely deprecated in 5.18.0 and can no longer
be
enabled on POSIX systems through Configure, so making miniperl PerlIO
on Win32 is no big stretch
--------------------------------------------------------------------

I'd rather not see PerlIO on miniperl for perf and debugging reasons.
Debugging reasons being fixing/analyzing the problem in miniperl
without the overhead of full perl building (make_ext.pl, etc) and
my_perl, and PERL_IMPLICIT_SYS/perlhost.h and stepping through all of
that extra code. PerlIO falls into more things to step and more things
for CC to recompile, and more things for my disassembler to chew
through on reloading the binary (miniperl is 200-300 KB smaller than
perl521.dll).

It's also an extra difference for Win32 miniperl from every other perl
maintainers need to deal with, both for p5p and the maintainers of cpan/
modules that use a custom Makefile.PL.

perl5180delta.pod has​:

=head2 Pre-PerlIO IO implementations

In theory, you can currently build perl without PerlIO. Instead, you'd use a
wrapper around stdio or sfio. In practice, this isn't very useful. It's not
well tested, and without any support for IO layers or (thus) Unicode, it's not
much of a perl. Building without PerlIO will most likely be removed in the
next version of perl.

PerlIO supports a C<stdio> layer if stdio use is desired. Similarly a
sfio layer could be produced in the future, if needed.

--------------------------------------------------------------------

From 70d5fab Mon Sep 17 00​:00​:00
2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 11​:39​:24 +1100
Subject​: use textmode when opening scripts in miniperl to match perl

fixes io/data.t

This could be considered a bug in io/data.t, since it writes the
scripts
in text mode, but making miniperl behave closer to perl may fix
other issues too.
---------------------------------------------------------------------
This should be fixed in win32.h or perl.h, not with more -Ds on cmd
line to CC. You will notice Unix Perl has 1 to 0 -Ds on its command
line.

POSIX perl has Configure, VMS perl has configure.com.

Would you like to write configure.cmd?

----------------------------------------------------------------------
From e63f3dd Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Mon, 8 Dec 2014 12​:56​:07 +1100
Subject​: some socket functions aren't available under Win32 miniperl

This only skips for bind, connect, accept() and select().

Other functions are tested in coreamp.t, but either aren't called with
valid handles, so don't reach the "unimplemented" errors, or don't
trigger the errors for other reasons.
-----------------------------------------------------------------------
I disabled and removed winsock from miniperl for performance reasons.
It was also part of effort to offer a full perl build option to
disable sockets that I didn't see a reason to finish. Someone (not me)
might want to compile out sockets on Win32 for security reasons or
something.

I've considered adding a target called "fasttest" or "quicktest" to
the win32 makefiles that takes the minitest harness glob patterns and
runs those files with full perl, so I can send out more patches to RT
per day or per hour. IDK if that is still needed after your patches. I
dont see

minitest is a sanity test for miniperl, it tests a different binary to the main test target.

You can test a subset of the full test suite by setting TEST_FILES​:

  nmake test TEST_FILES="op/*.t run/*.t"

though that's not as simple as a target that does what you suggest.

---------------------------------------------------------------

From d2a14dc Mon Sep 17 00​:00​:00
2001
From​: Tony Cook <tony@​develop-help.com>
Date​: Tue, 9 Dec 2014 15​:13​:04 +1100
Subject​: minitest​: run the sames tests on win32 as on POSIXish systems
---------------------------------------------------------------
adding porting/*.t to the minitest.

minitest is a sanity test for miniperl and several of the tests depend on
XS modules, so they don't work anyway.

Tony

@p5pRT
Copy link
Author

p5pRT commented Dec 16, 2014

From @tonycoz

On Tue Dec 09 03​:05​:26 2014, bulk88 wrote​:

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most
of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

Tony

--------------------------------------------------
0d1a8a2 Mon Sep 17 00​:00​:00 2001
From​: Tony Cook <tony@​develop-help.com> Date​: Mon, 8 Dec 2014 11​:01​:34
+1100 Subject​: t/TEST​: glob the supplied filenames on Win32 since
Win32 perl doesn't glob by default
--------------------------------------------------

Why doesn't full perl use setargv.obj? why doesn't miniperl use it?
there is an option for setargv.obj ive never tried in win32/Makefile.

Is there a way to prevent globbing of specific arguments?

With a POSIX shell you can control which arguments are expanded by quoting the arguments, but that doesn't appear to be possible with setargv.obj.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2015

From @tonycoz

My main aim was to get the minitest process itself working.

Fixing the dependencies in the win32/ makefiles is a separate problem,
since that's broken in other ways[1][2].

On Tue, Jan 06, 2015 at 06​:15​:54PM +0000, Steve Hay wrote​:

On 6 January 2015 at 13​:20, Steve Hay <steve.m.hay@​googlemail.com> wrote​:

Also, I note that it built perl.exe and perl521.dll for some reason,
not just miniperl.exe as I was expecting. Doesn't that slightly defeat
the point of "make minitest"?

I'm still confused by this, though. What is the point of this minitest
target if it builds a full perl anyway? Presumably perl.exe/dll are
"accidentally" getting built due to some makefile prerequisites, which
should ideally be fixed to stop that happening?

Also now fixed in commit 735ecbe.

Thanks.

I thought it would just quickly build miniperl and then run tests. If
it's going to build perl.exe and perl521.dll (as it does) then it
might as well use perl.exe to run the subset of tests listed in the
miniperl target and thus avoid the slight controversy over whether
miniperl.exe should be PERLIO-enabled or not.

(I personally don't mind either way, but I saw there was a question
about that. If pressed, I would prefer "make minitest" to simply build
miniperl.exe only and use that, but that's for ease of testing; I
don't often go debugging in perl internals... If we are going to keep
the PERLIO-enabled miniperl, and perhaps even if not, then we should
consider removing the option in the makefiles for turning off the
PERLIO feature since I saw you noted that it can't be turned off in
Configure for *nix builds any more.)

Any objections to removing the option to disable PERLIO from the makefiles?

I think it makes sense.

Tony

[1] Try nmake, then nmake again, watch most binaries rebuild

[2] nmake install from scratch failed the last time I tried it.

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2015

From @tonycoz

On Mon Dec 08 20​:39​:00 2014, tonyc wrote​:

minitest on Win32 has been broken for a while, starting it fails
because it uses harness, which uses Test​::Harness which requires IO,
which miniperl can't load.

This series of patches switches from harness to TEST and fixes most of
the failures produced from "nmake minitest" on Win32.

I'll wait for any comments, and assuming no problems are found, I'll
commit them.

Applied as 11fbb04 through bfe029f.

Tony

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2015

@tonycoz - Status changed from 'open' to 'resolved'

@p5pRT p5pRT closed this as completed Jan 6, 2015
@p5pRT
Copy link
Author

p5pRT commented Jan 7, 2015

From @steve-m-hay

On 6 January 2015 at 22​:53, Tony Cook <tony@​develop-help.com> wrote​:

My main aim was to get the minitest process itself working.

Fixing the dependencies in the win32/ makefiles is a separate problem,
since that's broken in other ways[1][2].

On Tue, Jan 06, 2015 at 06​:15​:54PM +0000, Steve Hay wrote​:

On 6 January 2015 at 13​:20, Steve Hay <steve.m.hay@​googlemail.com> wrote​:

[...] If we are going to keep
the PERLIO-enabled miniperl, and perhaps even if not, then we should
consider removing the option in the makefiles for turning off the
PERLIO feature since I saw you noted that it can't be turned off in
Configure for *nix builds any more.)

Any objections to removing the option to disable PERLIO from the makefiles?

I think it makes sense.

I will do this soon then.

Tony

[1] Try nmake, then nmake again, watch most binaries rebuild

Yes, that's bugged me ages, as I recently mentioned in
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123513#txn-1324525
I will try to find some tuits for it.

[2] nmake install from scratch failed the last time I tried it.

Not sure I've tried that, but will have a look.

@p5pRT
Copy link
Author

p5pRT commented Jan 7, 2015

From @steve-m-hay

On 7 January 2015 at 08​:44, Steve Hay <steve.m.hay@​googlemail.com> wrote​:

On 6 January 2015 at 22​:53, Tony Cook <tony@​develop-help.com> wrote​:

My main aim was to get the minitest process itself working.

Fixing the dependencies in the win32/ makefiles is a separate problem,
since that's broken in other ways[1][2].

On Tue, Jan 06, 2015 at 06​:15​:54PM +0000, Steve Hay wrote​:

On 6 January 2015 at 13​:20, Steve Hay <steve.m.hay@​googlemail.com> wrote​:

[...] If we are going to keep
the PERLIO-enabled miniperl, and perhaps even if not, then we should
consider removing the option in the makefiles for turning off the
PERLIO feature since I saw you noted that it can't be turned off in
Configure for *nix builds any more.)

Any objections to removing the option to disable PERLIO from the makefiles?

I think it makes sense.

I will do this soon then.

Now done in commit 8c847e6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant