Closed Bug 304600 Opened 20 years ago Closed 19 years ago

Need a test in the test suite to check for dependency loops

Categories

(Bugzilla :: Testing Suite, enhancement)

2.21
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: mkanat, Assigned: LpSolit)

References

Details

Attachments

(1 file, 1 obsolete file)

We should be able to adapt justdave's use2dot script (from bug 303413) and our dependency-loop-checking code for process_bug into a test that determines whether or not our libraries contain dependency loops.
This bug is speaking about code dependencies not "bug xxx depends on" and "bug yyy blocks" type dependencies... right?
(In reply to comment #1) > This bug is speaking about code dependencies not "bug xxx depends on" and "bug > yyy blocks" type dependencies... right? Right! If Foo.pm uses Bar.pm, then Bar.pm should not use Foo.pm.
Attached file use2dot.pl v2 (obsolete) —
This version of use2dot.pl improves on the previous version by detecting and reporting dependencyloops that are more than one level deep. example output: [dave@g4book bugzilla]$ perl ../../misc/use2dot.pl > ~/bugzilla.dot Dependency on Bugzilla::Attachment from Bugzilla::Flag causes loop. Dependency on Bugzilla::BugMail from Bugzilla::Flag causes loop. Dependency on Bugzilla::Product from Bugzilla::Classification causes loop. Dependency on Bugzilla::User from Bugzilla::Component causes loop. Dependency on Bugzilla::Bug from Bugzilla::BugMail causes loop. Dependency on Bugzilla::Flag from Bugzilla::Attachment causes loop. Dependency on Bugzilla::Component from Bugzilla::Product causes loop. Dependency on Bugzilla::Product from Bugzilla::User causes loop. Dependency on Bugzilla::Classification from Bugzilla::User causes loop. Dependency on Bugzilla::Attachment from Bugzilla::Bug causes loop. Dependency on Bugzilla::Flag from Bugzilla::Bug causes loop. You can then use the produced ~/bugzilla.dot file to generate a pretty graph with red lines on the loops like so: dot -Tpng ~/bugzilla.dot >~/Desktop/bugzilladeps.png
Attached file 010dependencies.t
This is based on use2dot.pl justdave wrote.
Assignee: zach → LpSolit
Attachment #218546 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #225930 - Flags: review?(justdave)
Target Milestone: --- → Bugzilla 2.24
Comment on attachment 225930 [details] 010dependencies.t Looks like it works. Seems to be flagging all the right things. Tree's gonna go red when this is checked in though.
Attachment #225930 - Flags: review?(justdave) → review+
Flags: approval+
(In reply to comment #5) > Looks like it works. Seems to be flagging all the right things. Tree's gonna > go red when this is checked in though. One way to prevent to lit the tree is to ignore |require Bugzilla::Foo| which are inside routines. This means writing (?:use|^require) instead of (?:use|require). I checked, there is no dependency loops detected this way. From what mkanat said on IRC, having Perl modules requiring each others is not a problem, e.g. for mod_perl. I could commit this patch with the change above (on checkin).
(In reply to comment #6) > I could commit this patch with the change above (on checkin). That sounds right to me.
Checking in t/010dependencies.t; /cvsroot/mozilla/webtools/bugzilla/t/010dependencies.t,v <-- 010dependencies.t initial revision: 1.1 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Keywords: relnote
Added to the release notes on bug 349423.
Keywords: relnote
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: