[PATCH] selftest/s3: test with FS applicable VFS modules

David Disseldorp ddiss at samba.org
Mon Sep 16 23:51:46 CEST 2013


Attempt to determine the underlying test share filesystem using statfs.
If the filesystem is detected and an applicable VFS module is available,
then use the module during S3FS selftest.
Btrfs is currently the only VFS module to utilize this logic.

Signed-off-by: David Disseldorp <ddiss at samba.org>
---
 selftest/target/Samba3.pm | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 0972457..d81aad0 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -29,6 +29,21 @@ sub have_ads($) {
 	return $found_ads;
 }
 
+# return a list of VFS modules applicable to @path, based on the underlying
+# filesystem type
+sub get_fs_specific_vfs_mods($$)
+{
+	my ($self, $path) = @_;
+	my $mods = "";
+	my $stat_out = `stat --file-system $path` or return "";
+
+	if ($stat_out =~ m/Type:\s+btrfs/) {
+		$mods .= "btrfs ";
+	}
+
+	return $mods;
+}
+
 sub new($$) {
 	my ($classname, $bindir, $binary_mapping, $srcdir, $server_maxtime) = @_;
 	my $self = { vars => {},
@@ -45,7 +60,7 @@ sub teardown_env($$)
 {
 	my ($self, $envvars) = @_;
 	my $count = 0;
-	
+
 	# This should cause smbd to terminate gracefully
 	close($envvars->{STDIN_PIPE});
 
@@ -832,6 +847,8 @@ sub provision($$$$$$)
 	my $nmbdsockdir="$prefix_abs/nmbd";
 	unlink($nmbdsockdir);
 
+	my $fs_vfs_modules = $self->get_fs_specific_vfs_mods($shrdir);
+
 	## 
 	## create the test directory layout
 	##
@@ -987,7 +1004,7 @@ sub provision($$$$$$)
 	store dos attributes = yes
 	create mask = 755
 	dos filemode = yes
-	vfs objects = acl_xattr fake_acls xattr_tdb streams_depot
+	vfs objects = acl_xattr fake_acls xattr_tdb streams_depot $fs_vfs_modules
 
 	printing = vlp
 	print command = $bindir_abs/vlp tdbfile=$lockdir/vlp.tdb print %p %s
-- 
1.8.1.4



More information about the samba-technical mailing list