summaryrefslogtreecommitdiffstats
path: root/test/option-j.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-10-22 03:15:44 (GMT)
committerSteven Knight <knight@baldmt.com>2003-10-22 03:15:44 (GMT)
commit69767c5516cfd51afc93b87746f130825f0bf831 (patch)
tree0177b25e280c6371d87d57211d667c9952a7440d /test/option-j.py
parent4618fabde17038bd961f93ceb9af6b31e778540b (diff)
downloadSCons-69767c5516cfd51afc93b87746f130825f0bf831.zip
SCons-69767c5516cfd51afc93b87746f130825f0bf831.tar.gz
SCons-69767c5516cfd51afc93b87746f130825f0bf831.tar.bz2
Really handle lack of the threading.py module when run by non-threaded Pythons.
Diffstat (limited to 'test/option-j.py')
-rw-r--r--test/option-j.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/test/option-j.py b/test/option-j.py
index cb1a88a..fdf7b83 100644
--- a/test/option-j.py
+++ b/test/option-j.py
@@ -121,7 +121,41 @@ test.fail_test(start2 < finish1)
test.run(arguments='-j 2 out')
-# Test that a failed build with -j works properly.
+# Test that we fall back and warn properly if there's no threading.py
+# module (simulated), which is the case if this version of Python wasn't
+# built with threading support.
+
+test.subdir('pythonlib')
+
+test.write(['pythonlib', 'threading.py'], """\
+raise ImportError
+""")
+
+save_pythonpath = os.environ.get('PYTHONPATH', '')
+os.environ['PYTHONPATH'] = test.workpath('pythonlib')
+
+#start2, finish1 = RunTest('-j 2 f1, f2', "fifth")
+
+test.write('f1.in', 'f1.in pythonlib\n')
+test.write('f2.in', 'f2.in pythonlib\n')
+
+test.run(arguments = "-j 2 f1 f2", stderr=None)
+
+warn = \
+"""scons: warning: parallel builds are unsupported by this version of Python;
+\tignoring -j or num_jobs option.
+"""
+test.fail_test(string.find(test.stderr(), warn) == -1)
+
+str = test.read("f1")
+start1,finish1 = map(float, string.split(str, "\n"))
+
+str = test.read("f2")
+start2,finish2 = map(float, string.split(str, "\n"))
+
+test.fail_test(start2 < finish1)
+
+os.environ['PYTHONPATH'] = save_pythonpath
# Test SetJobs() with no -j: