Subject: | absolute pathes to testfiles on same server |
I created an archive with
prove -v -r -j 4 /opt/path/dir/t/.../2_test.t --archive test.tar.gz
and uploaded it to a smolder server (on the same server)
smolder --server=server.name --username=username --password=password
--file=test.tar.gz --basedir=DIR --project=project
The server dies with:
Can't locate object method "error" via package "Error executing run mode
'process_add_report': Could not open /opt/path/dir/t/.../2_test.t for
reading: Permission denied at
/usr/local/share/perl5/TAP/Harness/Archive.pm line 366.
at /usr/local/share/perl5/TAP/Harness/Archive.pm line 366.
Obviously TAP::Harness::Archive tried to read the 'original' file
instead of the archived file and was not able to.
After a little research I deleted the leading slashes in the meta.yml
file (in description and the filelist).
And oops: It worked!
These problems were described earlier (at different place --
unfortunatly I have not found the best description again :-( ):
https://rt.cpan.org/Public/Bug/Display.html?id=54419
As described in the metioned bug, TAP::Harness::Archive tries to handle
absolute pathes for the file, but forgot (as far as I understood) to do
this for the YAML files.
My quick fix for this is:
to introduce an array @filenames as an copy of @files.
If there are any leading slashes in the pathes I just remove those and
hand @filenames to the YAML::Tiny handler.
I just copied the array, since I was not sure how
my $aggregator = $self->SUPER::runtests(@files);
uses @files.
Just removing the leading slash is obviously not smart, but did the job
for me.
sub runtests {
my ($self, @files) = @_;
# tell TAP::Harness to put the raw tap someplace we can find it later
my $dir = $self->{__archive_tempdir};
$ENV{PERL_TEST_HARNESS_DUMP_TAP} = $dir;
my @filenames = @files;
foreach (@filenames) {
if (File::Spec->file_name_is_absolute($_)) {
$_ =~ s|^/||;
}
}
# get some meta information about this run
my %meta = (
file_order => \@filenames,
start_time => time(),
);
my $aggregator = $self->SUPER::runtests(@files);
$meta{stop_time} = time();
my @parsers = $aggregator->parsers;
for ( my $i = 0; $i < @parsers; $i++ ) {
$parsers[ $i ] = {
start_time => $parsers[ $i ]->start_time,
end_time => $parsers[ $i ]->end_time,
description => $filenames[ $i ],
};
}
...
I discovered the bug with
perl v5.10.1 and v5.14.2 as well running on
CentOS release 6.2 (Final)
Best
Jürgen