[OpenAFS-devel] Fuse and testsuite

Troy Benjegerdes hozer@hozed.org
Sun, 25 Sep 2011 01:27:06 -0500


This is a MIME-formatted message.  If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_excalibur.hozed.org-31638-1316932026-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

So I figured once I found out how to make fuse work, and there was already a 
testsuite, I should add something, so here goes.

Here's a first pass at using the testsuite to start afsd.fuse and check that
yes, it does work.

So I know there are some caveats with afsd.fuse, (like no auth, for the moment),
but how could we go about changing that? What I would really like to do is make
a testsuite to excercise disconnected mode... which requires me to at least be
able to perform 'fs' commands through the fuse interface. 

I saw some mention of maybe using xattrs to do this... would this make the most
sense? Would xattrs also be usefull in providing some information to a user
(or just userspace) on the status of connected/disconnected/uploading a file?

It would be nice, for instance, on a laptop to have a 'progress bar' on how 
much there is to upload, and what the status is on a reconnect.

--=_excalibur.hozed.org-31638-1316932026-0001-2
Content-Type: text/x-diff; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="fusetest.patch"

diff --git a/tests/fuse/conf/ThisCell b/tests/fuse/conf/ThisCell
new file mode 100644
index 0000000..ebb8cea
--- /dev/null
+++ b/tests/fuse/conf/ThisCell
@@ -0,0 +1 @@
+test.cell
diff --git a/tests/fuse/conf/cacheinfo b/tests/fuse/conf/cacheinfo
new file mode 100644
index 0000000..f5fe457
--- /dev/null
+++ b/tests/fuse/conf/cacheinfo
@@ -0,0 +1 @@
+mntdir:vcache:100000
diff --git a/tests/fuse/dynroot-t b/tests/fuse/dynroot-t
new file mode 100755
index 0000000..a35ce93
--- /dev/null
+++ b/tests/fuse/dynroot-t
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Written by Troy Benjegerdes <hozer@hozed.org>
+# This software copyright 2011 Troy Benjegerdes
+#
+# See the file COPYRANT for conditions
+
+. tap/libtap.sh
+
+
+plan 1
+
+
+grep -e "^>" fuse/conf/CellServDB  | cut -d " " -f 1 | cut -b2- | sort > fuse/cells.tmp
+
+(cd fuse; ./try-fuse.sh > ./fuse-log 2>&1 ) &
+
+fusepid=$!
+
+sleep 1
+ls fuse/mntdir | sort > fuse/ls.tmp
+ok "ls dynroot" diff fuse/cells.tmp fuse/ls.tmp
+
+rm fuse/cells.tmp fuse/ls.tmp
+
+#not the best way to handle this
+killall afsd.fuse
+
+wait 
diff --git a/tests/fuse/fuse.sh b/tests/fuse/fuse.sh
new file mode 100755
index 0000000..21f1026
--- /dev/null
+++ b/tests/fuse/fuse.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# Written by Troy Benjegerdes <hozer@hozed.org>
+# This software copyright 2011 Troy Benjegerdes
+#
+# See the file COPYRANT for conditions
+
+. ../tap/libtap.sh
+
+
+plan 1
+
+
+grep -e "^>" conf/CellServDB  | cut -d " " -f 1 | cut -b2- | sort > cells.tmp
+
+(./try-fuse.sh > fuse-log 2>&1 ) &
+
+fusepid=$!
+
+sleep 1
+ls mntdir | sort > ls.tmp
+ok "ls dynroot" diff cells.tmp ls.tmp
+
+rm cells.tmp ls.tmp
+
+kill $fusepid
+
+wait $fusepid
diff --git a/tests/fuse/try-fuse.sh b/tests/fuse/try-fuse.sh
new file mode 100755
index 0000000..51719eb
--- /dev/null
+++ b/tests/fuse/try-fuse.sh
@@ -0,0 +1,14 @@
+#!/bin/sh -x
+
+TESTDIR=$PWD
+TOPDIR=$PWD/../..
+
+export LD_LIBRARY_PATH=$TOPDIR/lib
+
+#in case there's a stale mount here
+fusermount -u $TESTDIR/mntdir
+
+$TOPDIR/src/afsd/afsd.fuse -dynroot -fakestat -d -confdir $TESTDIR/conf -cachedir $TESTDIR/vcache -mountdir $TESTDIR/mntdir
+
+
+fusermount -u $TESTDIR/mntdir

--=_excalibur.hozed.org-31638-1316932026-0001-2--