summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2022-05-23 20:11:13 +0100
committerJule Anger <janger@samba.org>2022-05-30 08:15:10 +0000
commit239e0759db3d3b52ff78b326b779635900b7551e (patch)
tree8115cd6efb3136065c1d0c920f8305c12693ba29
parent53ac81eef24f1c60d2d9cdc9c5f21ade32275d81 (diff)
downloadsamba-239e0759db3d3b52ff78b326b779635900b7551e.tar.gz
s3/script/tests: Test smbclient -E redirects output to stderr
Add new test to ensure smbclient is writing to stderr (with '-E') Add knownfail for this test (will be removed when issue is fixed in later commit) BUG: https://bugzilla.samba.org/show_bug.cgi?id=15075 Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 5b6493043fc90a2bed5aaedad3b4511621d0b9fd)
-rw-r--r--selftest/knownfail.d/smbclient-smb31
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh45
2 files changed, 46 insertions, 0 deletions
diff --git a/selftest/knownfail.d/smbclient-smb3 b/selftest/knownfail.d/smbclient-smb3
index 119e93e479a..4d884db5025 100644
--- a/selftest/knownfail.d/smbclient-smb3
+++ b/selftest/knownfail.d/smbclient-smb3
@@ -1,4 +1,5 @@
^samba3.blackbox.smbclient_s3.SMB3.*.creating.a.bad.symlink.and.deleting.it
+^samba3.blackbox.smbclient_s3.*.smbclient output goes to stderr when -E is passed
^samba3.blackbox.acl_xattr.SMB3.nt_affects_posix
^samba3.blackbox.acl_xattr.SMB3.nt_affects_chown
^samba3.blackbox.acl_xattr.SMB3.nt_affects_chgrp
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 3da37e699e6..fc608bdfc9b 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -2043,6 +2043,47 @@ EOF
return 0
}
+test_smbclient_minus_e_stderr()
+{
+ cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -c ls'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ if [ $? != 0 ] ; then
+ echo "$out"
+ echo "command failed"
+ return 1
+ fi
+
+ # test smbclient 'ls' command output went to stdout
+ echo "$out" | grep "blocks available" >/dev/null 2>&1
+ if [ $? != 0 ] ; then
+ # didn't get output to stdout
+ echo "expected output was NOT output to stdout"
+ return 1
+ fi
+
+ # this time execute ls but redirect stdout alone to /dev/null
+ cmd='$SMBCLIENT -E "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -c "ls" 2>&1 > /dev/null'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ if [ $? != 0 ] ; then
+ echo "$out"
+ echo "command failed"
+ return 1
+ fi
+
+ # test smbclient 'ls' command output went to stderr
+ echo "$out" | grep "blocks available" >/dev/null 2>&1
+ if [ $? != 0 ] ; then
+ # didn't get output to stderr
+ echo "expected output was NOT output to stderr"
+ return 1
+ fi
+
+ return 0
+
+}
+
#
#
LOGDIR_PREFIX=test_smbclient_s3
@@ -2068,6 +2109,10 @@ testit "noninteractive smbclient -l does not prompt" \
test_noninteractive_no_prompt -l $LOGDIR || \
failed=`expr $failed + 1`
+testit "smbclient output goes to stderr when -E is passed" \
+ test_smbclient_minus_e_stderr || \
+ failed=`expr $failed + 1`
+
testit "interactive smbclient prompts on stdout" \
test_interactive_prompt_stdout || \
failed=`expr $failed + 1`