Skip to content
Snippets Groups Projects
Commit d0974589 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

Merge pull request #242 in G/fastr from...

Merge pull request #242 in G/fastr from ~MICK.JORDAN_ORACLE.COM/fastr:feature/graalvm-pkgtest to master

* commit '21d6d687':
  pkgtest: changes to run in binary graalvm distribution
parents cec25230 21d6d687
Branches
No related tags found
No related merge requests found
...@@ -486,23 +486,6 @@ def rcmplib(args): ...@@ -486,23 +486,6 @@ def rcmplib(args):
cp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites()]) cp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites()])
mx.run_java(['-cp', cp, 'com.oracle.truffle.r.test.tools.cmpr.CompareLibR'] + cmpArgs) mx.run_java(['-cp', cp, 'com.oracle.truffle.r.test.tools.cmpr.CompareLibR'] + cmpArgs)
def _cran_test_project():
return 'com.oracle.truffle.r.test.cran'
def _cran_test_project_dir():
return mx.project(_cran_test_project()).dir
def installpkgs(args):
_installpkgs(args)
def _installpkgs_script():
cran_test = _cran_test_project_dir()
return join(cran_test, 'r', 'install.cran.packages.R')
def _installpkgs(args, **kwargs):
script = _installpkgs_script()
return rscript([script] + args, **kwargs)
_commands = { _commands = {
'r' : [rshell, '[options]'], 'r' : [rshell, '[options]'],
'R' : [rshell, '[options]'], 'R' : [rshell, '[options]'],
...@@ -520,12 +503,11 @@ _commands = { ...@@ -520,12 +503,11 @@ _commands = {
'rbcheck' : [rbcheck, '--filter [gnur-only,fastr-only,both,both-diff]'], 'rbcheck' : [rbcheck, '--filter [gnur-only,fastr-only,both,both-diff]'],
'rbdiag' : [rbdiag, '(builtin)* [-v] [-n] [-m] [--sweep | --sweep-lite | --sweep-total'], 'rbdiag' : [rbdiag, '(builtin)* [-v] [-n] [-m] [--sweep | --sweep-lite | --sweep-total'],
'rcmplib' : [rcmplib, ['options']], 'rcmplib' : [rcmplib, ['options']],
'pkgtest' : [mx_fastr_pkgs.pkgtest, ['options']],
'rrepl' : [rrepl, '[options]'], 'rrepl' : [rrepl, '[options]'],
'rembed' : [rembed, '[options]'], 'rembed' : [rembed, '[options]'],
'installpkgs' : [installpkgs, '[options]'],
'installcran' : [installpkgs, '[options]'],
'r-cp' : [r_classpath, '[options]'], 'r-cp' : [r_classpath, '[options]'],
'pkgtest' : [mx_fastr_pkgs.pkgtest, ['options']],
'installpkgs' : [mx_fastr_pkgs.installpkgs, '[options]'],
} }
mx.update_commands(_fastr_suite, _commands) mx.update_commands(_fastr_suite, _commands)
...@@ -49,6 +49,40 @@ def _log_step(state, step, rvariant): ...@@ -49,6 +49,40 @@ def _log_step(state, step, rvariant):
if not quiet: if not quiet:
print "{0} {1} with {2}".format(state, step, rvariant) print "{0} {1} with {2}".format(state, step, rvariant)
def _cran_test_project():
return 'com.oracle.truffle.r.test.cran'
def _cran_test_project_dir():
return mx.project(_cran_test_project()).dir
def installpkgs(args):
_installpkgs(args)
def _installpkgs_script():
cran_test = _cran_test_project_dir()
return join(cran_test, 'r', 'install.cran.packages.R')
def _is_graalvm():
return os.environ.has_key('GRAALVM_FASTR')
def _graalvm():
return os.environ['GRAALVM_FASTR']
def _installpkgs(args, **kwargs):
'''
Runs the R script that does package/installation and testing.
If we are running in a binary graalvm environment, which is indicated
by the GRAALVM_FASTR environment variable, we can't use mx to invoke
FastR, but instead have to invoke the command directly.
'''
script = _installpkgs_script()
if _is_graalvm():
rscript = join(_graalvm(), 'bin', 'rscript')
return mx.run([rscript, script] + args, **kwargs)
else:
return mx_fastr.rscript([script] + args, **kwargs)
def pkgtest(args): def pkgtest(args):
''' '''
Package installation/testing. Package installation/testing.
...@@ -56,7 +90,11 @@ def pkgtest(args): ...@@ -56,7 +90,11 @@ def pkgtest(args):
''' '''
libinstall, install_tmp = _create_libinstall(mx.suite('fastr')) libinstall, install_tmp = _create_libinstall(mx.suite('fastr'))
stacktrace_args = ['--J', '@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces']
if _is_graalvm():
stacktrace_args = ['-J:-DR:-PrintErrorStacktracesToFile', '-J:-DR:+PrintErrorStacktraces']
else:
stacktrace_args = ['--J', '@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces']
if "--quiet" in args: if "--quiet" in args:
global quiet global quiet
quiet = True quiet = True
...@@ -133,7 +171,7 @@ def pkgtest(args): ...@@ -133,7 +171,7 @@ def pkgtest(args):
_log_step('BEGIN', 'install/test', 'FastR') _log_step('BEGIN', 'install/test', 'FastR')
# Currently installpkgs does not set a return code (in install.cran.packages.R) # Currently installpkgs does not set a return code (in install.cran.packages.R)
rc = mx_fastr._installpkgs(stacktrace_args + install_args, nonZeroIsFatal=False, env=env, out=out, err=out) rc = _installpkgs(stacktrace_args + install_args, nonZeroIsFatal=False, env=env, out=out, err=out)
if rc == 100: if rc == 100:
# fatal error connecting to package repo # fatal error connecting to package repo
mx.abort(rc) mx.abort(rc)
...@@ -217,7 +255,7 @@ def _install_vignette_support(rvariant, env): ...@@ -217,7 +255,7 @@ def _install_vignette_support(rvariant, env):
_log_step('END', 'install vignette support', rvariant) _log_step('END', 'install vignette support', rvariant)
def _gnur_installpkgs(args, env, **kwargs): def _gnur_installpkgs(args, env, **kwargs):
return mx.run(['Rscript', mx_fastr._installpkgs_script()] + args, env=env, **kwargs) return mx.run(['Rscript', _installpkgs_script()] + args, env=env, **kwargs)
def _gnur_install_test(pkgs): def _gnur_install_test(pkgs):
gnur_packages = join(_mx_gnur().dir, 'gnur.packages') gnur_packages = join(_mx_gnur().dir, 'gnur.packages')
...@@ -226,9 +264,9 @@ def _gnur_install_test(pkgs): ...@@ -226,9 +264,9 @@ def _gnur_install_test(pkgs):
f.write(pkg) f.write(pkg)
f.write('\n') f.write('\n')
# clone the cran test project into gnur # clone the cran test project into gnur
gnur_cran_test_project_dir = join(_mx_gnur().dir, mx_fastr._cran_test_project()) gnur_cran_test_project_dir = join(_mx_gnur().dir, _cran_test_project())
if not exists(gnur_cran_test_project_dir): if not exists(gnur_cran_test_project_dir):
shutil.copytree(mx_fastr._cran_test_project_dir(), gnur_cran_test_project_dir) shutil.copytree(_cran_test_project_dir(), gnur_cran_test_project_dir)
gnur_libinstall, gnur_install_tmp = _create_libinstall(_mx_gnur()) gnur_libinstall, gnur_install_tmp = _create_libinstall(_mx_gnur())
env = os.environ.copy() env = os.environ.copy()
gnur = _mx_gnur().extensions gnur = _mx_gnur().extensions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment