in reply to Test fails: 01_Archive-Extract.t and TGZ files

It's not clear to me as to why you had to update the programs that you listed. Archive::Extract is a core, dual-lived module. I can't get any of the 1716 tests to fail:). Maybe this can help.
#!/usr/bin/perl use strict; use warnings; use TAP::Harness; $| = 1; my %args = ( verbosity => 1, timer => 1, color => 1, errors => 1, trap => 1, merge => 1, ); my @tests = '/root/Desktop/extract/Archive-Extract-0.58/t/01_Archive- +Extract.t'; my $harness = TAP::Harness->new( \%args ); $harness->runtests(@tests); print $harness->aggregate_tests;

Replies are listed 'Best First'.
Re^2: Test fails: 01_Archive-Extract.t and TGZ files
by compused (Acolyte) on Feb 15, 2012 at 13:20 UTC
    Hi Khen1950fx...

    I got the same error msg, after using your script on the 0.58 version of Archive-Extract.

    I downloaded the many archiving programs because I thought that was the problem.

    /MY/DIR/PATH/monks.pl [23:42:16] /root/.cpan/build/Archive-Extract-0.58-G2ny5_/t/01_Archive- +Extract.t .. ok 1 - use Archive::Extract; ok 2 - Archive::Extract->can('types') ok 3 - Got a list of types Key 'archive' (01_Archive-Extract.t) is of invalid type for 'Archive:: +Extract::new' provided by ANON at /root/.cpan/build/Archive-Extract-0 +.58-G2ny5_/t/01_Archive-Extract.t line 263 not ok 4 - Object created based on 'tgz' # Failed test ' Object created based on 'tgz'' # at /root/.cpan/build/Archive-Extract-0.58-G2ny5_/t/01_Archive-Extr +act.t line 264. Can't call method "error" on an undefined value at /root/.cpan/build/A +rchive-Extract-0.58-G2ny5_/t/01_Archive-Extract.t line 265. 1..4 # Looks like you failed 1 test of 4. # Looks like your test exited with 2 just after 4. Dubious, test returned 2 (wstat 512, 0x200) Failed 1/4 subtests [23:42:18]

      The only way I can make the tests fail in this manner are to attempt to run the tests when the current working directory is not the directory of the extracted tarball.

      $ pwd /home/chris [canker:]$ perl foo.pl [20:33:46] /home/chris/repos/toolchain/Archive-Extract/t/01_Archive-Ex +tract.t .. ok 1 - use Archive::Extract; ok 2 - Archive::Extract->can('types') ok 3 - Got a list of types # 01_Archive-Extract.t Key 'archive' (01_Archive-Extract.t) is of invalid type for 'Archive:: +Extract::new' provided by ANON at /home/chris/repos/toolchain/Archive +-Extract/t/01_Archive-Extract.t line 264 not ok 4 - Object created based on 'tgz' # Failed test ' Object created based on 'tgz'' # at /home/chris/repos/toolchain/Archive-Extract/t/01_Archive-Extrac +t.t line 265. Can't call method "error" on an undefined value at /home/chris/repos/t +oolchain/Archive-Extract/t/01_Archive-Extract.t line 266. 1..4 # Looks like you failed 1 test of 4. # Looks like your test exited with 2 just after 4. Dubious, test returned 2 (wstat 512, 0x200) Failed 1/4 subtests [20:33:47] Test Summary Report ------------------- /home/chris/repos/toolchain/Archive-Extract/t/01_Archive-Extract.t (Ws +tat: 512 Tests: 4 Failed: 1) Failed test: 4 Non-zero exit status: 2 Files=1, Tests=4, 1 wallclock secs ( 0.12 usr 0.03 sys + 0.83 cusr + 0.09 csys = 1.07 CPU) Result: FAIL [canker:]$ cd /home/chris/repos/toolchain/Archive-Extract/ [canker:(master)]$ perl /home/chris/foo.pl [20:35:43] /home/chris/repos/toolchain/Archive-Extract/t/01_Archive-Ex +tract.t .. ok 1 - use Archive::Extract; ok 2 - Archive::Extract->can('types') ok 3 - Got a list of types # 01_Archive-Extract.t ok 4 - Object created based on 'tgz' ok 5 - No error logged ok 6 - Object created based on 'tar' ok 7 - No error logged ok 8 - Object created based on 'gz' ok 9 - No error logged ok 10 - Object created based on 'zip' ok 11 - No error logged ok 12 - Object created based on 'bz2' ok 13 - No error logged ok 14 - Object created based on 'tbz' ok 15 - No error logged ok 16 - Object created based on 'Z' ok 17 - No error logged ok 18 - Object created based on 'lzma' ok 19 - No error logged ok 20 - Object created based on 'xz' ok 21 - No error logged ok 22 - Object created based on 'txz' ok 23 - No error logged ok 24 - No archive created based on '01_Archive-Extract.t' ok 25 - Error not captured in class method ok 26 - Error captured as warning ok 27 - Error is: unknown file type ok 28 - Archive created ok 29 - No errors yet ok 30 - Errors retrieved ##### etc etc Ad nauseam until ok 1706 - Archive type is_txz recognized properly ok 1707 # skip No binaries or modules to extract x.tar.xz ok 1708 # skip No binaries or modules to extract x.tar.xz ok 1709 # skip No binaries or modules to extract x.tar.xz ok 1710 # skip No binaries or modules to extract x.tar.xz ok 1711 # skip No binaries or modules to extract x.tar.xz ok 1712 # skip No binaries or modules to extract x.tar.xz ok 1713 # skip No binaries or modules to extract x.tar.xz ok 1714 # skip No binaries or modules to extract x.tar.xz ok 1715 # skip No binaries or modules to extract x.tar.xz ok 1716 # skip No binaries or modules to extract x.tar.xz 1..1716 ok 9201 ms [20:35:44] All tests successful. Files=1, Tests=1716, 10 wallclock secs ( 1.21 usr 0.05 sys + 5.56 cu +sr 3.58 csys = 10.40 CPU) Result: PASS

      foo.pl is just a path amended version of Khen1950fx's script.

      That said, this is different to your original output which appeared to be from being in the perl source tree. Okay, let's have a go at breaking that.

      bingos@harlequin:~/repos/perl.git$ cd t/ bingos@harlequin:~/repos/perl.git/t$ ./perl harness ../cpan/Archive-Ex +tract/t/01_Archive-Extract.t ../cpan/Archive-Extract/t/01_Archive-Extract.t .. ok All tests successful. Files=1, Tests=1704, 5 wallclock secs ( 0.64 usr 0.02 sys + 2.64 cu +sr 0.64 csys = 3.94 CPU) Result: PASS

      I don't know then. The tests in your output appear to be failing before they reach the 'archive' tests, namely because they aren't being run from the correct current working directory.

        thanx...via cpan I installed the latest (0.58) Archive::Extract but 'make test' gives 154 failures and says it will only install with force; using the foo.pl file also gives 154 errors. Here it is (& is it ok/how do you do the forced install?:

        (for all of it go to: http://paste2.org/p/1905968 )

        cpan[2]> install Archive::Extract etc etc etc Writing Makefile for Archive::Extract Writing MYMETA.yml cp lib/Archive/Extract.pm blib/lib/Archive/Extract.pm BINGOS/Archive-Extract-0.58.tar.gz /share/MD0_DATA/.qpkg/Optware/bin/make -- OK Running make test PERL_DL_NONLAZY=1 /share/MD0_DATA/.qpkg/Optware/bin/perl "-MExtUtils:: +Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/01_Archive-Extract.t .. 24/? # Failed test 'extract() for 'double_dir.zip' reports success (PP: 0 + Bin: 1)' # at t/01_Archive-Extract.t line 478. # Failed test 'Found correct number of output files ()' # at t/01_Archive-Extract.t line 491. # got: '0' # expected: '2' # Failed test 'Found correct output file 'x/w'' # at t/01_Archive-Extract.t line 498. # got: undef # expected: 'x/w' # Failed test 'Output file '/share/MD0_DATA/.cpan/build_dir/Archive- +Extract-0.58-rulOTV/t/out/x/w' exists' # at t/01_Archive-Extract.t line 501. # Failed test 'Extract dir found' # at t/01_Archive-Extract.t line 503. Use of uninitialized value in -d at t/01_Archive-Extract.t line 505. # Failed test 'Extract dir exists' # at t/01_Archive-Extract.t line 505. # Failed test 'Extract dir is expected '/share/MD0_DATA/.cpan/build_ +dir/Archive-Extract-0.58-rulOTV/t/out/x'' # at t/01_Archive-Extract.t line 507. # got: undef etc etc t/01_Archive-Extract.t .. 1479/? # Looks like you failed 154 tests of +1584. t/01_Archive-Extract.t .. Dubious, test returned 154 (wstat 39424, 0x9 +a00) Failed 154/1584 subtests (less 538 skipped subtests: 892 okay) Test Summary Report ------------------- t/01_Archive-Extract.t (Wstat: 39424 Tests: 1584 Failed: 154) Failed tests: 87, 89-94, 98, 100-105, 111, 113-118, 122 124-129, 231, 233-238, 242, 244-249, 435 437-442, 446, 448-453, 507, 509-514, 518 520-525, 555, 557-562, 566, 568-573, 651 653-658, 662, 664-669, 711, 713-718, 722 724-729, 783, 785-790, 794, 796-801, 807 809-814, 818, 820-825, 831, 833-838, 842 844-849 Non-zero exit status: 154 Files=1, Tests=1584, 13 wallclock secs ( 1.46 usr 0.02 sys + 8.34 cu +sr 2.33 csys = 12.15 CPU) Result: FAIL # expected: '/share/MD0_DATA/.cpan/build_dir/Archive-Extract-0.58- +rulOTV/t/out/x'