libsmb: Use clistr_smb2_extract_snapshot_token() in cli_smb2_create_fnum_send()
[Samba.git] / source3 / script / tests / test_smb1_shadow_copy_torture.sh
blob64a4614b832cd2a91375d69a354b936cef26282a
1 #!/bin/bash
3 # Blackbox test for shadow_copy2 VFS - SMB1 only.
6 if [ $# -lt 7 ]; then
7 cat <<EOF
8 Usage: test_shadow_copy SERVER SERVER_IP DOMAIN USERNAME PASSWORD WORKDIR SMBTORTURE
9 EOF
10 exit 1
13 SERVER=${1}
14 SERVER_IP=${2}
15 DOMAIN=${3}
16 USERNAME=${4}
17 PASSWORD=${5}
18 WORKDIR=${6}
19 SMBTORTURE="$VALGRIND ${7}"
20 shift 7
22 incdir=$(dirname $0)/../../../testprogs/blackbox
23 . $incdir/subunit.sh
25 SNAPSHOT="@GMT-2015.10.31-19.40.30"
27 failed=0
29 cd $SELFTEST_TMPDIR || exit 1
31 # build a hierarchy of files, symlinks, and directories
32 build_files()
34 local destdir
35 destdir=$1
37 echo "$content" >$destdir/foo
40 # build a snapshots directory
41 build_snapshots()
43 local snapdir
45 snapdir=$WORKDIR/.snapshots
47 mkdir -p $snapdir
48 mkdir $snapdir/$SNAPSHOT
50 build_files $snapdir/$SNAPSHOT
53 test_shadow_copy_openroot()
55 local msg
57 msg=$1
59 #delete snapshots from previous tests
60 find $WORKDIR -name ".snapshots" -exec rm -rf {} \; 1>/dev/null 2>&1
61 build_snapshots
63 testit "opening shadow copy root of share over SMB1" \
64 $SMBTORTURE \
65 -U$USERNAME%$PASSWORD \
66 "//$SERVER/shadow_write" \
67 --option="torture:twrp_snapshot=$SNAPSHOT" \
68 base.smb1-twrp-openroot ||
69 failed=$(expr $failed + 1)
72 build_files $WORKDIR
74 # test open for writing and write behaviour of snapshoted files
75 test_shadow_copy_openroot "opening root of shadow copy share"
77 exit $failed