aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-02-26 09:19:16 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-02-26 09:19:16 +0000
commit0c03ed601369c534ec18588df55d53245ab7ae93 (patch)
tree3d9eacbeef6ef0c5f155d7d4ab6404daee20b80c /tests
parent0c3c1b390a32c61e67adfaba64a8ff8d3c51774d (diff)
modified loadtest() to produce better error message when it fails to load
a test file
Diffstat (limited to 'tests')
-rw-r--r--tests/getpart.pm25
1 files changed, 12 insertions, 13 deletions
diff --git a/tests/getpart.pm b/tests/getpart.pm
index 9c74986f4..7331be7e6 100644
--- a/tests/getpart.pm
+++ b/tests/getpart.pm
@@ -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;
}