Skip Menu |

This queue is for tickets about the autoclass CPAN distribution.

Report information
The Basics
Id: 95642
Status: open
Priority: 0/
Queue: autoclass

People
Owner: Nobody in particular
Requestors: ppisar [...] redhat.com
Cc:
AdminCc:

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



Subject: t/testInconsistent.t test fails randomly
t/testInconsistent.t fails randomly: $ perl -Ilib t/testInconsistent.t ok 1 - use testInconsistent1 found no inconsistencies not ok 2 - use testInconsistent2 found expected inconsistencies # Failed test 'use testInconsistent2 found expected inconsistencies' # at t/testInconsistent.t line 13. # 'Inconsistent declarations for attribute(s) b a # Attribute b: declared instance attribute in testInconsistent2, class attribute in testInconsistent1 # Attribute a: declared instance attribute in testInconsistent1, class attribute in testInconsistent2 at lib/Class/AutoClass.pm line 540. # Class::AutoClass::declare('testInconsistent2') called at t/testInconsistent2.pm line 12 # require testInconsistent2.pm called at (eval 10) line 2 # main::BEGIN() called at t/testInconsistent2.pm line 0 # eval {...} called at t/testInconsistent2.pm line 0 # eval 'use testInconsistent2' called at t/testInconsistent.t line 12 # Compilation failed in require at (eval 10) line 2. # BEGIN failed--compilation aborted at (eval 10) line 2. # ' # doesn't match '(?^:^Inconsistent declarations for attribute\(s\) a b)' 1..2 # Looks like you failed 1 test of 2. This happens with perl-5.18.2. It's caused by randomized hash key order probably.
From: ppisar [...] redhat.com
Dne St 14.Květen.2014 10:26:46, ppisar napsal(a): Show quoted text
> t/testInconsistent.t fails randomly:
Attached patch fixes it.
Subject: autoclass-v1.01-Sort-inconsistent-declarations-for-error-message.patch
From fcc5bac3264420de0203589753b732da1dbc27bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 14 May 2014 16:42:24 +0200 Subject: [PATCH] Sort inconsistent declarations for error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Random hash key ordering casues test failures. It's also good to have stable output for human error messages. https://rt.cpan.org/Public/Bug/Display.html?id=95642 Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Class/AutoClass.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Class/AutoClass.pm b/lib/Class/AutoClass.pm index 1d7337a..83fd07a 100644 --- a/lib/Class/AutoClass.pm +++ b/lib/Class/AutoClass.pm @@ -530,7 +530,7 @@ sub declare { @cattributes_recursive{keys %cattributes}=values %cattributes; push(@attributes_recursive,keys %iattributes,keys %cattributes); # are all these declarations consistent? - if (my @inconsistents=grep {exists $cattributes_recursive{$_}} keys %iattributes_recursive) { + if (my @inconsistents=sort grep {exists $cattributes_recursive{$_}} keys %iattributes_recursive) { # inconsistent class vs. instance declarations my @errstr=("Inconsistent declarations for attribute(s) @inconsistents"); map { -- 1.9.0
RT-Send-CC: ppisar [...] redhat.com
Thanks for the bug report and patch. The version you're testing is ancient. The current version is 1.56. A bug equivalent to the one you found was found in 1.54 and fixed in 1.55. If I'm missing something, please let me know and I'll dig deeper. Here are relevant links. current version: http://search.cpan.org/dist/Class-AutoClass/ equivalent bug: https://rt.cpan.org/Public/Bug/Display.html?id=81420 All the best, Nat Goodman On Wed May 14 10:51:22 2014, ppisar wrote: Show quoted text
> Dne St 14.Květen.2014 10:26:46, ppisar napsal(a):
> > t/testInconsistent.t fails randomly:
> > Attached patch fixes it.