You are here: Foswiki>Tasks Web>Item12077 (02 Dec 2012, GeorgeClark)Edit Attach

Item12077: Unit tests appear to hang if Archive::Zip and zip/unzip tools are not installed

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.6
Target Release: patch
Applies To: Extension
Component: UnitTestContrib, Configure
Branches: Release01x01 trunk
Reported By: GeorgeClark
Waiting For:
Last Change By: GeorgeClark
Sven built up a new minimal test machine and the unit tests were "apparently" hanging with no out from or beyond the Fn_SEARCH tests.

Actually all of the unit test output was being captured into the worker output from search.

The root cause appears to be the ConfigureTests for installing a zip archive. If the perl Archive::Zip is not installed, Foswiki::Configure::Util then attempts to use the system provided unzip tool. If unzip is also missing, then something gets messed up in the capturing of stdout / stderr.

    ... unzip using Archive::Zip unless not available ...

    else {
        eval {
            my $out = `unzip -n $archive`;
            die "$? - $!" if ($?);
            1;
        } or do {
            $error = "unzip failed $@ \n";
        };
    }

    return $error;

After this code runs and returns the error - that zip is not found, the TestRunner appears to get lost capturing output, and it becomes more obvious when Fn_SEARCH runs. If you tail the worker capture file, it is getting ALL of the test output.

The simple workaround is to either install unzip or Archive::Zip, but something else is wrong.

-- GeorgeClark - 17 Sep 2012

Babar found the solution.

(10:42:22 AM) Babar: http://perldoc.perl.org/perl5140delta.html#Exception-Handling
(10:42:42 AM) Babar: but... resetting $@ to '' at the end of the eval _might_ help
(10:50:10 AM) gac410: Cool  Babar,  resetting $@ seems to fix the unit tests.
(10:50:28 AM) gac410: At least stdout doesn't get stuck
(10:50:53 AM) Babar: (don't thank me, thank Vincent Pit who suggested it)

ItemTemplate edit

Summary Unit tests appear to hang if Archive::Zip and zip/unzip tools are not installed
ReportedBy GeorgeClark
Codebase 1.1.5, trunk
SVN Range
AppliesTo Extension
Component UnitTestContrib, Configure
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:53408c05365a distro:905599ffe9d6
TargetRelease patch
ReleasedIn 1.1.6
CheckinsOnBranches Release01x01 trunk
trunkCheckins distro:53408c05365a
Release01x01Checkins distro:905599ffe9d6
Topic revision: r6 - 02 Dec 2012, GeorgeClark - This page was cached on 30 Jun 2016 - 11:14.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License