[pypy-svn] r50926 - pypy/branch/asmgcroot/pypy/translator/c/gcc/test

arigo at codespeak.net arigo at codespeak.net
Wed Jan 23 16:23:17 CET 2008


Author: arigo
Date: Wed Jan 23 16:23:16 2008
New Revision: 50926

Modified:
   pypy/branch/asmgcroot/pypy/translator/c/gcc/test/test_asmgcroot.py
Log:
Fix test.


Modified: pypy/branch/asmgcroot/pypy/translator/c/gcc/test/test_asmgcroot.py
==============================================================================
--- pypy/branch/asmgcroot/pypy/translator/c/gcc/test/test_asmgcroot.py	(original)
+++ pypy/branch/asmgcroot/pypy/translator/c/gcc/test/test_asmgcroot.py	Wed Jan 23 16:23:16 2008
@@ -14,8 +14,12 @@
 
     def getcompiled(self, func):
         def main(argv):
-            res = func()
-            print 'Result:', res
+            try:
+                res = func()
+            except MemoryError:
+                print 'Result: MemoryError'
+            else:
+                print 'Result:', res
             return 0
         from pypy.config.pypyoption import get_pypy_config
         config = get_pypy_config(translating=True)
@@ -37,17 +41,21 @@
 
         def run():
             lines = []
-            print 'RUN: starting', exe_name
+            print >> sys.stderr, 'RUN: starting', exe_name
             g = os.popen("'%s'" % (exe_name,), 'r')
             for line in g:
-                print 'RUN:', line.rstrip()
+                print >> sys.stderr, 'RUN:', line.rstrip()
                 lines.append(line)
             g.close()
             if not lines:
                 py.test.fail("no output from subprocess")
             if not lines[-1].startswith('Result:'):
                 py.test.fail("unexpected output from subprocess")
-            return int(lines[-1][len('Result:'):].strip())
+            result = lines[-1][len('Result:'):].strip()
+            if result == 'MemoryError':
+                raise MemoryError("subprocess got an RPython MemoryError")
+            else:
+                return int(result)
         return run
 
 



More information about the Pypy-commit mailing list