[PATCH]selftest: fix test_dfree_quota.sh blackbox test suite

Jeremy Allison jra at samba.org
Wed Jan 27 21:03:40 UTC 2016


On Wed, Jan 27, 2016 at 10:51:47PM +0200, Uri Simchoni wrote:
> Hi,
> This recently-committed test had a flaw which caused the test to
> fail only for some of the users and succeed for others. Attached is
> a fix.
> 
> The problem was usage of username in the test env, coupled with
> incorrect '\' handling. So for example, if smbcquotas output
> contained 'FILESERVER\amitay', and the test did 'echo "$output" |
> awk "some-clever-stuff"', then the echo command (shell builtin
> command) would treat \a as an escape sequence rather than two
> distinct characters, causing awk to fail. If, OTHO, the output was
> FILESERVER\uri, then echo would treat \u as two distinct characters.
> 
> Review appreciated, and sorry for the inconvenience (and delay of
> the 4.4 release?).

Oh good catch ! Pushed along with your other quotas fix.


> From 9558c427453e55eff0ed87242ca2226d53e3194d Mon Sep 17 00:00:00 2001
> From: Uri Simchoni <uri at samba.org>
> Date: Wed, 27 Jan 2016 21:47:30 +0200
> Subject: [PATCH 1/2] selftest: fix test_dfree_quota.sh
> 
> Eliminate backslashes from smbcquotas output so that we
> don't have to deal with them correctly when parsing the output.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=11697
> 
> Signed-off-by: Uri Simchoni <uri at samba.org>
> ---
>  source3/script/tests/test_dfree_quota.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/source3/script/tests/test_dfree_quota.sh b/source3/script/tests/test_dfree_quota.sh
> index c693b7b..5392d3d 100755
> --- a/source3/script/tests/test_dfree_quota.sh
> +++ b/source3/script/tests/test_dfree_quota.sh
> @@ -128,10 +128,10 @@ test_smbcquotas() {
>      shift
>  	subunit_start_test "$name"
>      setup_conf "$conf" "."
> -	output=$($VALGRIND $smbcquotas //$SERVER/dfq $@ 2>/dev/null)
> +	output=$($VALGRIND $smbcquotas //$SERVER/dfq $@ 2>/dev/null | tr '\\' '/')
>  	status=$?
>  	if [ "$status" = "0" ]; then
> -		received=$(echo "$output" | awk "/$SERVER\\\\$user/ {printf \"%s%s%s\", \$3, \$4, \$5}")
> +		received=$(echo "$output" | awk "/$SERVER\\/$user/ {printf \"%s%s%s\", \$3, \$4, \$5}")
>  		if [ "$expected" = "$received" ]; then
>  			subunit_pass_test "$name"
>  		else
> -- 
> 2.4.3
> 
> 
> From ed84e5f9c4e02eaf5bd1232cd2c41f3b72996a9e Mon Sep 17 00:00:00 2001
> From: Uri Simchoni <uri at samba.org>
> Date: Wed, 27 Jan 2016 22:09:51 +0200
> Subject: [PATCH 2/2] selftest: un-flap samba3.blackbox.dfree_quota
> 
> Remove test from flapping list after fix.
> 
> Signed-off-by: Uri Simchoni <uri at samba.org>
> ---
>  selftest/flapping | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/selftest/flapping b/selftest/flapping
> index 8b05593..1928180 100644
> --- a/selftest/flapping
> +++ b/selftest/flapping
> @@ -30,4 +30,3 @@
>  ^samba4.blackbox.samba_tool_demote # flakey on sn-devel
>  ^samba4.blackbox.dbcheck # flakey on sn-devel
>  ^samba4.smb2.create.mkdir-dup\(ad_dc_ntvfs\) # This test (for bug 11486) involves a race, not always protected against in the NTVFS file server
> -^samba3.blackbox.dfree_quota #flakey on sn-devel
> -- 
> 2.4.3
> 




More information about the samba-technical mailing list