Author: Manuel Jacob
Branch: refactor-translator
Changeset: r61855:7cf9819b7fc5
Date: 2013-02-26 14:21 +0100
http://bitbucket.org/pypy/pypy/changeset/7cf9819b7fc5/
Log: Unskip test_disable_logic(). Fix.
diff --git a/rpython/translator/c/test/test_genc.py
b/rpython/translator/c/test/test_genc.py
--- a/rpython/translator/c/test/test_genc.py
+++ b/rpython/translator/c/test/test_genc.py
@@ -97,10 +97,11 @@
print "THE RESULT IS:", llrepr_out(res), ";"
return 0
+ kwds = {}
+ if not backendopt:
+ kwds['backendopt.none'] = True
t = Translation(entry_point, None, gc=gcpolicy, backend="c",
- policy=annotatorpolicy, thread=thread)
- if not backendopt:
- t.disable(["backendopt_lltype"])
+ policy=annotatorpolicy, thread=thread, **kwds)
t.driver.config.translation.countmallocs = True
t.annotate()
if py.test.config.option.view:
diff --git a/rpython/translator/driver.py b/rpython/translator/driver.py
--- a/rpython/translator/driver.py
+++ b/rpython/translator/driver.py
@@ -192,25 +192,6 @@
self.done = {}
- self.tasks = tasks = []
- # expose tasks
- def expose_task(task):
- def proc():
- return self.proceed(task)
- tasks.append(task)
- setattr(self, task.task_name, proc)
-
- expose_task(self.task_annotate)
- expose_task(self.task_rtype)
- if config.translation.jit:
- expose_task(self.task_pyjitpl)
- if not config.translation.backendopt.none:
- expose_task(self.task_backendopt)
- if config.translation.type_system == 'lltype':
- expose_task(self.task_stackcheckinsertion_lltype)
- for task in backends[config.translation.backend](self).get_tasks():
- expose_task(task)
-
def set_backend_extra_options(self, extra_options):
self._backend_extra_options = extra_options
@@ -254,6 +235,25 @@
self.translator.driver_instrument_result = self.instrument_result
+ self.tasks = tasks = []
+ # expose tasks
+ def expose_task(task):
+ def proc():
+ return self.proceed(task)
+ tasks.append(task)
+ setattr(self, task.task_name, proc)
+
+ expose_task(self.task_annotate)
+ expose_task(self.task_rtype)
+ if self.config.translation.jit:
+ expose_task(self.task_pyjitpl)
+ if not self.config.translation.backendopt.none:
+ expose_task(self.task_backendopt)
+ if self.config.translation.type_system == 'lltype':
+ expose_task(self.task_stackcheckinsertion_lltype)
+ for task in
backends[self.config.translation.backend](self).get_tasks():
+ expose_task(task)
+
def instrument_result(self, args):
backend = self.config.translation.backend
if backend != 'c' or sys.platform == 'win32':
diff --git a/rpython/translator/test/test_driver.py
b/rpython/translator/test/test_driver.py
--- a/rpython/translator/test/test_driver.py
+++ b/rpython/translator/test/test_driver.py
@@ -4,6 +4,7 @@
def test_c_no_jit():
td = TranslationDriver()
+ td.setup(None, None)
names = ['annotate', 'rtype', 'backendopt', 'stackcheckinsertion_lltype',
'database', 'source', 'compile']
assert [task.task_name for task in td.tasks] == names
@@ -11,6 +12,7 @@
def test_c_with_jit():
td = TranslationDriver({'jit': True})
+ td.setup(None, None)
names = ['annotate', 'rtype', 'pyjitpl', 'backendopt',
'stackcheckinsertion_lltype', 'database', 'source', 'compile']
assert [task.task_name for task in td.tasks] == names
@@ -18,6 +20,7 @@
def test_no_backendopt():
td = TranslationDriver({'backendopt.none': True})
+ td.setup(None, None)
names = ['annotate', 'rtype', 'stackcheckinsertion_lltype', 'database',
'source', 'compile']
assert [task.task_name for task in td.tasks] == names
@@ -74,13 +77,10 @@
assert 'source' in t.driver.done
def test_disable_logic():
- return # temporary skip
-
def f(x,y):
return x+y
- t = Translation(f, [int, int])
- t.disable(['backendopt'])
+ t = Translation(f, [int, int], **{'backendopt.none': True})
t.source()
assert 'backendopt' not in t.driver.done
@@ -111,6 +111,6 @@
t.rtype()
assert 'rtype' in t.driver.done
- t = Translation(f, [int, int], backend='cli', type_system='ootype')
- t.rtype()
- assert 'rtype' in t.driver.done
+ #t = Translation(f, [int, int], backend='cli', type_system='ootype')
+ #t.rtype()
+ #assert 'rtype' in t.driver.done
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit