The branch, master has been updated via cda4db7d593 s3:tests: Reformat test_forceuser_validusers.sh via f1e40238e43 s3:tests: Reformat test_force_user_unlink.sh via 3c313a218a7 s3:tests: Reformat test_force_group_change.sh via c72b48051b5 s3:tests: Reformat test_force_create_mode.sh via 2af74a2bdd4 s3:tests: Reformat test_force_close_share.sh via ce301a78e35 s3:tests: Reformat test_fifo.sh via ce1a0119b77 s3:tests: Reformat test_failure.sh from cc606c7c786 s3:tests: Reformat test_durable_handle_reconnect.sh
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit cda4db7d593430e33ca34432ea80485bc7dae2c2 Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:09 2022 +0200 s3:tests: Reformat test_forceuser_validusers.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Thu May 5 11:53:51 UTC 2022 on sn-devel-184 commit f1e40238e433846ea14f584cc62f525d9019ba18 Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:09 2022 +0200 s3:tests: Reformat test_force_user_unlink.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 3c313a218a7f4d5699be60c8218768c188e18dae Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:09 2022 +0200 s3:tests: Reformat test_force_group_change.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c72b48051b5c3f8d908b3a731ec0d3c236aaa1a8 Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:09 2022 +0200 s3:tests: Reformat test_force_create_mode.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 2af74a2bdd4d10d50843bb395114f848438543d8 Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:08 2022 +0200 s3:tests: Reformat test_force_close_share.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ce301a78e351e7f52452d9a98834f52529a62cee Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:08 2022 +0200 s3:tests: Reformat test_fifo.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit ce1a0119b7707aed6e47ef15c6bd797711f2a88a Author: Andreas Schneider <a...@samba.org> Date: Fri Apr 22 15:34:08 2022 +0200 s3:tests: Reformat test_failure.sh shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/script/tests/test_failure.sh | 15 +++-- source3/script/tests/test_fifo.sh | 70 +++++++++++------------ source3/script/tests/test_force_close_share.sh | 47 +++++++-------- source3/script/tests/test_force_create_mode.sh | 58 +++++++++---------- source3/script/tests/test_force_group_change.sh | 60 +++++++++---------- source3/script/tests/test_force_user_unlink.sh | 31 +++++----- source3/script/tests/test_forceuser_validusers.sh | 16 +++--- 7 files changed, 149 insertions(+), 148 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/script/tests/test_failure.sh b/source3/script/tests/test_failure.sh index 4980fb09201..7a2c9aec38c 100755 --- a/source3/script/tests/test_failure.sh +++ b/source3/script/tests/test_failure.sh @@ -4,7 +4,7 @@ # # Copyright (C) 2011 Michael Adam <ob...@samba.org> -incdir=`dirname $0`/../../../testprogs/blackbox +incdir=$(dirname $0)/../../../testprogs/blackbox . $incdir/subunit.sh failed=0 @@ -20,16 +20,15 @@ test_success() } testit "success" \ - test_success || \ - failed=`expr $failed + 1` + test_success || + failed=$(expr $failed + 1) testit "failure" \ - test_failure || \ - failed=`expr $failed + 1` + test_failure || + failed=$(expr $failed + 1) testit "success" \ - test_success || \ - failed=`expr $failed + 1` + test_success || + failed=$(expr $failed + 1) testok $0 $failed - diff --git a/source3/script/tests/test_fifo.sh b/source3/script/tests/test_fifo.sh index 11741dcc038..199b0b495e9 100755 --- a/source3/script/tests/test_fifo.sh +++ b/source3/script/tests/test_fifo.sh @@ -4,10 +4,10 @@ # if [ $# -lt 7 ]; then -cat <<EOF + cat <<EOF Usage: $0 SERVER DOMAIN USERNAME PASSWORD PREFIX TARGET_ENV SMBCLIENT EOF -exit 1; + exit 1 fi SERVER=${1} @@ -21,7 +21,7 @@ shift 7 SMBCLIENT="$VALGRIND ${SMBCLIENT}" ADDARGS="$@" -incdir=`dirname $0`/../../../testprogs/blackbox +incdir=$(dirname $0)/../../../testprogs/blackbox . $incdir/subunit.sh failed=0 @@ -32,52 +32,52 @@ failed=0 # test_fifo() { - local fifo_dir_path="$PREFIX/$TARGET_ENV/share/fifodir" - local fifo_path="$fifo_dir_path/fifo_name" + local fifo_dir_path="$PREFIX/$TARGET_ENV/share/fifodir" + local fifo_path="$fifo_dir_path/fifo_name" - local tmpfile=$PREFIX/smbclient.in.$$ + local tmpfile=$PREFIX/smbclient.in.$$ - cat > $tmpfile <<EOF + cat >$tmpfile <<EOF cd fifodir ls quit EOF - # Create fifo directory. - mkdir -p $fifo_dir_path - # Create fifo underneath. - mkfifo $fifo_path + # Create fifo directory. + mkdir -p $fifo_dir_path + # Create fifo underneath. + mkfifo $fifo_path - local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/$1 -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1' - eval echo "$cmd" - out=`eval $cmd` - ret=$? + local cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT //$SERVER/$1 -U$USERNAME%$PASSWORD $ADDARGS < $tmpfile 2>&1' + eval echo "$cmd" + out=$(eval $cmd) + ret=$? - # Remove fifo and containing dir. - rm $fifo_path - rmdir $fifo_dir_path - rm -f $tmpfile + # Remove fifo and containing dir. + rm $fifo_path + rmdir $fifo_dir_path + rm -f $tmpfile - # Check for smbclient error. - if [ $ret != 0 ] ; then - echo "Failed accessing share containing dir with fifo $ret" - echo "$out" - return 1 - fi + # Check for smbclient error. + if [ $ret != 0 ]; then + echo "Failed accessing share containing dir with fifo $ret" + echo "$out" + return 1 + fi - # Check for smbclient timeout (server hung). - echo "$out" | grep 'NT_STATUS_' - ret=$? - if [ $ret -eq 0 ] ; then - # Client was disconnected as server timed out. - echo "$out" - return 1 - fi + # Check for smbclient timeout (server hung). + echo "$out" | grep 'NT_STATUS_' + ret=$? + if [ $ret -eq 0 ]; then + # Client was disconnected as server timed out. + echo "$out" + return 1 + fi - return 0 + return 0 } testit "list directory containing a fifo" \ - test_fifo tmp || failed=`expr $failed + 1` + test_fifo tmp || failed=$(expr $failed + 1) exit $failed diff --git a/source3/script/tests/test_force_close_share.sh b/source3/script/tests/test_force_close_share.sh index 2d01b3162f1..87276ad1a08 100755 --- a/source3/script/tests/test_force_close_share.sh +++ b/source3/script/tests/test_force_close_share.sh @@ -10,8 +10,8 @@ # with 2 second delays on pread/pwrite. if [ $# -lt 6 ]; then - echo Usage: $0 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename PREFIX - exit 1 + echo Usage: $0 SERVERCONFFILE SMBCLIENT SMBCONTROL IP aio_delay_inject_sharename PREFIX + exit 1 fi CONFIGURATION=$1 @@ -44,34 +44,35 @@ rm -f $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR $TESTFILE 2>/dev/null # Create the smbclient communication pipes. mkfifo $FIFO_STDIN $FIFO_STDOUT $FIFO_STDERR if [ $? -ne 0 ]; then - echo "Failed to create fifos" - exit 1 + echo "Failed to create fifos" + exit 1 fi # Create a large-ish testfile head -c 100MB /dev/zero >$TESTFILE -CLI_FORCE_INTERACTIVE=1; export CLI_FORCE_INTERACTIVE +CLI_FORCE_INTERACTIVE=1 +export CLI_FORCE_INTERACTIVE ${smbclient} //${SERVER}/${SHARE} ${CONFIGURATION} -U${USER}%${PASSWORD} \ - < $FIFO_STDIN > $FIFO_STDOUT 2>$FIFO_STDERR & + <$FIFO_STDIN >$FIFO_STDOUT 2>$FIFO_STDERR & CLIENT_PID=$! count=0 while [ 1 ]; do - if [ $count -ge 20 ]; then - echo "Failed to start smbclient" - exit 1 - fi - kill -0 $CLIENT_PID - if [ $? -eq 0 ]; then - break - fi - sleep 0.5 - count=$((count + 1)) + if [ $count -ge 20 ]; then + echo "Failed to start smbclient" + exit 1 + fi + kill -0 $CLIENT_PID + if [ $? -eq 0 ]; then + break + fi + sleep 0.5 + count=$((count + 1)) done -exec 100>$FIFO_STDIN 101<$FIFO_STDOUT 102<$FIFO_STDERR +exec 100>$FIFO_STDIN 101<$FIFO_STDOUT 102<$FIFO_STDERR # consume the smbclient startup messages head -n 1 <&101 @@ -86,7 +87,7 @@ sleep 0.2 # Close the aio_delay_inject share whilst we have outstanding writes. testit "smbcontrol" ${SMBCONTROL} ${CONFIGURATION} smbd close-share ${SHARE} || - failed=$(expr $failed + 1) + failed=$(expr $failed + 1) sleep 0.5 @@ -98,17 +99,17 @@ sleep 0.5 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 # COUNT=$(head -n 2 <&102 | - grep -e NT_STATUS_NETWORK_NAME_DELETED -e NT_STATUS_INVALID_HANDLE | - wc -l) + grep -e NT_STATUS_NETWORK_NAME_DELETED -e NT_STATUS_INVALID_HANDLE | + wc -l) testit "Verify close-share did cancel the file put" \ - test $COUNT -ge 1 || failed=$(expr $failed + 1) + test $COUNT -ge 1 || failed=$(expr $failed + 1) kill ${CLIENT_PID} # Remove the testfile from the server test_smbclient "remove_testfile" \ - 'del testfile; quit' //${SERVER}/${SHARE} -U${USER}%${PASSWORD} \ - || failed=$(expr $failed + 1) + 'del testfile; quit' //${SERVER}/${SHARE} -U${USER}%${PASSWORD} || + failed=$(expr $failed + 1) testok $0 $failed diff --git a/source3/script/tests/test_force_create_mode.sh b/source3/script/tests/test_force_create_mode.sh index d5948b239b1..289f219f55c 100755 --- a/source3/script/tests/test_force_create_mode.sh +++ b/source3/script/tests/test_force_create_mode.sh @@ -4,10 +4,10 @@ # if [ $# -lt 7 ]; then -cat <<EOF + cat <<EOF Usage: $0 SERVER DOMAIN USERNAME PASSWORD PREFIX TARGET_ENV SMBCLIENT EOF -exit 1; + exit 1 fi SERVER=${1} @@ -21,52 +21,52 @@ shift 7 SMBCLIENT="$VALGRIND ${SMBCLIENT}" ADDARGS="$@" -incdir=`dirname $0`/../../../testprogs/blackbox +incdir=$(dirname $0)/../../../testprogs/blackbox . $incdir/subunit.sh failed=0 test_force_create_mode() { - local filename="wurst.$$" - local filename_path="$PREFIX/$filename" + local filename="wurst.$$" + local filename_path="$PREFIX/$filename" - local tmpfile=$PREFIX/smbclient_interactive_prompt_commands + local tmpfile=$PREFIX/smbclient_interactive_prompt_commands - echo wurstbar > $filename_path + echo wurstbar >$filename_path - cat > $tmpfile <<EOF + cat >$tmpfile <<EOF lcd $PREFIX put $filename quit EOF - cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/$1 $ADDARGS < $tmpfile 2>&1' - eval echo "$cmd" - out=`eval $cmd` - ret=$? - rm -f $tmpfile + cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT -U$USERNAME%$PASSWORD //$SERVER/$1 $ADDARGS < $tmpfile 2>&1' + eval echo "$cmd" + out=$(eval $cmd) + ret=$? + rm -f $tmpfile - if [ $ret -ne 0 ] ; then - echo "$out" - echo "Failed to connect - error: $ret" - return 1 - fi - rm -f $filename_path + if [ $ret -ne 0 ]; then + echo "$out" + echo "Failed to connect - error: $ret" + return 1 + fi + rm -f $filename_path - share_filename="$PREFIX/$TARGET_ENV/share/$filename" - file_perms=$(stat --format=%a $share_filename) - if [ "$file_perms" != "664" ]; then - echo "Invalid file permissions: $file_perms" - return 1 - fi + share_filename="$PREFIX/$TARGET_ENV/share/$filename" + file_perms=$(stat --format=%a $share_filename) + if [ "$file_perms" != "664" ]; then + echo "Invalid file permissions: $file_perms" + return 1 + fi - rm -f $share_filename + rm -f $share_filename - return 0 + return 0 } testit "test_mode=0664" \ - test_force_create_mode create_mode_664 || \ - failed=`expr $failed + 1` + test_force_create_mode create_mode_664 || + failed=$(expr $failed + 1) exit $failed diff --git a/source3/script/tests/test_force_group_change.sh b/source3/script/tests/test_force_group_change.sh index 6cb1ab4e048..bf82903fedb 100755 --- a/source3/script/tests/test_force_group_change.sh +++ b/source3/script/tests/test_force_group_change.sh @@ -17,27 +17,27 @@ SMBCLIENT="${5}" SMBCONTROL="${6}" shift 6 -incdir=`dirname $0`/../../../testprogs/blackbox +incdir=$(dirname $0)/../../../testprogs/blackbox . $incdir/subunit.sh failed=0 test_force_group_change() { -# -# A SMB_CONF variable passed in here is the client smb.conf. -# We need to convert to the server.conf file from -# the LOCAL_PATH variable. -# -SERVER_CONFIG=`dirname $LOCAL_PATH`/lib/server.conf -SERVER_CONFIG_SAVE=${SERVER_CONFIG}.bak -SERVER_CONFIG_NEW=${SERVER_CONFIG}.new -cp $SERVER_CONFIG $SERVER_CONFIG_SAVE + # + # A SMB_CONF variable passed in here is the client smb.conf. + # We need to convert to the server.conf file from + # the LOCAL_PATH variable. + # + SERVER_CONFIG=$(dirname $LOCAL_PATH)/lib/server.conf + SERVER_CONFIG_SAVE=${SERVER_CONFIG}.bak + SERVER_CONFIG_NEW=${SERVER_CONFIG}.new + cp $SERVER_CONFIG $SERVER_CONFIG_SAVE -sed -e 's/#\tforce group = everyone/\tforce group = everyone/' <${SERVER_CONFIG} >${SERVER_CONFIG_NEW} + sed -e 's/#\tforce group = everyone/\tforce group = everyone/' <${SERVER_CONFIG} >${SERVER_CONFIG_NEW} - tmpfile=$PREFIX/smbclient_force_group_change_commands - cat > $tmpfile <<EOF + tmpfile=$PREFIX/smbclient_force_group_change_commands + cat >$tmpfile <<EOF ls !cp ${SERVER_CONFIG_NEW} ${SERVER_CONFIG} !${SMBCONTROL} --configfile=${SERVER_CONFIG} all reload-config @@ -47,27 +47,27 @@ ls quit EOF - cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/force_group_test $CONFIGURATION < $tmpfile 2>&1' - eval echo "$cmd" - out=$(eval $cmd) - ret=$? - rm -f $tmpfile - rm -f $SERVER_CONFIG_SAVE - rm -f $SERVER_CONFIG_NEW + cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/force_group_test $CONFIGURATION < $tmpfile 2>&1' + eval echo "$cmd" + out=$(eval $cmd) + ret=$? + rm -f $tmpfile + rm -f $SERVER_CONFIG_SAVE + rm -f $SERVER_CONFIG_NEW - echo "$out" | grep 'NT_STATUS_CONNECTION_DISCONNECTED' - ret=$? - if [ $ret -eq 0 ] ; then - # Client was disconnected as server crashed. - echo "$out" - return 1 - fi + echo "$out" | grep 'NT_STATUS_CONNECTION_DISCONNECTED' + ret=$? + if [ $ret -eq 0 ]; then + # Client was disconnected as server crashed. + echo "$out" + return 1 + fi - return 0 + return 0 } testit "test force group change" \ - test_force_group_change || \ - failed=`expr $failed + 1` + test_force_group_change || + failed=$(expr $failed + 1) testok $0 $failed diff --git a/source3/script/tests/test_force_user_unlink.sh b/source3/script/tests/test_force_user_unlink.sh index 86076535497..c67b28f1f1a 100755 --- a/source3/script/tests/test_force_user_unlink.sh +++ b/source3/script/tests/test_force_user_unlink.sh @@ -12,25 +12,26 @@ smbclient="$BINDIR/smbclient" error_inject_conf=$(dirname ${SMB_CONF_PATH})/error_inject.conf failed=0 -test_forced_user_can_delete() { - out=$($smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "rm dir/file") - if [ $? -ne 0 ] ; then - echo $out - return 1 - fi - tmp=$(echo $out | grep NT_STATUS_ ) - if [ $? -eq 0 ] ; then - return 1 - fi - return 0 +test_forced_user_can_delete() +{ + out=$($smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "rm dir/file") + if [ $? -ne 0 ]; then + echo $out + return 1 + fi + tmp=$(echo $out | grep NT_STATUS_) + if [ $? -eq 0 ]; then + return 1 + fi + return 0 } -echo "error_inject:unlinkat = EACCES" > ${error_inject_conf} +echo "error_inject:unlinkat = EACCES" >${error_inject_conf} -$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "mkdir dir" || failed=`expr $failed + 1` -$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "put WHATSNEW.txt dir/file" || failed=`expr $failed + 1` +$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "mkdir dir" || failed=$(expr $failed + 1) +$smbclient -U $DOMAIN/$USERNAME%$PASSWORD //$SERVER_IP/force_user_error_inject -c "put WHATSNEW.txt dir/file" || failed=$(expr $failed + 1) -testit "test_forced_user_can_delete" test_forced_user_can_delete || failed=`expr $failed + 1` +testit "test_forced_user_can_delete" test_forced_user_can_delete || failed=$(expr $failed + 1) rm ${error_inject_conf} diff --git a/source3/script/tests/test_forceuser_validusers.sh b/source3/script/tests/test_forceuser_validusers.sh index d9150c95a67..6ee0515f89a 100755 --- a/source3/script/tests/test_forceuser_validusers.sh +++ b/source3/script/tests/test_forceuser_validusers.sh @@ -4,10 +4,10 @@ # if [ $# -lt 6 ]; then -cat <<EOF + cat <<EOF Usage: test_forceuser.sh SERVER DOMAIN USERNAME PASSWORD LOCAL_PATH SMBCLIENT <smbclient arguments> EOF -exit 1; + exit 1 fi SERVER="$1" @@ -21,17 +21,17 @@ shift 6 ADDARGS="$*" failed=0 - -- Samba Shared Repository