doy / try-tiny

minimal try/catch with proper preservation of $@
http://metacpan.org/release/Try-Tiny
10 stars 15 forks source link

tests fail on perl builds without Win32 psuedo-fork #19

Open bulk88 opened 10 years ago

bulk88 commented 10 years ago

I am using a non-default Win32 Perl build that was built without psuedo-fork but with ithreads. A test fails on this build. Also unthreaded Win32 Perl shows the same exact failure t/global_destruction_forked.t .

C:\sources\Try-Tiny-0.22>perl makefile.pl & nmake test
Checking if your kit is complete...
Looks good
Generating a nmake-style Makefile
Writing Makefile for Try::Tiny
Writing MYMETA.yml and MYMETA.json

Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

cp lib/Try/Tiny.pm blib\lib\Try\Tiny.pm
        C:\perl521\nosys\bin\perl.exe "-MExtUtils::Command::MM" "-MTest::Harness
" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')
" t/*.t
t/00-compile.t ................. ok
t/basic.t ...................... ok
t/context.t .................... ok
t/erroneous_usage.t ............ ok
t/finally.t .................... ok
t/given_when.t ................. ok
t/global_destruction_forked.t .. # Looks like you planned 3 tests but ran 1.
t/global_destruction_forked.t .. Dubious, test returned 255 (wstat 65280, 0xff00
)
Failed 2/3 subtests
t/global_destruction_load.t .... skipped: Capture::Tiny 0.12 required
t/named.t ...................... skipped: Sub::Name required
t/when.t ....................... ok

Test Summary Report
-------------------
t/global_destruction_forked.t (Wstat: 65280 Tests: 1 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 3 tests but ran 1.
Files=10, Tests=94,  1 wallclock secs ( 0.09 usr +  0.03 sys =  0.13 CPU)
Result: FAIL
Failed 1/10 test programs. 0/94 subtests failed.
NMAKE : fatal error U1077: 'C:\perl521\nosys\bin\perl.exe' : return code '0xff'
Stop.

C:\sources\Try-Tiny-0.22>perl -V
Summary of my perl5 (revision 5 version 21 subversion 1) configuration:
  Derived from: 20b537ecacc997cc7ff6878c104d204dfee4c12c
  Ancestor: 234105dd8a732de5fb48ccb1838c99281f89f669
  Platform:
    osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -GF -W3 -O1 -MD -Zi -DNDEBUG -G7 -GL -DWIN32 -D_C
ONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS -DPERL_HASH_FUNC_ONE_AT_A_TIME -DPER
L_IMPLICIT_CONTEXT -DUSE_PERLIO -D_USE_32BIT_TIME_T',
    optimize='-O1 -MD -Zi -DNDEBUG -G7 -GL',
    cppflags='-DWIN32'
    ccversion='13.10.6030', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksi
ze=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpa
th:"c:\perl521\nosys\lib\CORE"  -machine:x86'
    libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib"
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.l
ib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32
.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.
lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg
32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws
2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msv
crt.lib
    libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -l
tcg  -libpath:"c:\perl521\nosys\lib\CORE"  -machine:x86'

Characteristics of this binary (from libperl):
  Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
                        PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME PERL_IMPLICIT_CONTEXT
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Locally applied patches:
        uncommitted-changes
        7494266ea378a3cdc4bfd51725012c1e432db0f1
        61961437d9453dd0d4053ad100e97a029a24edbb
        cd30b936fc5177ce169d776445d09c9898c15da1
        1abbcfa06576bf8a6937c566bb4d18ba803b59d8
        31407cc0c30629e7260a7b42432b42973f8685f6
        20b537ecacc997cc7ff6878c104d204dfee4c12c
  Built under MSWin32
  Compiled at May 31 2014 16:03:46
  @INC:
    C:/perl521/nosys/site/lib
    C:/perl521/nosys/lib
    .

C:\sources\Try-Tiny-0.22>perl -Iblib/lib t/global_destruction_forked.t
1..3
ok 1 - Didn't just exit
# Looks like you planned 3 tests but ran 1.

C:\sources\Try-Tiny-0.22>perl -MConfig -E" say $Config{d_fork}"

C:\sources\Try-Tiny-0.22>perl -MConfig -E" say $Config{d_psuedofork}"

C:\sources\Try-Tiny-0.22>perl -MConfig -E" say $Config{d_pipe}"
define

C:\sources\Try-Tiny-0.22>perl -MConfig -E" say $Config{useithreads}"
define

C:\sources\Try-Tiny-0.22>
doy commented 10 years ago

I don't have access to a Windows system that I can build custom perls on. Can you come up with a patch?

bulk88 commented 10 years ago

What is t/global_destruction_forked.t supposed to be doing? Write a skip_all for no-fork perl?

no-fork Win32 perl

C:\sources\Try-Tiny-0.22>perl -E" say fork"
The fork function is unimplemented at -e line 1.

C:\sources\Try-Tiny-0.22>
C:\sources\Try-Tiny-0.22>perl -Iblib/lib t/global_destruction_forked.t
1..3
ok 1 - Didn't just exit
# Looks like you planned 3 tests but ran 1.

C:\sources\Try-Tiny-0.22>

with fork Win32 perl

C:\sources\Try-Tiny-0.22>perl -E" say fork"
-15424
0

C:\sources\Try-Tiny-0.22>
C:\sources\Try-Tiny-0.22>perl -Iblib/lib t/global_destruction_forked.t
1..3
ok 1 - nested try in cleanup after fork does not maintain outer catch block
ok 2 - nested try in cleanup after fork does not maintain outer finally block
ok 3 - Didn't just exit

C:\sources\Try-Tiny-0.22>
doy commented 10 years ago

Looks like it's related to perlbug #119311 (see commit 130617d). If that bug isn't relevant on no-fork perls, I'm fine to just skip.

bulk88 commented 10 years ago

I dont have enough time to immediately figure out what was happening in #119311 and if that bug applies to no-fork perls, since I can't automatically say its fork-only, since it has something to do with exception unwinding/call stack unwinding, which is not fork-exclusive.