Closed Bug 203318 Opened 21 years ago Closed 21 years ago

008filter.t fails to do chdir $topdir - if @Support::Templates::include_paths returns more than one path

Categories

(Bugzilla :: Testing Suite, defect)

2.17.4
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: burnus, Assigned: burnus)

Details

Attachments

(1 file, 1 obsolete file)

This is perl, v5.6.1 built for i386-linux.

If I run ./runtests.sh --verbose 008filter
this fails after the first checked directory (e.g. templates/de/default).

The problem is here:
---------------<cut>-----------------------------
my $topdir = cwd;

foreach my $path (@Support::Templates::include_paths) {
    $path =~ m|template/([^/]+)/|;
    my $lang = $1; 
    chdir $topdir; # absolute path
    ok(0, "TOPDIR: $topdir / cwd: ".cwd." / path: $path\n");
--------------<cut>------------------------------
The ok-line I inserted shows:

a) first loop run:
not ok 1 - TOPDIR: /web/server/bugzilla/docroot / cwd:
/web/server/bugzilla/docroot / path: template/de/default

b) second loop run:
not ok 88 - TOPDIR: /web/server/bugzilla/docroot / cwd:
/web/server/bugzilla/docroot/template/de/default / path: template/en/default

Why is cwd not $topdir in the second loop run?

(The problems I have are obvious: I cannot check more than one directory at one
./runtests run -- needing to hide the directories one by one for the
@Support::Templates::include_paths command)
Summary: 008filter.t fails to do chdir $topdir - runs only one languager → 008filter.t fails to do chdir $topdir - if @Support::Templates::include_paths returns more than one path
Thanks to Jens Dreger (our local PERL guru) for finding the error:
 $/ = undef;   # normally $/ is "\n"
 my $topdir = cwd;
saves "dir\n" instead of "dir" which doesn't exist. Therefore chdir $topdir
fails (silently) and it works once.
(in the ok output I forgot a few line breaks)
Reassign to me.
Assignee: zach → burnus
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 2.18
Attachment #121658 - Flags: review?(gerv)
This code
     chdir $topdir; # absolute path
     my @testitems = Support::Templates::find_actual_files($path);
left me for custom/ in the directory $topdir/$path/bugs/create. I have no idea
why, but it did!
I therefore added a chdir $topdir; afterwards.

Since I got a bit confused whether (en) is (en/custom) or (en/default), I
changed this too.
Attachment #121658 - Attachment is obsolete: true
Attachment #121661 - Flags: review?(gerv)
Attachment #121658 - Flags: review?(gerv)
Please don't use the name "version" for the variable that has the value "custom"
or default"; version implies version number. A better name might be "flavour",
or something. Otherwise, looks good.

Gerv
Comment on attachment 121661 [details] [diff] [review]
New version, fixes additional problem

Vitaly had mentioned this before we shipped and I absolutely could not
reproduce it no matter how hard I tried.  The $/ thing makes perfect sense
though.  I wonder if Cwd works even with $/ cleared on Mac OS X (which is where
I was doing all my testing) or perhaps chdir ignores the \n on the end on Mac
OS X or something....  anyhow, this works.
Attachment #121661 - Flags: review+
gerv: ok, I'll call it "flavor" (not "flavour" ;-)
Flags: approval?
'cwd' apparently uses 'chomp' which in turn depends on $/ value.  
It can be demonstrated with chomp('cwd') not working there, either.
go for it.  please check it in on both the 2.16 branch and the tip.
Flags: approval? → approval+
HEAD
Checking in t/008filter.t;
/cvsroot/mozilla/webtools/bugzilla/t/008filter.t,v  <--  008filter.t
new revision: 1.3; previous revision: 1.2
done

BUGZILLA-2_16-BRANCH
Checking in 008filter.t;
/cvsroot/mozilla/webtools/bugzilla/t/008filter.t,v  <--  008filter.t
new revision: 1.1.2.2; previous revision: 1.1.2.1
done
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Attachment #121661 - Flags: review+
Attachment #121661 - Flags: review?(gerv)
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: