fix test that hangs occasionally to fail instead if a short time elapses without...
authorGregNoel <GregNoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 18 Apr 2009 20:02:08 +0000 (20:02 +0000)
committerGregNoel <GregNoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 18 Apr 2009 20:02:08 +0000 (20:02 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@4110 fdb21ef1-2011-0410-befe-b5e4ea1792b1

test/Parallel/failed-build.py

index e6a05899b7b8e209af6d81195456592a3cf9d732..b46762ccfd5b9f8d74303da327ce94c56e8c3898 100644 (file)
@@ -30,7 +30,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 import TestSCons
 
-_python_ = TestSCons._python_
+python = TestSCons.python
 
 try:
     import threading
@@ -65,10 +65,12 @@ test.write('myfail.py', r"""\
 import os
 import sys
 import time
-while not os.path.exists('mycopy.started'):
-    time.sleep(1)
-os.mkdir('myfail.exiting')
-sys.exit(1)
+for i in [1, 2, 3, 4, 5]:
+    time.sleep(2)
+    if os.path.exists('mycopy.started'):
+        os.mkdir('myfail.exiting')
+        sys.exit(1)
+sys.exit(99)
 """)
 
 test.write('mycopy.py', r"""\
@@ -77,14 +79,16 @@ import sys
 import time
 os.mkdir('mycopy.started')
 open(sys.argv[1], 'wb').write(open(sys.argv[2], 'rb').read())
-while not os.path.exists('myfail.exiting'):
-    time.sleep(1)
-sys.exit(0)
+for i in [1, 2, 3, 4, 5]:
+    time.sleep(2)
+    if os.path.exists('myfail.exiting'):
+        sys.exit(0)
+sys.exit(99)
 """)
 
 test.write('SConstruct', """
-MyCopy = Builder(action = r'%(_python_)s mycopy.py $TARGET $SOURCE')
-Fail = Builder(action = r'%(_python_)s myfail.py $TARGETS $SOURCE')
+MyCopy = Builder(action = [[r'%(python)s', 'mycopy.py', '$TARGET', '$SOURCE']])
+Fail = Builder(action = [[r'%(python)s', 'myfail.py', '$TARGETS', '$SOURCE']])
 env = Environment(BUILDERS = { 'MyCopy' : MyCopy, 'Fail' : Fail })
 env.Fail(target = 'f3', source = 'f3.in')
 env.MyCopy(target = 'f4', source = 'f4.in')