[pypy-svn] r13178 - pypy/dist/pypy/translator/llvm
ericvrp at codespeak.net
ericvrp at codespeak.net
Wed Jun 8 12:33:27 CEST 2005
Author: ericvrp
Date: Wed Jun 8 12:33:26 2005
New Revision: 13178
Modified:
pypy/dist/pypy/translator/llvm/compyle.py
Log:
Simplyfied common-case commandline parameters.
Fixed: commandline parameters now used for annotator input and for testing the compilation result.
example usages:
./compyle.py test/llvmsnippet.py simple1
./compyle.py test/llvmsnippet.py "simple5(True)"
./compyle.py test/llvmsnippet.py "simple5(False)" -s -t
Modified: pypy/dist/pypy/translator/llvm/compyle.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/compyle.py (original)
+++ pypy/dist/pypy/translator/llvm/compyle.py Wed Jun 8 12:33:26 2005
@@ -1,6 +1,6 @@
#!/usr/bin/python
-"""PyPy compiler to be used as a wrapper around the various backend translators.
+"""PyPy compiler to be used as a wrapper around the various backend translators. As a sideeffect the entry function of the compiled code will be run.
options:
-h(elp)
@@ -71,11 +71,9 @@
def main(argv=[]):
options = Options(argv)
- modname = options.python_script
- if '/' in modname:
- modname = modname.replace('/', '.')
- if modname[-3:] == '.py':
- modname = modname[:-3]
+ modname = options.python_script.replace('/', '.')
+ if modname[-3:] == '.py':
+ modname = modname[:-3]
exec "import %(modname)s as testmodule" % locals()
if '(' in options.entry_function:
@@ -147,10 +145,14 @@
assert f
print 'Backend', options.backend, 'compilation successful!'
+ backendReturn = t.call(*arguments)
- if f and options.test_compiled:
- #assert f(arg) == t.call(arg) # sanity check #XXX make args a commandline argument!!!
- print 'Backend', options.backend, 'test successful! (not tested actually)'
+ if options.test_compiled:
+ pythonReturn = f(*arguments)
+ assert backendReturn == pythonReturn
+ print 'Backend', options.backend, 'compiled code returns same as python script (%s)' % backendReturn
+ else:
+ print 'Backend', options.backend, 'compiled code returns (%s)' % backendReturn, '[use -t to perform a sanity check]'
if __name__ == '__main__':
More information about the Pypy-commit
mailing list