mirror of
https://github.com/curl/curl.git
synced 2026-07-24 16:07:16 +03:00
modified loadtest() to produce better error message when it fails to load
a test file
This commit is contained in:
parent
0c3c1b390a
commit
0c03ed6013
1 changed files with 12 additions and 13 deletions
|
|
@ -92,21 +92,20 @@ sub getpart {
|
|||
sub loadtest {
|
||||
my ($file)=@_;
|
||||
|
||||
my $dir;
|
||||
$dir = $ENV{'srcdir'};
|
||||
if(!$dir) {
|
||||
$dir=".";
|
||||
}
|
||||
|
||||
|
||||
undef @xml;
|
||||
open(XML, "<$dir/$file") ||
|
||||
return 1; # failure!
|
||||
binmode XML; # for crapage systems, use binary
|
||||
while(<XML>) {
|
||||
push @xml, $_;
|
||||
|
||||
if(open(XML, "<$file")) {
|
||||
binmode XML; # for crapage systems, use binary
|
||||
while(<XML>) {
|
||||
push @xml, $_;
|
||||
}
|
||||
close(XML);
|
||||
}
|
||||
else {
|
||||
# failure
|
||||
print STDERR "file $file wouldn't open!\n";
|
||||
return 1;
|
||||
}
|
||||
close(XML);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue