Add fix for RT #71271.
[perl-fuse.git] / test / statfs.t
index 7905b80..52fa3ce 100644 (file)
@@ -1,21 +1,25 @@
 #!/usr/bin/perl
 use test::helper qw($_real $_point);
 use Test::More;
-require 'syscall.ph'; # for SYS_statfs
-plan tests => 7;
-my ($statfs_data) = 0x00 x 8 x 16;
-my ($tmp) = $_point;
-ok(!syscall(&SYS_statfs,$tmp,$statfs_data),"statfs");
-# FIXME: this is soooooo linux-centric.  perhaps parse the output of /bin/df?
-my @list = unpack("L!7L2L!7",$statfs_data);
+use Config;
+use Filesys::Statvfs;
+
+if ($^O eq 'netbsd') {
+    # Ignoring the f_namelen field; NetBSD's statvfs1(2) syscall doesn't
+    # seem to handle f_namelen right for PUFFS-based filesystems. Not our
+    # failure, and mostly irrelevant.
+    plan tests => 6;
+}
+else {
+    plan tests => 7;
+}
+ok(my @list = (statvfs($_point))[1,2,3,5,6,9]);
 diag "statfs: ",join(', ', @list);
-shift(@list);
-is(shift(@list),4096,"block size");
-is(shift(@list),1000000,"blocks");
-is(shift(@list),500000,"blocks free");
-shift(@list);
-is(shift(@list),1000000,"files");
-is(shift(@list),500000,"files free");
-shift(@list);
-shift(@list);
-is(shift(@list),255,"namelen");
+is(shift(@list),4096,'block size');
+is(shift(@list),1000000,'blocks');
+is(shift(@list),500000,'blocks free');
+is(shift(@list),1000000,'files');
+is(shift(@list),500000,'files free');
+unless ($^O eq 'netbsd') {
+    is(shift(@list),255,'namelen');
+}