Commit 12778f01 authored by Ralph Boehme's avatar Ralph Boehme

s3:script/tests: add a test for VSS write behaviour

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13688Signed-off-by: default avatarRalph Boehme <slow@samba.org>
Reviewed-by: default avatarJeremy Allison <jra@samba.org>
parent 48ddb87a
^samba3.blackbox.shadow_copy_torture.writing to shadow copy of a file\(fileserver\)
......@@ -2190,6 +2190,15 @@ sub provision($$$$$$$$$)
vfs objects = shadow_copy2
shadow:mountpoint = $shadow_mntdir
wide links = yes
[shadow_write]
path = $shadow_tstdir
comment = previous versions snapshots under mount point
vfs objects = shadow_copy2 error_inject
aio write size = 0
error_inject:pwrite = EBADF
shadow:mountpoint = $shadow_tstdir
[dfq]
path = $shrdir/dfree
vfs objects = acl_xattr fake_acls xattr_tdb fake_dfq
......
#!/bin/bash
#
# Blackbox test for shadow_copy2 VFS.
#
if [ $# -lt 7 ]; then
cat <<EOF
Usage: test_shadow_copy SERVER SERVER_IP DOMAIN USERNAME PASSWORD WORKDIR SMBTORTURE
EOF
exit 1;
fi
SERVER=${1}
SERVER_IP=${2}
DOMAIN=${3}
USERNAME=${4}
PASSWORD=${5}
WORKDIR=${6}
SMBTORTURE="$VALGRIND ${7}"
shift 7
incdir=`dirname $0`/../../../testprogs/blackbox
. $incdir/subunit.sh
SNAPSHOT="@GMT-2015.10.31-19.40.30"
failed=0
# build a hierarchy of files, symlinks, and directories
build_files()
{
local destdir
destdir=$1
echo "$content" > $destdir/foo
}
# build a snapshots directory
build_snapshots()
{
local snapdir
snapdir=$WORKDIR/.snapshots
mkdir -p $snapdir
mkdir $snapdir/$SNAPSHOT
build_files $snapdir/$SNAPSHOT
}
test_shadow_copy_write()
{
local msg
msg=$1
#delete snapshots from previous tests
find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1
build_snapshots
testit "writing to shadow copy of a file" \
$SMBTORTURE \
-U$USERNAME%$PASSWORD \
"//$SERVER/shadow_write" \
--option="torture:twrp_file=foo" \
--option="torture:twrp_snapshot=$SNAPSHOT" \
smb2.twrp.write || \
failed=`expr $failed + 1`
}
build_files $WORKDIR
# test open for writing and write behaviour of snapshoted files
test_shadow_copy_write "write behaviour of snapshoted files"
exit $failed
......@@ -24,7 +24,7 @@ sys.path.insert(0, os.path.normpath(os.path.join(os.path.dirname(__file__), "../
import selftesthelpers
from selftesthelpers import bindir, srcdir, scriptdir, binpath
from selftesthelpers import plantestsuite, samba3srcdir
from selftesthelpers import smbtorture3, configuration, smbclient3
from selftesthelpers import smbtorture3, configuration, smbclient3, smbtorture4
from selftesthelpers import net, wbinfo, dbwrap_tool, rpcclient, python
from selftesthelpers import smbget, smbcacls, smbcquotas, ntlm_auth3
from selftesthelpers import valgrindify, smbtorture4_testsuites
......@@ -310,6 +310,7 @@ for env in ["fileserver"]:
plantestsuite("samba3.blackbox.offline (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_offline.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/offline', smbclient3])
plantestsuite("samba3.blackbox.shadow_copy2 NT1 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'NT1'])
plantestsuite("samba3.blackbox.shadow_copy2 SMB3 (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbclient3, '-m', 'SMB3'])
plantestsuite("samba3.blackbox.shadow_copy_torture", env, [os.path.join(samba3srcdir, "script/tests/test_shadow_copy_torture.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH/shadow', smbtorture4])
plantestsuite("samba3.blackbox.smbclient.forceuser_validusers (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_forceuser_validusers.sh"), '$SERVER', '$DOMAIN', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3])
plantestsuite("samba3.blackbox.smbget (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbget.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', 'smbget_user', '$PASSWORD', '$LOCAL_PATH/smbget', smbget])
plantestsuite("samba3.blackbox.netshareenum (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_shareenum.sh"), '$SERVER', '$USERNAME', '$PASSWORD', rpcclient])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment