1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s3:tests: Reformat test_fifo.sh

shfmt -f source3/script/| xargs shfmt -w -p -i 0 -fn

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Andreas Schneider 2022-04-22 15:34:08 +02:00 committed by Andreas Schneider
parent ce1a0119b7
commit ce301a78e3

View File

@ -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