Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTTP-Tiny CPAN distribution.

Report information
The Basics
Id: 65430
Status: resolved
Priority: 0/
Queue: HTTP-Tiny

People
Owner: Nobody in particular
Requestors: cberry [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.009
Fixed in: (no value)



Subject: [PATCH] minor test tweaks for portability
When HTTP::Tiny came into blead, it failed a lot of tests on VMS but not for very deep reasons. The attached patch gets everything passing. I think the only thing that won't be self explanatory is that -s (or the st_size field returned by fstat) has a delay in getting populated so it's not necessarily there when you first write to a file, and this made the sanity check in the slurp() function in t/Util.pm always fail. My hack/workaround was to seek to EOF and use the result of tell() as the file size for comparison just before rewinding. May not be pretty but for these tiny files used for testing purposes it shouldn't matter much.
Subject: http_tiny.patch
--- cpan/HTTP-Tiny/t/110_mirror.t;-0 2011-01-16 20:06:14 -0600 +++ cpan/HTTP-Tiny/t/110_mirror.t 2011-02-03 15:27:33 -0600 @@ -17,11 +17,12 @@ use t::Util qw[tmpfile rewind slurp m set_socket_source sort_headers $CRLF $LF]; use HTTP::Tiny; use File::Temp qw/tempdir/; +use File::Spec qw/catfile/; BEGIN { monkey_patch() } my $tempdir = tempdir( TMPDIR => 1, CLEANUP => 1 ); -my $tempfile = $tempdir . "/tempfile.txt"; +my $tempfile = File::Spec->catfile( $tempdir, "tempfile.txt" ); my $known_epoch = 760233600; my $day = 24*3600; @@ -32,7 +33,7 @@ my %timestamp = ( ); for my $file ( dir_list("t/cases", qr/^mirror/ ) ) { - unlink $tempfile; + 1 while unlink $tempfile; my $data = do { local (@ARGV,$/) = $file; <> }; my ($params, $expect_req, $give_res) = split /--+\n/, $data; # cleanup source data --- cpan/HTTP-Tiny/t/Util.pm;-0 2011-01-16 20:06:14 -0600 +++ cpan/HTTP-Tiny/t/Util.pm 2011-02-03 15:19:32 -0600 @@ -11,7 +11,7 @@ package t::Util; use strict; use warnings; -use IO::File q[SEEK_SET]; +use IO::File qw(SEEK_SET SEEK_END); use IO::Dir; BEGIN { @@ -72,12 +72,16 @@ sub dir_list { sub slurp (*) { my ($fh) = @_; + seek($fh, 0, SEEK_END) + || die(qq/Couldn't navigate to EOF on file handle: '$!'/); + + my $exp = tell($fh); + rewind($fh); binmode($fh) || die(qq/Couldn't binmode file handle: '$!'/); - my $exp = -s $fh; my $buf = do { local $/; <$fh> }; my $got = length $buf;
Subject: Re: [rt.cpan.org #65430] [PATCH] minor test tweaks for portability
Date: Fri, 4 Feb 2011 01:18:26 +0000
To: bug-HTTP-Tiny [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Thu, Feb 3, 2011 at 9:49 PM, Craig A. Berry via RT <bug-HTTP-Tiny@rt.cpan.org> wrote: Show quoted text
> When HTTP::Tiny came into blead, it failed a lot of tests on VMS but not for very deep reasons. > The attached patch gets everything passing.
Thank you. I'll try to get to that "soonish" as part of my big push to get stuff into/fixed in blead for stuff I maintain. -- David
Applied and released as 0.010. Blead has been patched as well.