[pypy-svn] r33949 - in pypy/dist/pypy/translator/jvm: . test

niko at codespeak.net niko at codespeak.net
Tue Oct 31 14:16:13 CET 2006


Author: niko
Date: Tue Oct 31 14:16:07 2006
New Revision: 33949

Modified:
   pypy/dist/pypy/translator/jvm/conftest.py
   pypy/dist/pypy/translator/jvm/genjvm.py
   pypy/dist/pypy/translator/jvm/test/runtest.py
Log:
add code to skip tests if required executables are not found



Modified: pypy/dist/pypy/translator/jvm/conftest.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/conftest.py	(original)
+++ pypy/dist/pypy/translator/jvm/conftest.py	Tue Oct 31 14:16:07 2006
@@ -7,6 +7,8 @@
 
     Option('--java', action='store', dest='java', default='java',
            help='Define the java executable to use'),
+    Option('--javac', action='store', dest='javac', default='javac',
+           help='Define the javac executable to use'),
     Option('--jasmin', action='store', dest='java', default='java',
            help='Define the jasmin script to use'),
     Option('--noassemble', action='store_true', dest="noasm", default=False,

Modified: pypy/dist/pypy/translator/jvm/genjvm.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/genjvm.py	(original)
+++ pypy/dist/pypy/translator/jvm/genjvm.py	Tue Oct 31 14:16:07 2006
@@ -105,7 +105,11 @@
         # use rte.py
         sl = __file__.rindex('/')
         javasrc = __file__[:sl]+"/src/PyPy.java"
-        self._invoke(['javac', '-nowarn', '-d', str(self.javadir), javasrc], True)
+        self._invoke([getoption('javac'),
+                      '-nowarn',
+                      '-d', str(self.javadir),
+                      javasrc],
+                     True)
                            
         self.compiled = True
 
@@ -144,6 +148,16 @@
     jvm = GenJvm(tmpdir, t, EntryPoint(main_graph, True, True))
     return jvm.generate_source()
 
+def detect_missing_support_programs():
+    def check(exechelper):
+        try:
+            py.path.local.sysfind(exechelper)
+        except py.error.ENOENT:
+            py.test.skip("%s is not on your path" % exechelper)
+    check(getoption('jasmin'))
+    check(getoption('javac'))
+    check(getoption('java'))
+
 class GenJvm(GenOO):
 
     """ Master object which guides the JVM backend along.  To use,

Modified: pypy/dist/pypy/translator/jvm/test/runtest.py
==============================================================================
--- pypy/dist/pypy/translator/jvm/test/runtest.py	(original)
+++ pypy/dist/pypy/translator/jvm/test/runtest.py	Tue Oct 31 14:16:07 2006
@@ -9,7 +9,8 @@
 from pypy.rpython.ootypesystem import ootype
 from pypy.annotation.model import lltype_to_annotation
 from pypy.translator.translator import TranslationContext
-from pypy.translator.jvm.genjvm import generate_source_for_function, JvmError
+from pypy.translator.jvm.genjvm import \
+     generate_source_for_function, JvmError, detect_missing_support_programs
 from pypy.translator.jvm.option import getoption
 
 FLOAT_PRECISION = 8
@@ -85,6 +86,7 @@
             py.test.skip('Windows --> %s' % reason)
 
     def interpret(self, fn, args, annotation=None):
+        detect_missing_support_programs()
         try:
             src = self._compile(fn, args, annotation)
             res = src(*args)



More information about the Pypy-commit mailing list