summaryrefslogtreecommitdiffstats
path: root/test/KeyboardInterrupt.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-05-18 05:12:35 (GMT)
committerSteven Knight <knight@baldmt.com>2008-05-18 05:12:35 (GMT)
commit61173c84a9f0535b47b21b9c2623dc5f853d9ca0 (patch)
tree97e2df9b08fd971d661d41e0ce1bc169c4d7efa7 /test/KeyboardInterrupt.py
parent64daa285c6d9089cd74a988d5512f2007bf7254f (diff)
downloadSCons-61173c84a9f0535b47b21b9c2623dc5f853d9ca0.zip
SCons-61173c84a9f0535b47b21b9c2623dc5f853d9ca0.tar.gz
SCons-61173c84a9f0535b47b21b9c2623dc5f853d9ca0.tar.bz2
Merged revisions 2928-2932,2934-2946 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r2932 | garyo | 2008-04-30 09:14:38 -0700 (Wed, 30 Apr 2008) | 1 line Add doc for site_scons dir and related options. Closes issue #1996. ........ r2934 | stevenknight | 2008-04-30 22:05:38 -0700 (Wed, 30 Apr 2008) | 3 lines Issue 2039: Fix a syntax error in Intel C compiler support on Windows. (Jonas Olsson) ........ r2935 | belley | 2008-05-01 06:59:21 -0700 (Thu, 01 May 2008) | 10 lines test/KeyboardInterrupt.py no longer hangs under Cygwin. There seems to be a bug on Cygwin where the compiler process hangs after sending the SIGINT signal to the process group. It is probably a bug in cygwin1.dll, or maybe in the Python 'C' code or the Python subprocess module. We therefore do not use 'killpg' on Cygwin. Benoit ........ r2936 | belley | 2008-05-01 07:10:23 -0700 (Thu, 01 May 2008) | 12 lines cell_contents not defined in python < 2.5. [Issue 2035] Some versions of Python supports lexical scoping of local variables (aka closures) but not the cell_contents attribute that would allow the FunctionAction signature that take the content of these closure cells into account. The access to the cell_contents attribute is now protected with a try/except AttributeError so that at least the other parts of the function signature are properly computed. Benoit ........ r2937 | stevenknight | 2008-05-01 12:08:25 -0700 (Thu, 01 May 2008) | 3 lines When running tests, allow the user to set the $SCONSIGN variable to pick a specific sconsign script to execute. ........ r2938 | stevenknight | 2008-05-02 19:13:14 -0700 (Fri, 02 May 2008) | 2 lines Set svn:ignore to '*.py[co]'. ........ r2939 | stevenknight | 2008-05-08 21:07:18 -0700 (Thu, 08 May 2008) | 4 lines Issue 2033: Fix excessive memory use when a Python Value node's representation is stored in a .sconsign file and then re-stored after being interpreted with escaped backslashes and quotes. ........ r2940 | cournape | 2008-05-16 03:56:49 -0700 (Fri, 16 May 2008) | 1 line Fix issue 2054. ........ r2941 | stevenknight | 2008-05-16 12:02:45 -0700 (Fri, 16 May 2008) | 8 lines Issue 2045: After a Node has failed its build and we're propagating the failure to other Nodes on the candidate list, don't marke candidate Nodes as FAILED if they've already been visited and been determined to be up-to-date. This avoids problems with Configure tests not running because failure of an earlier Configure tests caused (e.g.) /usr/bin/g++ to get marked as FAILED, making SCons think it doesn't need to bother trying to rebuild anything that will use it... ........ r2942 | stevenknight | 2008-05-16 12:10:14 -0700 (Fri, 16 May 2008) | 8 lines Improve the regular expressions used by the test infrastructure to examine SCons output to decide if a list of targets are considered up-to-date or not. The new code uses the re.escape() function instead of hand-escaping '.' and '\n'. This required a little restructuring in the not_up_to_date() method to escape the characters within the arguments themselves, but not the surrounding characters we use to construct the regex that makes sure those strings *don't* exist in the output. ........ r2943 | stevenknight | 2008-05-16 14:04:23 -0700 (Fri, 16 May 2008) | 3 lines Issue 2049: Handle multiple pipe-separated values in Visual Studio for INCLUDE, LIB and PATH. Still only uses Win32, not any other values. ........ r2944 | stevenknight | 2008-05-16 18:36:27 -0700 (Fri, 16 May 2008) | 2 lines Record changes by David Cournapeau and Benoit Belley. ........ r2945 | stevenknight | 2008-05-17 07:13:46 -0700 (Sat, 17 May 2008) | 3 lines Pass in dc as a keyword argument to _smartLink for older Python versions without nested scopes. ........ r2946 | stevenknight | 2008-05-17 07:14:01 -0700 (Sat, 17 May 2008) | 3 lines Expect a warning about shadowing global variables on Python 2.1. (This code can go away after we release 1.0.) ........
Diffstat (limited to 'test/KeyboardInterrupt.py')
-rw-r--r--test/KeyboardInterrupt.py46
1 files changed, 34 insertions, 12 deletions
diff --git a/test/KeyboardInterrupt.py b/test/KeyboardInterrupt.py
index 25239b5..5a06119 100644
--- a/test/KeyboardInterrupt.py
+++ b/test/KeyboardInterrupt.py
@@ -28,15 +28,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify that we handle keyboard interrupts (CTRL-C) correctly.
"""
-import os
-
import TestSCons
test = TestSCons.TestSCons()
-if 'killpg' not in dir(os) or 'setpgrp' not in dir(os):
- test.skip_test("This Python version does not support killing process groups; skipping test.\n")
-
test.write('toto.c', r"""
void foo()
{}
@@ -44,20 +39,47 @@ void foo()
test.write('SConstruct', r"""
import os
+import sys
import signal
-# Make sure that SCons is a process group leader.
-os.setpgrp()
+if 'killpg' not in dir(os) or 'setpgrp' not in dir(os) or sys.platform == 'cygwin':
+ # The platform does not support process group. Therefore, we
+ # directly invoked the SIGINT handler to simulate a
+ # KeyboardInterrupt. This hack is necessary because there is no
+ # easy way to get access to the current Job/Taskmaster object.
+ #
+ # Note that this way of performing the test is not as good as
+ # using killpg because the Taskmaster is stopped synchronously. In
+ # addition, the SCons subprocesses (or forked children before the
+ # exec() of the subprocess) are never killed. This therefore
+ # exercise less SCons functionality.
+ #
+ # FIXME: There seems to be a bug on Cygwin where the compiler
+ # process hangs after sending the SIGINT signal to the process
+ # group. It is probably a bug in cygwin1.dll, or maybe in the
+ # Python 'C' code or the Python subprocess module. We therefore do
+ # not use 'killpg' on Cygwin.
+ def explode(env, target, source):
+ handler = signal.getsignal(signal.SIGINT)
+ handler(signal.SIGINT, None)
+ return 0
+else:
+ # The platform does support process group so we use killpg to send
+ # a SIGINT to everyone.
+
+ # Make sure that SCons is a process group leader.
+ os.setpgrp()
+
+ def explode(env, target, source):
+ os.killpg(0, signal.SIGINT)
-all = []
-def explode(env, target, source):
- os.killpg(0, signal.SIGINT)
+all = []
for i in xrange(40):
- all += Object('toto%5d' % i, 'toto.c')
+ all.extend(Object('toto%5d' % i, 'toto.c'))
-all+= Command( 'broken', 'toto.c', explode)
+all.extend(Command( 'broken', 'toto.c', explode))
Default( Alias('all', all))
"""