[PATCH] s4 messaging tests: Fix race condition in smbcontrol tests

Jeremy Allison jra at samba.org
Thu Dec 20 23:00:50 UTC 2018


On Fri, Dec 21, 2018 at 09:07:01AM +1300, Gary Lockyer via samba-technical wrote:
> The test for the smbcontrol sleep command and the inject fault command
> both used the "rpc_server" process as a target.  As the inject fault
> command caused the process to restart there was a race condition between
> the process restarting and the sleep test running.  To prevent this the
> tests now use different target processes.
> 
> 
> Review appreciated

Makes sense to me ! RB+ and pushed.

Cheers,

Jeremy.

> Gary
> 
> 
> 
> 
> 

> From 2b044aa18ff62ca7ebdfbd9bb27472a58ea3fce6 Mon Sep 17 00:00:00 2001
> From: Gary Lockyer <gary at catalyst.net.nz>
> Date: Thu, 20 Dec 2018 15:46:21 +1300
> Subject: [PATCH] s4 messaging tests: Fix race condition in smbcontrol tests
> 
> The test for the smbcontrol sleep command and the inject fault command
> both used the "rpc_server" process as a target.  As the inject fault
> command caused the process to restart there was a race condition between
> the process restarting and the sleep test running.  To prevent this the
> tests now use different target processes.
> 
> Signed-off-by: Gary Lockyer <gary at catalyst.net.nz>
> ---
>  python/samba/tests/blackbox/smbcontrol_process.py | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/python/samba/tests/blackbox/smbcontrol_process.py b/python/samba/tests/blackbox/smbcontrol_process.py
> index 4313c6faef3..b4ccc4c455c 100644
> --- a/python/samba/tests/blackbox/smbcontrol_process.py
> +++ b/python/samba/tests/blackbox/smbcontrol_process.py
> @@ -54,6 +54,10 @@ class SmbcontrolProcessBlockboxTests(BlackboxTestCase):
>      def test_inject_fault(self):
>          INJECT = "inject"
>          FAULT = "segv"
> +        #
> +        # Note that this process name needs to be different to the one used
> +        # in the sleep test to avoid a race condition
> +        #
>          pid = self.get_process("rpc_server")
>  
>          #
> @@ -90,7 +94,11 @@ class SmbcontrolProcessBlockboxTests(BlackboxTestCase):
>          DURATION = 5     # duration to sleep server for
>          DELTA = 1        # permitted error for the sleep duration
>  
> -        pid = self.get_process("rpc_server")
> +        #
> +        # Note that this process name needs to be different to the one used
> +        # in the inject fault test to avoid a race condition
> +        #
> +        pid = self.get_process("ldap_server")
>          #
>          # Ensure we can ping the process before getting it to sleep
>          #
> -- 
> 2.18.1
> 
> 







More information about the samba-technical mailing list