Revision: 7581
Author:   ri...@chromium.org
Date:     Mon Apr 11 23:26:38 2011
Log:      Fix tools/test.py to allow CTRL+C to work correctly again.

This also changes the AfterRun functions to allow None as the passed in parameter.
Review URL: http://codereview.chromium.org/6824040
http://code.google.com/p/v8/source/detail?r=7581

Modified:
 /branches/bleeding_edge/test/mjsunit/testcfg.py
 /branches/bleeding_edge/test/sputnik/testcfg.py
 /branches/bleeding_edge/tools/test.py

=======================================
--- /branches/bleeding_edge/test/mjsunit/testcfg.py     Mon Mar 21 05:57:25 2011
+++ /branches/bleeding_edge/test/mjsunit/testcfg.py     Mon Apr 11 23:26:38 2011
@@ -107,7 +107,7 @@
     return self_script

   def AfterRun(self, result):
-    if self.self_script and (not result.HasPreciousOutput()):
+ if self.self_script and (result is None or (not result.HasPreciousOutput())):
       test.CheckedUnlink(self.self_script)

 class MjsunitTestConfiguration(test.TestConfiguration):
=======================================
--- /branches/bleeding_edge/test/sputnik/testcfg.py     Mon Mar 21 05:57:25 2011
+++ /branches/bleeding_edge/test/sputnik/testcfg.py     Mon Apr 11 23:26:38 2011
@@ -57,7 +57,7 @@

   def AfterRun(self, result):
     # Dispose the temporary file if everything looks okay.
-    if not result.HasPreciousOutput(): self.tmpfile.Dispose()
+ if result is None or not result.HasPreciousOutput(): self.tmpfile.Dispose()
     self.tmpfile = None

   def GetCommand(self):
=======================================
--- /branches/bleeding_edge/tools/test.py       Fri Apr  1 12:46:21 2011
+++ /branches/bleeding_edge/tools/test.py       Mon Apr 11 23:26:38 2011
@@ -117,6 +117,8 @@
         start = time.time()
         output = case.Run()
         case.duration = (time.time() - start)
+      except BreakNowException:
+        self.terminate = True
       except IOError, e:
         assert self.terminate
         return
@@ -318,6 +320,12 @@
 # --- F r a m e w o r k ---
 # -------------------------

+class BreakNowException(Exception):
+  def __init__(self, value):
+    self.value = value
+  def __str__(self):
+    return repr(self.value)
+

 class CommandOutput(object):

@@ -379,9 +387,12 @@

   def Run(self):
     self.BeforeRun()
-    result = "exception"
+    result = None;
     try:
       result = self.RunCommand(self.GetCommand())
+    except:
+      self.terminate = True;
+      raise BreakNowException("Used pressed CTRL+C or IO went wrong")
     finally:
       self.AfterRun(result)
     return result
@@ -702,7 +713,12 @@

 def RunTestCases(cases_to_run, progress, tasks):
   progress = PROGRESS_INDICATORS[progress](cases_to_run)
-  return progress.Run(tasks)
+  result = 0;
+  try:
+    result = progress.Run(tasks)
+  except Exception, e:
+    print "\n", e
+  return result


 def BuildRequirements(context, requirements, mode, scons_flags):

--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to