From: Marco van Wieringen Date: Sat, 17 Oct 2009 18:38:38 +0000 (+0200) Subject: Added acl and xattr regression tests for FreeBSD X-Git-Tag: Release-7.0.0~2599^2~9^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=24ad579b81fc5c0616a5da3b9f68c7ae571cf028;p=bacula%2Fbacula Added acl and xattr regression tests for FreeBSD --- diff --git a/regress/tests/acl-xattr-test b/regress/tests/acl-xattr-test index 76143df227..fe7bbe7683 100755 --- a/regress/tests/acl-xattr-test +++ b/regress/tests/acl-xattr-test @@ -2,12 +2,23 @@ # # Run a backup of the Bacula build directory with some acls then restore it. # -# Your filesystem must be mounted with the acl option (mount -o remount,acl,user_xattr /tmp) -# on ubuntu, the attr package must be installed +# For Linux: +# Your filesystem must be mounted with the acl option (mount -o remount,acl,user_xattr /tmp) +# on ubuntu, the attr package must be installed # -# For this script to work, you will also need a number of acl packages loaded -# not default on Debian derivatives: -# apt-get install acl libacl1 libacl1-dev attr +# For this script to work, you will also need a number of acl packages loaded +# not default on Debian derivatives: +# apt-get install acl libacl1 libacl1-dev attr +# +# For OSX and Solaris: +# +# Defaults should be ok +# +# For FreeBSD: +# +# Your filesystem must have acls enabled and needs to be mounted with acls. +# tunefs -a enable +# acls mountoption in /etc/fstab # TestName="acl-xattr-test" JobName=backup @@ -36,6 +47,21 @@ case `uname -s` in ;; SunOS) ;; + FreeBSD) + # Require getfacl to be installed + getfacl Makefile 2>&1 >/dev/null + if test $? -ne 0; then + echo "$TestName skipped: getfacl not installed" + exit 0 + fi + + # Require lsextattr to be installed + lsextattr user Makefile 2>&1 >/dev/null + if test $? -ne 0; then + echo "$TestName skipped: lsextattr not installed" + exit 0 + fi + ;; *) echo "Unsupported OS" exit 0 @@ -121,6 +147,26 @@ EOF /bin/runat $d/other 'cat bacula.test' > $cwd/tmp/attr.org ) ;; + FreeBSD) + setfacl -m d:user:$uid:r-x $d/acl-dir + setfacl -m d:user:root:-wx $d/acl-dir + setfacl -m user:nobody:--- $d/acl-dir + setfacl -m user:nobody:--- $d/bconsole + setfacl -m group:nogroup:--x $d/bconsole + cp ${cwd}/bin/bconsole $d/acl-dir + cp ${cwd}/bin/bconsole $d/other + setextattr user bacula.test rulez $d/other 2>/dev/null 1>/dev/null + + ( cd $cwd/build + for file in acl/* + do + getfacl $file + done > $cwd/tmp/org + getextattr user bacula.test $d/other > $cwd/tmp/attr.org + ) + ;; + Darwin) + ;; esac change_jobname BackupClient1 $JobName @@ -171,6 +217,15 @@ case `uname -s` in /bin/runat $d/other 'cat bacula.test' > $cwd/tmp/attr.new ) ;; + FreeBSD) + ( cd $cwd/tmp/bacula-restores/$cwd/build + for file in acl/* + do + getfacl $file + done > $cwd/tmp/new + getextattr user bacula.test $d/other > $cwd/tmp/attr.new + ) + ;; esac diff -u $cwd/tmp/org $cwd/tmp/new