From 94bf003a720c9a883ba7ebf43ab3053d3072d3dd Mon Sep 17 00:00:00 2001 From: Troy Benjegerdes Date: Sun, 26 Feb 2012 22:56:06 -0600 Subject: [PATCH] Add some basic tests to check out fuse Update makefiles to have 'make test' and 'make check' use the _nolibafs build version, since there are no tests that (currently) require the AFS kernel module to be built. Clean up fuse test copyright notice, Alphabetize configure.ac Change-Id: Icc95dd3393cd66f0d04fa5f6e8f806db60ca031e Reviewed-on: http://gerrit.openafs.org/8135 Reviewed-by: Troy Benjegerdes Reviewed-by: Derrick Brashear Tested-by: BuildBot --- Makefile.in | 7 +++++-- configure.ac | 1 + tests/TESTS | 1 + tests/fuse/Makefile.in | 13 +++++++++++++ tests/fuse/conf/ThisCell | 1 + tests/fuse/conf/cacheinfo | 1 + tests/fuse/dynroot-t | 33 +++++++++++++++++++++++++++++++++ tests/fuse/fuse.sh | 35 +++++++++++++++++++++++++++++++++++ tests/fuse/try-fuse.sh | 23 +++++++++++++++++++++++ 9 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 tests/fuse/Makefile.in create mode 100644 tests/fuse/conf/ThisCell create mode 100644 tests/fuse/conf/cacheinfo create mode 100755 tests/fuse/dynroot-t create mode 100755 tests/fuse/fuse.sh create mode 100755 tests/fuse/try-fuse.sh diff --git a/Makefile.in b/Makefile.in index 44d914ac2..cf74460e0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -139,7 +139,10 @@ prelude: ${TOP_INCDIR}/afs ${TOP_INCDIR}/rx ${TOP_INCDIR}/hcrypto ${TOP_INCDIR}/ project: cmd comerr -tests: all +tests: all_nolibafs + +${COMPILE_PART1} tests ${COMPILE_PART2} + +tests_libafs: all +${COMPILE_PART1} tests ${COMPILE_PART2} config: prelude @@ -656,7 +659,7 @@ finale_nolibafs: project cmd comerr afsd butc tbutc tbudb libuafs audit kauth lo rpctestlib: util fsint rx opr libafsrpc libafsauthent +${TEST_PART1} rpctestlib ${COMPILE_PART2} -check test: finale +check test: finale_nolibafs cd tests && $(MAKE) check # Use washtool to ensure MakefileProto is current and obj/libafs exists. diff --git a/configure.ac b/configure.ac index 627781585..036d6fc7b 100644 --- a/configure.ac +++ b/configure.ac @@ -265,6 +265,7 @@ tests/Makefile \ tests/auth/Makefile \ tests/cmd/Makefile \ tests/common/Makefile \ +tests/fuse/Makefile \ tests/opr/Makefile \ tests/rpctestlib/Makefile \ tests/rx/Makefile \ diff --git a/tests/TESTS b/tests/TESTS index 59c4fb3e1..0c08189fa 100644 --- a/tests/TESTS +++ b/tests/TESTS @@ -18,3 +18,4 @@ volser/vos-man volser/vos bucoord/backup-man kauth/kas-man +fuse/dynroot diff --git a/tests/fuse/Makefile.in b/tests/fuse/Makefile.in new file mode 100644 index 000000000..71846c7ec --- /dev/null +++ b/tests/fuse/Makefile.in @@ -0,0 +1,13 @@ +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html +# +# This file (software) make also be used separately from OpenAFS +# under other licenses, contact the author(s) listed below for details. +# +# copyright 2011, 2012 Troy Benjegerdes + +CELLSRV=@TOP_OBJDIR@/src/afsd/CellServDB + +conf/CellServDB: $(CELLSRV) + cp $(CELLSRV) conf/ diff --git a/tests/fuse/conf/ThisCell b/tests/fuse/conf/ThisCell new file mode 100644 index 000000000..ebb8cea43 --- /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 000000000..f5fe457ee --- /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 000000000..c84eefd90 --- /dev/null +++ b/tests/fuse/dynroot-t @@ -0,0 +1,33 @@ +#!/bin/sh +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html +# +# This file (software) may also be used separately from OpenAFS +# under other licenses, contact the author(s) listed below for details. +# +# copyright 2011, 2012 Troy Benjegerdes + +. 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 000000000..10f497ad0 --- /dev/null +++ b/tests/fuse/fuse.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html +# +# This file (software) may also be used separately from OpenAFS +# under other licenses, contact the author(s) listed below for details. +# +# This software copyright 2011, 2012 Troy Benjegerdes + +. ../tap/libtap.sh + + +plan 1 + +if [ ! -f "$TOPDIR/src/afsd/afsd.fuse" ] ; then + skip_all +fi + +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 000000000..f5458f95c --- /dev/null +++ b/tests/fuse/try-fuse.sh @@ -0,0 +1,23 @@ +#!/bin/sh -x +# +# This software has been released under the terms of the IBM Public +# License. For details, see the LICENSE file in the top-level source +# directory or online at http://www.openafs.org/dl/license10.html +# +# This file (software) may also be used separately from OpenAFS +# under other licenses, contact the author(s) listed below for details. +# +# copyright 2011, 2012 Troy Benjegerdes + +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 -- 2.39.5