diff options
author | Christof Schmitt <cs@samba.org> | 2019-05-22 15:09:59 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-07-05 05:02:12 +0000 |
commit | b1fc6e435b455533edecc0985dbf882d974e7acd (patch) | |
tree | 7da4df8b31c2d0b10289ccb60caeb2eb452e2a78 | |
parent | e1bb3d34d900730c71ceaf2a1fba23823342f94e (diff) | |
download | samba-b1fc6e435b455533edecc0985dbf882d974e7acd.tar.gz |
s3:tests: Add test for manual smbtorture zero-data
Ensure that these tests keep working.
Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Jul 5 05:02:12 UTC 2019 on sn-devel-184
-rwxr-xr-x | source3/script/tests/test_zero_data.sh | 52 | ||||
-rwxr-xr-x | source3/selftest/tests.py | 3 |
2 files changed, 55 insertions, 0 deletions
diff --git a/source3/script/tests/test_zero_data.sh b/source3/script/tests/test_zero_data.sh new file mode 100755 index 00000000000..6b965b57ba5 --- /dev/null +++ b/source3/script/tests/test_zero_data.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Verify that smbtorture tests for manually testing ZERO_DATA +# +# Copyright (C) 2019 Christof Schmitt + +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_zero_data.sh SERVER_IP USERNAME PASSWORD LOCAL_PATH +EOF +exit 1; +fi + +SERVER=${1} +USERNAME=${2} +PASSWORD=${3} +LOCAL_PATH=${4} + +. $(dirname $0)/../../../testprogs/blackbox/subunit.sh +failed=0 + +TESTDIR=$LOCAL_PATH/zero_data + +mkdir -p $TESTDIR +chmod 777 p $TESTDIR + +dd if=/dev/urandom of=$TESTDIR/testfile bs=1024 count=128 +chmod 777 $TESTDIR/testfile + +alloc_kb=$(du -k $TESTDIR/testfile | sed -e 's/\t.*//') +testit "check allocation before zero-data" test $alloc_kb -eq 128 || + failed=$(expr $failed + 1) + +testit "set-sparse" $VALGRIND $BINDIR/smbtorture //$SERVER_IP/tmp \ + -U$USERNAME%$PASSWORD smb2.set-sparse-ioctl \ + --option=torture:filename=zero_data/testfile || + failed=$(expr $failed + 1) + +testit "zero-data" $VALGRIND $BINDIR/smbtorture //$SERVER_IP/tmp \ + -U$USERNAME%$PASSWORD smb2.zero-data-ioctl \ + --option=torture:filename=zero_data/testfile \ + --option=torture:offset=0 \ + --option=torture:beyond_final_zero=131072 || + failed=$(expr $failed + 1) + +alloc_kb=$(du -k $TESTDIR/testfile | sed -e 's/\t.*//') +testit "check allocation after zero-data" test $alloc_kb -eq 0 || + failed=$(expr $failed + 1) + +rm -rf $TESTDIR + +testok $0 $failed diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 1394dc456b2..78f58bdb30c 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -341,6 +341,9 @@ for env in ["fileserver"]: plantestsuite("samba3.blackbox.force_group_change", env, [os.path.join(samba3srcdir, "script/tests/test_force_group_change.sh"), '$SERVER', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', smbclient3, smbcontrol]) + plantestsuite("samba3.blackbox.zero-data", env, + [os.path.join(samba3srcdir, "script/tests/test_zero_data.sh"), + '$SERVER_IP', '$USERNAME', '$PASSWORD', '$LOCAL_PATH']) # # tar command tests |