dagolden / Capture-Tiny

(Perl) Capture STDOUT and STDERR from Perl, XS or external programs
http://search.cpan.org/dist/Capture-Tiny/
39 stars 19 forks source link

Some test failed when STDIN > /dev/null #22

Closed serg2014 closed 8 years ago

serg2014 commented 10 years ago

I run test like this

nohup make test &

from man nohup

If  standard  input  is  a  terminal,  redirect  it  from  /dev/null.

and some tests failed

...
Error from open(GLOB(0x17fb550), <&=0): Invalid argument at Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 99.
        Capture::Tiny::_open(GLOB(0x17fb550), "<&=0") called at Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 331
        Capture::Tiny::_capture_tee(1, 1, 0, 0, CODE(0x1b84150)) called at t/lib/Cases.pm line 101
        Cases::__ANON__("perl", "nooutput", "short", "capture") called at t/lib/Cases.pm line 268
        Cases::run_test("capture") called at t/15-stdin-tied.t line 36
# Looks like your test exited with 22 just after 1.
...
Test Summary Report
-------------------
t/08-stdin-closed.t      (Wstat: 139 Tests: 872 Failed: 0)
  Non-zero wait status: 139
  Parse errors: No plan found in TAP output
t/12-stdin-string.t      (Wstat: 139 Tests: 873 Failed: 0)
  Non-zero wait status: 139
  Parse errors: No plan found in TAP output
t/15-stdin-tied.t        (Wstat: 139 Tests: 1 Failed: 0)
  Non-zero wait status: 139
t/22-stdin-badtie.t      (Wstat: 5632 Tests: 1 Failed: 0)
  Non-zero exit status: 22
t/23-all-tied.t          (Wstat: 139 Tests: 3 Failed: 0)
  Non-zero wait status: 139
t/24-all-badtied.t       (Wstat: 5632 Tests: 3 Failed: 0)
  Non-zero exit status: 22
Files=23, Tests=9084, 26 wallclock secs ( 1.09 usr  0.15 sys + 11.54 cusr 11.71 csys = 24.49 CPU)
Result: FAIL
Failed 6/23 test programs. 0/9084 subtests failed.
make: *** [test_dynamic] Error 22
dagolden commented 9 years ago

Hi. Sorry to take so long responding.

What operating system and Perl? Can you give me the output of 'perl -V' please?

serg2014 commented 9 years ago

/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/bin/perl -V

Summary of my perl5 (revision 5 version 14 subversion 2) configuration:

  Platform:
    osname=linux, osvers=3.2.0-67-virtual, archname=march-thread-multi
    uname='linux 3.2.0-67-virtual #101-ubuntu smp tue jul 15 17:58:37 utc 2014 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dprefix=/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2 -Dscriptdir=/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/bin -Dcc='/usr/local/bin/gcc44' -Dld='/usr/local/bin/gcc44' -Dusethreads -Dusemultiplicity -Duseshrplib -Dusefaststdio -Doptimize='-O3' -Darchname='march'  -Uusemallocwrap -DPERL_DISABLE_PMC -Dlocincpth=/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/5.14.2/march-thread-multi/CORE /home/user_name/repository_folder/contrib/libs/bdb /home/user_name/repository_folder/contrib/libs/openssl /home/user_name/repository_folder/contrib/libs/zlib /home/user_name/repository_folder/ -Dloclibpth=/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/5.14.2/march-thread-multi/CORE /home/user_name/perl_build/contrib/libs/bdb /home/user_name/perl_build/bundle.t.1568312/lib'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='/usr/local/bin/gcc44', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/home/user_name/repository_folder/contrib/libs/bdb -I/hom e/user_name/repository_folder/contrib/libs/openssl -I/home/user_name/repository_folder/contrib/libs/zlib -I/home/user_name/repository_folder/ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/home/user_name/repository_folder/contrib/libs/bdb -I/home/user_name/repository_folder/contrib/l ibs/openssl -I/home/user_name/repository_folder/contrib/libs/zlib -I/home/user_name/repository_folder/'
    ccversion='', gccversion='4.4.7', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='/usr/local/bin/gcc44', ldflags =' -fstack-protector -L/home/user_name/perl_build/contrib/libs/bdb -L/home/user_name/perl_build/bundle.t.1568312/lib'
    libpth=/home/user_name/perl_build/contrib/libs/bdb /home/user_name/perl_build/bundle.t.1568312/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-lin ux-gnu /usr/lib/../lib /lib /usr/lib /usr/local/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.15'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/5.14.2/march-th read-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O3 -L/home/user_name/perl_build/contrib/libs/bdb -L/home/user_name/perl_build/bundle.t.1568312/lib -fstack-prote ctor'

Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
                        PERL_IMPLICIT_CONTEXT PERL_PRESERVE_IVUV
                        USE_64_BIT_ALL USE_64_BIT_INT USE_FAST_STDIO
                        USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
                        USE_REENTRANT_API
  Built under linux
  Compiled at Feb 12 2015 12:42:53
  @INC:
    /home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/site_perl/5.14.2/march-thread-multi
    /home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/site_perl/5.14.2
    /home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/5.14.2/march-thread-multi
    /home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/lib/5.14.2
    .

when run make test - all ok. but nohup make test & failed this is output of test

PERL_DL_NONLAZY=1 /home/user_name/perl_build/bundle.t.1568312/perl-5.14.2/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
#
# Versions for all modules listed in MYMETA.yml (including optional ones):
#
# === Configure Requires ===
#
#     Module              Want    Have
#     ------------------- ---- -------
#     ExtUtils::MakeMaker 6.17 6.99_08
#
# === Build Requires ===
#
#     Module              Want    Have
#     ------------------- ---- -------
#     ExtUtils::MakeMaker  any 6.99_08
#
# === Test Requires ===
#
#     Module              Want     Have
#     ------------------- ---- --------
#     ExtUtils::MakeMaker  any  6.99_08
#     File::Spec           any     3.33
#     IO::File             any     1.15
#     Test::More          0.62 1.001003
#     lib                  any     0.63
#
# === Test Recommends ===
#
#     Module         Want     Have
#     ---------- -------- --------
#     CPAN::Meta 2.120900 2.142060
#     Inline::C      0.50  missing
#
# === Runtime Requires ===
#
#     Module              Want     Have
#     ------------------- ---- --------
#     Carp                 any   1.3301
#     Exporter             any  5.64_03
#     ExtUtils::MakeMaker  any  6.99_08
#     File::Spec           any     3.33
#     File::Temp           any     0.22
#     IO::File             any     1.15
#     IO::Handle           any     1.31
#     Scalar::Util         any     1.23
#     Test::More          0.62 1.001003
#     lib                  any     0.63
#     strict               any     1.04
#     warnings             any     1.12
t/00-report-prereqs.t ...... ok
t/01-Capture-Tiny.t ........ ok
t/02-capture.t ............. ok
t/03-tee.t ................. ok
t/06-stdout-closed.t ....... ok
t/07-stderr-closed.t ....... ok
Error from open( GLOB(0x180e440), <&-1): Invalid argument at t/lib/Utils.pm line 12.
t/08-stdin-closed.t ........
All 872 subtests passed
t/09-preserve-exit-code.t .. ok
t/10-stdout-string.t ....... ok
t/11-stderr-string.t ....... ok
Error from open( GLOB(0xc814a0), >&-1): Invalid argument at t/lib/Utils.pm line 12.
t/12-stdin-string.t ........
All 873 subtests passed
t/13-stdout-tied.t ......... ok
t/14-stderr-tied.t ......... ok
Error from open(GLOB(0xd14440), <&=0): Invalid argument at /home/user_name/perl_build/bundle/perl/modules/Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 99.
        Capture::Tiny::_open(GLOB(0xd14440), "<&=0") called at /home/user_name/perl_build/bundle/perl/modules/Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 331
        Capture::Tiny::_capture_tee(1, 1, 0, 0, CODE(0xd14380)) called at t/lib/Cases.pm line 101
        Cases::__ANON__("perl", "nooutput", "short", "capture") called at t/lib/Cases.pm line 268
        Cases::run_test("capture") called at t/15-stdin-tied.t line 36
# Looks like your test exited with 22 just after 1.
t/15-stdin-tied.t ..........
All 1 subtests passed
t/16-catch-errors.t ........ ok
t/17-pass-results.t ........ ok
t/18-custom-capture.t ...... ok
t/19-inline-c.t ............ skipped: Inline module required
t/20-stdout-badtie.t ....... ok
t/21-stderr-badtie.t ....... ok
Error from open(GLOB(0x17a9440), <&=0): Invalid argument at /home/user_name/perl_build/bundle/perl/modules/Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 99.
        Capture::Tiny::_open(GLOB(0x17a9440), "<&=0") called at /home/user_name/perl_build/bundle/perl/modules/Capture-Tiny-0.25/blib/lib/Capture/Tiny.pm line 331
        Capture::Tiny::_capture_tee(1, 1, 0, 0, CODE(0x17a9b60)) called at t/lib/Cases.pm line 101
        Cases::__ANON__("perl", "nooutput", "short", "capture") called at t/lib/Cases.pm line 268
        Cases::run_test("capture", "", "skip_utf8") called at t/22-stdin-badtie.t line 33
# Looks like your test exited with 22 just after 1.
t/22-stdin-badtie.t ........
Dubious, test returned 22 (wstat 5632, 0x1600)
All 1 subtests passed
# Looks like your test exited with 22 just after 3.
error from open(glob(0x20d4440), <&=0): invalid argument at /home/user_name/perl_build/bundle/perl/modules/capture-tiny-0.25/blib/lib/capture/tiny.pm line 99.
        capture::tiny::_open(glob(0x20d4440), "<&=0") called at /home/user_name/perl_build/bundle/perl/modules/capture-tiny-0.25/blib/lib/capture/tiny.pm line 331
        capture::tiny::_capture_tee(1, 1, 0, 0, code(0x267c640)) called at t/lib/cases.pm line 101
        cases::__anon__("perl", "nooutput", "short", "capture") called at t/lib/cases.pm line 268
        cases::run_test("capture") called at t/23-all-tied.t line 40
t/23-all-tied.t ............
All 3 subtests passed
Use of uninitialized value $\ in join or string at t/lib/TieEvil.pm line 28.
# Looks like your test exited with 22 just after 3.
t/24-all-badtied.t .........
Dubious, test returned 22 (wstat 5632, 0x1600)
All 3 subtests passed

Test Summary Report
-------------------
t/08-stdin-closed.t      (Wstat: 11 Tests: 872 Failed: 0)
  Non-zero wait status: 11
  Parse errors: No plan found in TAP output
t/12-stdin-string.t      (Wstat: 11 Tests: 873 Failed: 0)
  Non-zero wait status: 11
  Parse errors: No plan found in TAP output
t/15-stdin-tied.t        (Wstat: 11 Tests: 1 Failed: 0)
  Non-zero wait status: 11
t/22-stdin-badtie.t      (Wstat: 5632 Tests: 1 Failed: 0)
  Non-zero exit status: 22
t/23-all-tied.t          (Wstat: 11 Tests: 3 Failed: 0)
  Non-zero wait status: 11
t/24-all-badtied.t       (Wstat: 5632 Tests: 3 Failed: 0)
  Non-zero exit status: 22
Files=23, Tests=9084, 61 wallclock secs ( 1.83 usr  0.15 sys + 20.44 cusr 18.54 csys = 40.96 CPU)
Result: FAIL
Failed 6/23 test programs. 0/9084 subtests failed.
make: *** [test_dynamic] Error 22
ribasushi commented 9 years ago

This continues being a problem, though no longer a segfault. Reliably reproducible here on any 5.8.x. I will look into this later on, just dropping a log for my own sake (or for whoever beats me to it):

rabbit@Ahasver:~/devel/dbic$ cpanm --look Capture::Tiny
--> Working on Capture::Tiny
Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Capture-Tiny-0.30.tar.gz ... OK
Entering /home/rabbit/.cpanm/work/1441631393.28658/Capture-Tiny-0.30 with /bin/bash
rabbit@Ahasver:~/.cpanm/work/1441631393.28658/Capture-Tiny-0.30$ prove -l t/12-stdin-string.t 
t/12-stdin-string.t .. ok     
All tests successful.
Files=1, Tests=873,  2 wallclock secs ( 0.23 usr  0.01 sys +  1.76 cusr  0.56 csys =  2.56 CPU)
Result: PASS
rabbit@Ahasver:~/.cpanm/work/1441631393.28658/Capture-Tiny-0.30$ prove -l t/12-stdin-string.t < /dev/null
t/12-stdin-string.t .. 758/? Error from open( GLOB(0x19b5f30), >&3): Invalid argument at t/lib/Utils.pm line 12.
# Looks like your test exited with 22 just after 873.
t/12-stdin-string.t .. Dubious, test returned 22 (wstat 5632, 0x1600)
All 873 subtests passed 

Test Summary Report
-------------------
t/12-stdin-string.t (Wstat: 5632 Tests: 873 Failed: 0)
  Non-zero exit status: 22
Files=1, Tests=873,  3 wallclock secs ( 0.22 usr  0.01 sys +  1.69 cusr  0.65 csys =  2.57 CPU)
Result: FAIL
ribasushi commented 8 years ago

This can be closed as a duplicate of https://github.com/dagolden/Capture-Tiny/pull/42

xdg commented 8 years ago

Fixed with #42