The Samba-Bugzilla – Attachment 7762 Details for
Bug 9088
[PATCH] Freed frame ../source3/libsmb/clilist.c:934, expected ../source3/client/clitar.c:821
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Updated tests
0001-Add-smbclient-tarmode-test.patch (text/plain), 5.40 KB, created by
Sal Gonzalez
on 2012-08-13 18:28:30 UTC
(
hide
)
Description:
Updated tests
Filename:
MIME Type:
Creator:
Sal Gonzalez
Created:
2012-08-13 18:28:30 UTC
Size:
5.40 KB
patch
obsolete
>From 6850270a3a8377ae2ec7f84ad68cd92ab244d72b Mon Sep 17 00:00:00 2001 >From: "Salvador I. Gonzalez" <sgonzalez@codejunkie.net> >Date: Sat, 11 Aug 2012 10:48:36 -0400 >Subject: [PATCH] Add smbclient tarmode test > >--- > source3/script/tests/test_smbclient_tarmode.sh | 177 ++++++++++++++++++++++++ > source3/selftest/tests.py | 4 + > 2 files changed, 181 insertions(+), 0 deletions(-) > create mode 100755 source3/script/tests/test_smbclient_tarmode.sh > >diff --git a/source3/script/tests/test_smbclient_tarmode.sh b/source3/script/tests/test_smbclient_tarmode.sh >new file mode 100755 >index 0000000..74e9882 >--- /dev/null >+++ b/source3/script/tests/test_smbclient_tarmode.sh >@@ -0,0 +1,177 @@ >+#!/bin/sh >+ >+# this runs a simple tarmode test >+ >+if [ $# -lt 7 ]; then >+cat <<EOF >+Usage: test_smbclient_tarmode.sh SERVER SERVER_IP USERNAME PASSWORD LOCAL_PATH PREFIX SMBCLIENT [create|extract] <smbclient arguments> >+EOF >+exit 1; >+fi >+ >+SERVER="$1" >+SERVER_IP="$2" >+USERNAME="$3" >+PASSWORD="$4" >+LOCAL_PATH="$5" >+PREFIX="$6" >+SMBCLIENT="$7" >+SMBCLIENT="$VALGRIND ${SMBCLIENT}" >+shift 7 >+ADDARGS="$*" >+ >+incdir=`dirname $0`/../../../testprogs/blackbox >+. $incdir/subunit.sh >+ >+FAILCOUNT=0 >+ >+# Check command is available >+have_command() { >+ type "$1" > /dev/null 2>&1 >+ return $? >+} >+ >+# Create a test corpus >+create_test_data() { >+ >+ local DIR="$1" >+ local BS=1024 >+ local NUM_FILES=10 >+ local NORND_COUNT=25 >+ >+ # Bomb if dir exists >+ if [ -e "$DIR" ]; then >+ echo "Test data directory '$DIR' already exists!" >+ false >+ return >+ fi >+ >+ if ! mkdir -p "$DIR" > /dev/null 2>&1; then >+ echo "Couldn't create test data directory '$DIR'" >+ false >+ return >+ fi >+ >+ local I=1 >+ if have_command "od"; then # Use random file sizes >+ local RND_COUNT >+ for RND_COUNT in `od -An -N$NUM_FILES -tu1 < /dev/urandom`; do >+ if ! dd if=/dev/urandom of="$DIR/file.$I" bs=$BS count=$RND_COUNT > /dev/null 2>&1; then >+ echo "Couldn't create test file '$DIR/file.$I' (random size)" >+ false >+ return >+ fi >+ I=`expr $I + 1` >+ done >+ else # Fallback to same file sizes >+ while [ $I -le $NUM_FILES ]; do >+ if ! dd if=/dev/urandom of="$DIR/file.$I" bs=$BS count=$NORND_COUNT > /dev/null 2>&1; then >+ echo "Couldn't create test file '$DIR/file.$I' (static size)" >+ false >+ return >+ fi >+ I=`expr $I + 1` >+ done >+ fi >+ >+ true >+ return >+ >+} >+ >+# Check that two directories are equivalent (In Data content) >+validate_data() { >+ local DIR1="$1" >+ local DIR2="$2" >+ >+ diff -r "$DIR1" "$DIR2" >+ return $? >+} >+ >+# Test tarmode -Tc >+test_tarmode_creation() { >+ >+ # Clear temp data >+ rm -rf -- {"$PREFIX","$LOCAL_PATH"}/tarmode{,.tar} > /dev/null 2>&1 >+ >+ # Build the test data >+ if ! create_test_data "$LOCAL_PATH/tarmode"; then >+ echo "Test data creation failed" >+ false >+ return >+ fi >+ >+ # Create tarfile with smbclient >+ if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ >+ $ADDARGS -c "tarmode full" -Tc "$PREFIX/tarmode.tar" "/tarmode"; then >+ echo "Couldn't create tar file with tarmode -Tc" >+ false >+ return >+ fi >+ >+ # Extract data to verify >+ if ! tar -xf "$PREFIX/tarmode.tar" -C "$PREFIX"; then >+ echo "Couldn't extract data from created tarfile" >+ false >+ return >+ fi >+ >+ # Verify data >+ if ! verify_data "$PREFIX/tarmode" "$LOCAL_PATH/tarmode"; then >+ echo "Data not equivalent" >+ false >+ return >+ fi >+ >+ true >+ return >+ >+} >+ >+# Test tarmode -Tx >+test_tarmode_extraction() { >+ >+ # Clear temp data >+ rm -rf -- {"$PREFIX","$LOCAL_PATH"}/tarmode{,.tar} > /dev/null 2>&1 >+ >+ # Build the test data >+ if ! create_test_data "$PREFIX/tarmode"; then >+ echo "Test data creation failed" >+ false >+ return >+ fi >+ >+ # Create tarfile to extract on client >+ if ! tar -cf "$PREFIX/tarmode.tar" -C "$PREFIX" tarmode; then >+ echo "Couldn't create tar archive" >+ false >+ return >+ fi >+ >+ # Extract tarfile with smbclient >+ if ! $SMBCLIENT //$SERVER/tmp $CONFIGURATION -U$USERNAME%$PASSWORD -I $SERVER_IP -p 139 \ >+ $ADDARGS -c "tarmode full" -Tx "$PREFIX/tarmode.tar"; then >+ echo "Couldn't extact tar file with tarmode -Tx" >+ false >+ return >+ fi >+ >+ # Verify data >+ if ! verify_data "$PREFIX/tarmode" "$LOCAL_PATH/tarmode"; then >+ echo "Data not equivalent" >+ false >+ return >+ fi >+ >+ true >+ return >+ >+} >+ >+testit "test_tarmode_creation" \ >+ test_tarmode_creation || FAILCOUNT=`expr $FAILCOUNT + 1` >+ >+testit "test_tarmode_extraction" \ >+ test_tarmode_extraction || FAILCOUNT=`expr $FAILCOUNT + 1` >+ >+testok $0 $FAILCOUNT >diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py >index a890372..3432cdc 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 ["member"]: >+ plantestsuite("samba3.blackbox.smbclient_tarmode (%s)" % env, env, [os.path.join(samba3srcdir, "script/tests/test_smbclient_tarmode.sh"), '$SERVER', '$SERVER_IP', '$USERNAME', '$PASSWORD', '$LOCAL_PATH', '$PREFIX', 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"), >-- >1.7.8.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 9088
:
7756
|
7757
|
7758
|
7759
|
7760
|
7761
| 7762 |
7763