Control: tags -1 patch

Hi,

On 08.01.2017 18:27, Rebecca N. Palmer wrote:
> (I had never heard of this package before your d-d post: I'm looking at it
> because of the number of to-be-autoremoved reverse dependencies)

(Me too.)

> I can't reproduce any of these test failures:
> dpkg-buildpackage -us -uc -A in a sid/amd64 cowbuilder --login chroot
> (build-deps + ccache eatmydata lintian fakeroot) works for me.
> 
> This raises the obvious question of what is different:
> single vs multiple CPU core (this submitter has reported several other
> single-CPU-only FTBFSs [0])?  Network (allowed in cowbuilder, blocked on 
> buildds)?

I think the answer is that you were lucky. ;)
The problem can be reproduced by running:
$ python -m pytest -v -x -rs testing/test_gateway.py

I did that 100 times and it failed 78 times, working only 22 times.

The failing test contains:
        for i in range(10):
            status = gw.remote_status()
            if status.numexecuting == 0:
                break
        else:
            pytest.fail("did not get correct remote status")

Apparently there is a race condition, so it is tried 10 times.
However, it is tried in a tight loop, thus not much time passes
between the first and the last try. Making it sleep inside the
loop helps.

There is a similar construct in test_status_with_threads,
which fails in a similar way, but after changing both to wait
a bit (with attached patch), the test succeeded 100 times
for 100 tries.

That should be good enough to call this bug fixed.

Best regards,
Andreas
--- a/testing/test_gateway.py
+++ b/testing/test_gateway.py
@@ -2,6 +2,7 @@
 mostly functional tests of gateways.
 """
 import os
+import time
 import py
 import pytest
 import execnet
@@ -84,6 +85,7 @@ class TestBasicGateway:
             status = gw.remote_status()
             if status.numexecuting == 0:
                 break
+            time.sleep(0.1)
         else:
             pytest.fail("did not get correct remote status")
         # race condition
@@ -358,6 +360,7 @@ class TestThreads:
             rstatus = gw.remote_status()
             if rstatus.numexecuting == 0:
                 return
+            time.sleep(0.1)
         assert 0, "numexecuting didn't drop to zero"
 
 

Reply via email to