Re: [Python-Dev] [python-committers] (Windows) buildbots on 3.x
On Wed, 04 Aug 2010 19:53:55 +0200, =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= wrote: > >>> It happens when running test_smtplib before test_smtpb: > >> > >> Nice! How did you work that out? I'd like to learn how to diagnose > >> this sort of thing, because it seems to come up a lot, and I'm not > >> much use at the moment :-) > > > > I simply tried to run test_smtplib before test_smtpd. > > A more deterministic (and more tedious) way is this: if you > suspect that some failure might be due to the order of test cases, > take a build log from the build bot where it fails, and run the tests > in the exact same order. See whether the problem reproduces. > > If it does, drop tests from the test sequence until you end up with > the minimum number of tests that you need to run in sequence (and yes, > I had interworkings of three test modules at some point). > > Of course, educated guessing can accelerate the process. Two bits of info to help you implement this process: The buildbots have regrtest print out the random seed used for the test run. The --randseed option of regtest can be used to repeat this run. That's the first step, which proves that the specific order produced the test failure. Then you cut and paste the test list into a file, and use the regrtest -f option to run the tests from that file, and do your binary search by breaking up the list into pieces. Hmm. If we added a 'binsearch' option to regrtest, you could just pass it the random seed and that option and off it would go... -- R. David Murray www.bitdance.com ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c
Hi,
On 06/08/2010 22.27, brian.curtin wrote:
Author: brian.curtin
Date: Fri Aug 6 21:27:32 2010
New Revision: 83763
Log:
Fix #9324: Add parameter validation to signal.signal on Windows in order
to prevent crashes.
Modified:
python/branches/py3k/Doc/library/signal.rst
python/branches/py3k/Lib/test/test_signal.py
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/signalmodule.c
Modified: python/branches/py3k/Doc/library/signal.rst
==
--- python/branches/py3k/Doc/library/signal.rst (original)
+++ python/branches/py3k/Doc/library/signal.rst Fri Aug 6 21:27:32 2010
@@ -230,6 +230,10 @@
see the :ref:`description in the type hierarchy` or see the
attribute descriptions in the :mod:`inspect` module).
+ On Windows, :func:`signal` can only be called with :const:`SIGABRT`,
+ :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, or
+ :const:`SIGTERM`. A :exc:`ValueError` will be raised in any other case.
+
.. _signal-example:
Modified: python/branches/py3k/Lib/test/test_signal.py
==
--- python/branches/py3k/Lib/test/test_signal.py(original)
+++ python/branches/py3k/Lib/test/test_signal.pyFri Aug 6 21:27:32 2010
@@ -9,7 +9,7 @@
import traceback
import sys, os, time, errno
-if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos':
+if sys.platform == 'os2' or sys.platform == 'riscos':
raise unittest.SkipTest("Can't test signal on %s" % \
sys.platform)
@@ -37,6 +37,7 @@
return None
[email protected](sys.platform == "win32", "Not valid on Windows")
In the previous chunk sys.platform[:3] was used instead of just
sys.platform. Are there some other "winXX" platform that should be
skipped too?
class InterProcessSignalTests(unittest.TestCase):
MAX_DURATION = 20 # Entire test should last at most 20 sec.
@@ -186,6 +187,7 @@
self.MAX_DURATION)
[email protected](sys.platform == "win32", "Not valid on Windows")
class BasicSignalTests(unittest.TestCase):
def trivial_signal_handler(self, *args):
pass
@@ -208,6 +210,23 @@
self.assertEquals(signal.getsignal(signal.SIGHUP), hup)
[email protected](sys.platform == "win32", "Windows specific")
+class WindowsSignalTests(unittest.TestCase):
+def test_issue9324(self):
+handler = lambda x, y: None
+signal.signal(signal.SIGABRT, handler)
+signal.signal(signal.SIGFPE, handler)
+signal.signal(signal.SIGILL, handler)
+signal.signal(signal.SIGINT, handler)
+signal.signal(signal.SIGSEGV, handler)
+signal.signal(signal.SIGTERM, handler)
+
+with self.assertRaises(ValueError):
+signal.signal(-1, handler)
+sinal.signal(7, handler)
You should use two separate assertRaises here, otherwise the second line
is not executed if the first one raises an error (and if the first
doesn't raise an error but the second does the test will pass even if it
shouldn't). This also masks the typo in the second line.
+
+
[email protected](sys.platform == "win32", "Not valid on Windows")
class WakeupSignalTests(unittest.TestCase):
TIMEOUT_FULL = 10
TIMEOUT_HALF = 5
@@ -253,14 +272,15 @@
os.close(self.write)
signal.signal(signal.SIGALRM, self.alrm)
[email protected](sys.platform == "win32", "Not valid on Windows")
class SiginterruptTest(unittest.TestCase):
-signum = signal.SIGUSR1
def setUp(self):
"""Install a no-op signal handler that can be set to allow
interrupts or not, and arrange for the original signal handler to be
re-installed when the test is finished.
"""
+self.signum = signal.SIGUSR1
oldhandler = signal.signal(self.signum, lambda x,y: None)
self.addCleanup(signal.signal, self.signum, oldhandler)
@@ -354,7 +374,7 @@
self.assertFalse(i)
-
[email protected](sys.platform == "win32", "Not valid on Windows")
class ItimerTest(unittest.TestCase):
def setUp(self):
self.hndl_called = False
@@ -463,8 +483,11 @@
self.assertEqual(self.hndl_called, True)
def test_main():
-support.run_unittest(BasicSignalTests, InterProcessSignalTests,
-WakeupSignalTests, SiginterruptTest, ItimerTest)
+if sys.platform == "win32":
+support.run_unittest(WindowsSignalTests)
+else:
+support.run_unittest(BasicSignalTests, InterProcessSignalTests,
+WakeupSignalTests, SiginterruptTest, ItimerTest)
Is this necessary?
If the tests are marked with a skip decorator they will be skipped
anyway (and also marked as skipped in the output).
if __name__ == "__main__":
Modified: python/branches/py3k/Misc/NEWS
===
Re: [Python-Dev] [Python-checkins] r83763 - in python/branches/py3k: Doc/library/signal.rst Lib/test/test_signal.py Misc/NEWS Modules/signalmodule.c
On Fri, Aug 6, 2010 at 21:59, Ezio Melotti wrote:
> Hi,
>
> On 06/08/2010 22.27, brian.curtin wrote:
>
>> Author: brian.curtin
>> Date: Fri Aug 6 21:27:32 2010
>> New Revision: 83763
>>
>> Log:
>> Fix #9324: Add parameter validation to signal.signal on Windows in order
>> to prevent crashes.
>>
>>
>> Modified:
>>python/branches/py3k/Doc/library/signal.rst
>>python/branches/py3k/Lib/test/test_signal.py
>>python/branches/py3k/Misc/NEWS
>>python/branches/py3k/Modules/signalmodule.c
>>
>> Modified: python/branches/py3k/Doc/library/signal.rst
>>
>> ==
>> --- python/branches/py3k/Doc/library/signal.rst (original)
>> +++ python/branches/py3k/Doc/library/signal.rst Fri Aug 6 21:27:32 2010
>> @@ -230,6 +230,10 @@
>> see the :ref:`description in the type hierarchy` or see
>> the
>> attribute descriptions in the :mod:`inspect` module).
>>
>> + On Windows, :func:`signal` can only be called with :const:`SIGABRT`,
>> + :const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`,
>> or
>> + :const:`SIGTERM`. A :exc:`ValueError` will be raised in any other
>> case.
>> +
>>
>> .. _signal-example:
>>
>>
>> Modified: python/branches/py3k/Lib/test/test_signal.py
>>
>> ==
>> --- python/branches/py3k/Lib/test/test_signal.py(original)
>> +++ python/branches/py3k/Lib/test/test_signal.pyFri Aug 6
>> 21:27:32 2010
>> @@ -9,7 +9,7 @@
>> import traceback
>> import sys, os, time, errno
>>
>> -if sys.platform[:3] in ('win', 'os2') or sys.platform == 'riscos':
>> +if sys.platform == 'os2' or sys.platform == 'riscos':
>> raise unittest.SkipTest("Can't test signal on %s" % \
>> sys.platform)
>>
>> @@ -37,6 +37,7 @@
>> return None
>>
>>
>> [email protected](sys.platform == "win32", "Not valid on Windows")
>>
>
> In the previous chunk sys.platform[:3] was used instead of just
> sys.platform. Are there some other "winXX" platform that should be skipped
> too?
>
The sliced check was to make it more convenient to also check "os2" at the
same time in the first hunk of the change. Windows is "win32" regardless of
32 or 64-bit so that check works.
class InterProcessSignalTests(unittest.TestCase):
>> MAX_DURATION = 20 # Entire test should last at most 20 sec.
>>
>> @@ -186,6 +187,7 @@
>>self.MAX_DURATION)
>>
>>
>> [email protected](sys.platform == "win32", "Not valid on Windows")
>> class BasicSignalTests(unittest.TestCase):
>> def trivial_signal_handler(self, *args):
>> pass
>> @@ -208,6 +210,23 @@
>> self.assertEquals(signal.getsignal(signal.SIGHUP), hup)
>>
>>
>> [email protected](sys.platform == "win32", "Windows specific")
>> +class WindowsSignalTests(unittest.TestCase):
>> +def test_issue9324(self):
>> +handler = lambda x, y: None
>> +signal.signal(signal.SIGABRT, handler)
>> +signal.signal(signal.SIGFPE, handler)
>> +signal.signal(signal.SIGILL, handler)
>> +signal.signal(signal.SIGINT, handler)
>> +signal.signal(signal.SIGSEGV, handler)
>> +signal.signal(signal.SIGTERM, handler)
>> +
>> +with self.assertRaises(ValueError):
>> +signal.signal(-1, handler)
>> +sinal.signal(7, handler)
>>
>
> You should use two separate assertRaises here, otherwise the second line is
> not executed if the first one raises an error (and if the first doesn't
> raise an error but the second does the test will pass even if it shouldn't).
> This also masks the typo in the second line.
>
Thanks for noticing this. Corrected in r83771 (py3k), r83772
(release31-maint), and r83773 (release27-maint).
+
>> +
>> [email protected](sys.platform == "win32", "Not valid on Windows")
>> class WakeupSignalTests(unittest.TestCase):
>> TIMEOUT_FULL = 10
>> TIMEOUT_HALF = 5
>> @@ -253,14 +272,15 @@
>> os.close(self.write)
>> signal.signal(signal.SIGALRM, self.alrm)
>>
>> [email protected](sys.platform == "win32", "Not valid on Windows")
>> class SiginterruptTest(unittest.TestCase):
>> -signum = signal.SIGUSR1
>>
>> def setUp(self):
>> """Install a no-op signal handler that can be set to allow
>> interrupts or not, and arrange for the original signal handler to
>> be
>> re-installed when the test is finished.
>> """
>> +self.signum = signal.SIGUSR1
>> oldhandler = signal.signal(self.signum, lambda x,y: None)
>> self.addCleanup(signal.signal, self.signum, oldhandler)
>>
>> @@ -354,7 +374,7 @@
>> self.assertFalse(i)
>>
>>
>> -
>> [email protected](sys.platform == "win32", "Not valid on Windows")
>> class ItimerTest(unittest.TestCase):
>> def setUp(self):
>> self.hndl_called = False
>> @@ -463,8 +483,11 @@
>> self.asse
