Skip Menu |

This queue is for tickets about the CGI-Application-Plugin-AJAXUpload CPAN distribution.

Report information
The Basics
Id: 88002
Status: open
Priority: 0/
Queue: CGI-Application-Plugin-AJAXUpload

People
Owner: Nobody in particular
Requestors: dam [...] cpan.org
gregoa [...] debian.org
Cc:
AdminCc:

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



From: gregoa [...] cpan.org
Subject: libcgi-application-plugin-ajaxupload-perl: FTBFS with perl 5.18: test failures
This bug has been forwarded from http://bugs.debian.org/719986 -->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->-->--> Source: libcgi-application-plugin-ajaxupload-perl Version: 0.0.3-3 Severity: serious Justification: transition imminent User: debian-perl@lists.debian.org Usertags: perl-5.18-transition Tags: sid jessie This package FTBFS with perl 5.18: # Failed test 'UPLOADED (body match)' # at t/lib/TestWebApp.pm line 54. # '{"image_url":"/images/test.txt","status":"UPLOADED"}' # doesn't match '(?^msx:{"status":"UPLOADED","image_url":"/images/test.t xt"})' # Looks like you failed 1 test of 4. # Failed test 'options' # at t/02.warnings.t line 310. # Failed test 'UPLOADED (body match)' # at t/lib/TestWebApp.pm line 54. # '{"image_url":"/img/uploads/test.txt","status":"UPLOADED"}' # doesn't match '(?^msx:{"status":"UPLOADED","image_url":"/img/uploads/test.txt"})' # Looks like you failed 1 test of 4. # Failed test 'UPLOADED' # at t/02.warnings.t line 336. # Looks like you failed 2 tests of 12. t/02.warnings.t ... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/12 subtests # Failed test 'UPLOADED (body match)' # at t/lib/TestWebApp.pm line 54. # '{"image_url":"/img/uploads/test.jpeg","status":"UPLOADED"}' # doesn't match '(?^msx:{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"})' # Looks like you failed 1 test of 4. # Failed test 'UPLOADED' # at t/03.images.t line 272. # Looks like you failed 1 test of 10. t/03.images.t ..... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/10 subtests # Failed test 'UPLOADED (body match)' # at t/lib/TestWebApp.pm line 54. # '{"image_url":"/images/test.jpeg","status":"UPLOADED"}' # doesn't match '(?^msx:{"status":"UPLOADED","image_url":"/images/test.jpeg"})' # Looks like you failed 1 test of 4. # Failed test 'options' # at t/04-resize.t line 274. # Failed test 'UPLOADED (body match)' # at t/lib/TestWebApp.pm line 54. # '{"image_url":"/img/uploads/test.jpeg","status":"UPLOADED"}' # doesn't match '(?^msx:{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"})' # Looks like you failed 1 test of 4. # Failed test 'square' # at t/04-resize.t line 354. # Looks like you failed 2 tests of 12. t/04-resize.t ..... Dubious, test returned 2 (wstat 512, 0x200) Failed 2/12 subtests ... Test Summary Report ------------------- t/02.warnings.t (Wstat: 512 Tests: 12 Failed: 2) Failed tests: 10-11 Non-zero exit status: 2 t/03.images.t (Wstat: 256 Tests: 10 Failed: 1) Failed 3/13 test programs. 5/38 subtests failed. Failed test: 9 Non-zero exit status: 1 t/04-resize.t (Wstat: 512 Tests: 12 Failed: 2) Failed tests: 8, 11 Non-zero exit status: 2 Files=13, Tests=38, 2 wallclock secs ( 0.07 usr 0.05 sys + 1.65 cusr 0.26 csys = 2.03 CPU) Result: FAIL dh_auto_test: perl Build test returned exit code 255 make: *** [build] Error 255 Cheers, Dominic. <--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<--<-- Thanks in advance, gregor herrmann, Debian Perl Group
Attached is a patch that makes the tests compare structures via is_deeply(), instead of like() over json-encoded string representation. The later approach is problematic, since json-encoded structures can use random key order, as is the case with perl 5.18.
Subject: compare-structures.patch
Description: compare structures as such, not as json-encoded strings The problem with json-encoded strings is that hash keys' order is unpredictable from perl 5.18 on Author: Damyan Ivanov <dmn@debian.org> Bug: https://rt.cpan.org/Ticket/Display.html?id=88002 Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=719986 Forwarded: yes --- a/t/04-resize.t +++ b/t/04-resize.t @@ -267,7 +267,7 @@ subtest 'options' => sub{ isa_ok($app, 'CGI::Application'); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "$upload_subdir/test.jpeg" }, 'UPLOADED' ); size_ok("$tmpdir_name$upload_subdir/test.jpeg", [300,int(250*300/400)], "size 300x200"); @@ -293,7 +293,7 @@ subtest 'UPLOADED' => sub{ $app->query->param(validate=>1); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" }, 'UPLOADED' ); size_ok("$tmpdir_name/img/uploads/test.jpeg", [300,int(250*300/400)], "size 300x200"); @@ -320,7 +320,7 @@ subtest 'png' => sub{ $app->query->param(validate=>1); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" }, 'UPLOADED' ); size_ok("$tmpdir_name/img/uploads/test.jpeg", [300,int(250*300/400)], "size 300x200"); @@ -347,7 +347,7 @@ subtest 'square' => sub{ $app->query->param(validate=>1); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" }, 'UPLOADED' ); size_ok("$tmpdir_name/img/uploads/test.jpeg", [80,50], "size 300x50"); --- a/t/lib/TestWebApp.pm +++ b/t/lib/TestWebApp.pm @@ -1,6 +1,6 @@ package TestWebApp; use base qw(CGI::Application); -use CGI::Application::Plugin::JSON qw(to_json); +use CGI::Application::Plugin::JSON qw(to_json from_json); use CGI::Application::Plugin::AJAXUpload; use File::Temp; use Test::More; @@ -51,7 +51,12 @@ sub response_like { my ($header, $body) = split /\r\n\r\n/, $output; like($header, $header_re, "$comment (header match)"); - like($body, $body_re, "$comment (body match)"); + if ( ref($body_re) and ref($body_re) eq 'HASH' ) { + is_deeply( $self->from_json($body), $body_re, "$comment (body json)" ); + } + else { + like($body, $body_re, "$comment (body match)"); + } return; } --- a/t/02.warnings.t +++ b/t/02.warnings.t @@ -303,7 +303,7 @@ subtest 'options' => sub{ isa_ok($app, 'CGI::Application'); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.txt"}!xms, + { status => "UPLOADED", image_url => "$upload_subdir/test.txt" }, 'UPLOADED' ); is(slurp("$tmpdir_name$upload_subdir/test.txt"), "This is a test!", 'file contents'); @@ -329,7 +329,7 @@ subtest 'UPLOADED' => sub{ $app->query->param(validate=>1); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"/img/uploads/test.txt"}!xms, + { status => "UPLOADED", image_url => "/img/uploads/test.txt" }, 'UPLOADED' ); is(slurp("$tmpdir_name/img/uploads/test.txt"), "This is a test!", 'file contents'); --- a/t/03.images.t +++ b/t/03.images.t @@ -240,7 +240,7 @@ subtest 'options' => sub{ isa_ok($app, 'CGI::Application'); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"$upload_subdir/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "$upload_subdir/test.jpeg" }, 'UPLOADED' ); my $size = -s "$tmpdir_name/$upload_subdir/test.jpeg"; @@ -264,7 +264,7 @@ subtest 'UPLOADED' => sub{ $app->query->param(validate=>1); $app->response_like( $CONTENT_RE, - qr!{"status":"UPLOADED","image_url":"/img/uploads/test.jpeg"}!xms, + { status => "UPLOADED", image_url => "/img/uploads/test.jpeg" }, 'UPLOADED' ); my $size = -s "$tmpdir_name/img/uploads/test.jpeg";
На 03 септ. 2013, вт 16:42:08, DAM написа: Show quoted text
> Attached is a patch that makes the tests compare structures via is_deeply(), > instead of like() over json-encoded string representation. > > The later approach is problematic, since json-encoded structures can use > random key order, as is the case with perl 5.18.
Hi, Did you have a chance to have a look at that patch? It would be nice to have it included in a future release of CGI-Application-Plugin-AJAXUpload. Cheers, dam