commit 90834834a4bf1546cd06d2948e0282108ec4f457 Author: Salvador I. Gonzalez Date: Sat Aug 11 10:48:36 2012 -0400 Add smbclient tarmode test diff --git a/source3/script/tests/test_smbclient_tarmode.sh b/source3/script/tests/test_smbclient_tarmode.sh new file mode 100755 index 0000000..81412b5 --- /dev/null +++ b/source3/script/tests/test_smbclient_tarmode.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# this runs a simple tarmode test + +if [ $# -lt 4 ]; then +cat < +EOF +exit 1; +fi + +SERVER="$1" +SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" +SMBCLIENT="$5" +SMBCLIENT="$VALGRIND ${SMBCLIENT}" +shift 5 +ADDARGS="$*" + +incdir=`dirname $0`/../../../testprogs/blackbox +. $incdir/subunit.sh + +# Build a quick Dir structure +TEMPDIR="/tmp" +TESTDIR="tarmode.test.$$" +mkdir -p "/tmp/$TESTDIR" + +NUM_TEST_FILES=10 +if od --version > /dev/null 2>&1; then # Use random file sizes + I=1 + for RND in `od -An -N$NUM_TEST_FILES -tu1 < /dev/urandom`; do + dd if=/dev/urandom of="$TEMPDIR/$TESTDIR/test.dat.$I" bs=1024 count=$RND + I=`expr $I + 1` + done +else # Fallback to same file sizes + I=1 + while [ $I -le $NUM_TEST_FILES ]; do + dd if=/dev/urandom of="$TEMPDIR/$TESTDIR/test.dat.$I" bs=1024 count=25 + I=`expr $I + 1` + done +fi + +# Upload to server +( cd $TMPDIR && \ + $SMBCLIENT //$SERVER/c$ $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ + -c "recurse;prompt;mput $TESTDIR" ) + +testit "smbclient //$SERVER/c$ tarmode" $SMBCLIENT //$SERVER/c$ $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ + -c "tarmode full" -Tc /dev/null "/$TESTDIR" $ADDARGS + +# Cleanup our mess. FIXME: Will this run if the test fails? +rm -rf -- "$TMPDIR/$TESTDIR" +$SMBCLIENT //$SERVER/c$ $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ + -D "$TESTDIR" -c "del *" +$SMBCLIENT //$SERVER/c$ $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ + -c "rd $TESTDIR" diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index a890372..f28293d 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -207,6 +207,10 @@ for env in ["member", "s3member"]: for env in ["s3dc"]: plantestsuite("samba3.blackbox.smbclient_s3.crypt (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_s3.sh"), '$SERVER', '$SERVER_IP', '$DOMAIN', '$USERNAME', '$PASSWORD', '$USERID', '$LOCAL_PATH', '$PREFIX', smbclient, wbinfo, configuration, "-e"]) +# Test smbclient/tarmode +for env in [""]: + plantestsuite("samba3.blackbox.smbclient_tarmode (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', smbclient, configuration]) + #TODO encrypted against member, with member creds, and with DC creds plantestsuite("samba3.blackbox.net.misc", "s3dc:local", [os.path.join(samba3srcdir, "script/tests/test_net_misc.sh"),