Commit 31a20089 authored by John Zhang's avatar John Zhang

use MU_IMPL environment variable to select Mu implementation to run on

parent 5a1596ad
...@@ -2,7 +2,7 @@ from rpython.rtyper.lltypesystem import rffi, lltype ...@@ -2,7 +2,7 @@ from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib.rmu import zebu as rmu from rpython.rlib.rmu import zebu as rmu
from rpython.translator.platform import platform from rpython.translator.platform import platform
from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc
import ctypes, py, stat import ctypes, py, stat, os
import pytest import pytest
# ------------------- # -------------------
...@@ -986,14 +986,14 @@ def test_exception_stack_unwind(): ...@@ -986,14 +986,14 @@ def test_exception_stack_unwind():
assert fnp(100) == 10 assert fnp(100) == 10
def run_boot_image(entry, output, has_c_main_sig = False, args = []): def run_boot_image(entry, output, has_c_main_sig = False, args = [], impl=os.getenv('MU_IMPL', 'zebu')):
from rpython.translator.interactive import Translation from rpython.translator.interactive import Translation
if has_c_main_sig: if has_c_main_sig:
t = Translation(entry, [rffi.INT, rffi.CCHARPP], backend='mu', impl='zebu', codegen='api') t = Translation(entry, [rffi.INT, rffi.CCHARPP], backend='mu', impl=impl, codegen='api')
t.driver.disable(['entrypoint_mu']) t.driver.disable(['entrypoint_mu'])
else: else:
t = Translation(entry, None, backend='mu', impl='zebu', codegen='api') t = Translation(entry, None, backend='mu', impl=impl, codegen='api')
t.driver.standalone = True # force standalone t.driver.standalone = True # force standalone
t.driver.exe_name = output t.driver.exe_name = output
...@@ -1001,10 +1001,17 @@ def run_boot_image(entry, output, has_c_main_sig = False, args = []): ...@@ -1001,10 +1001,17 @@ def run_boot_image(entry, output, has_c_main_sig = False, args = []):
db, mugen, epf_name = t.compile_mu() db, mugen, epf_name = t.compile_mu()
exe = py.path.local(output) exe = py.path.local(output)
if impl == 'zebu':
# zebu # zebu
exe.chmod(stat.S_IRWXU) exe.chmod(stat.S_IRWXU)
eci = rffi.ExternalCompilationInfo(library_dirs=[str(db.libsupport_path.dirpath())]) eci = rffi.ExternalCompilationInfo(library_dirs=[str(db.libsupport_path.dirpath())])
res = platform.execute(str(exe), args, compilation_info=eci) res = platform.execute(str(exe), args, compilation_info=eci)
else:
from rpython.rlib.rmu import holstein
runmu = py.path.local(holstein.mu_dir).join('..', 'tools', 'runmu.sh')
flags = ['--vmLog=ERROR']
# log_platform.execute(' '.join([str(runmu)] + flags + [str(exe)] + cmdargs))
res = platform.execute(runmu, flags + [str(exe)] + args)
return res return res
......
from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rlib import rmu_fast as rmu from rpython.rlib.rmu import zebu
from rpython.translator.platform import platform from rpython.translator.platform import platform
from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc from util import fncptr_from_rpy_func, fncptr_from_py_script, may_spawn_proc
import ctypes, py, stat import ctypes, py, stat
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment