Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
ed4378ee
Commit
ed4378ee
authored
9 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
add outer capture to mx test
parent
1fff0ad9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ci.hocon
+1
-1
1 addition, 1 deletion
ci.hocon
com.oracle.truffle.r.test.cran/r/install.cran.packages.R
+11
-11
11 additions, 11 deletions
com.oracle.truffle.r.test.cran/r/install.cran.packages.R
mx.fastr/mx_fastr.py
+50
-23
50 additions, 23 deletions
mx.fastr/mx_fastr.py
with
62 additions
and
35 deletions
ci.hocon
+
1
−
1
View file @
ed4378ee
...
...
@@ -54,7 +54,7 @@ gateStyle : ${common} {
pkgtest
:
${
common
}
${
java8Downloads
}
{
timelimit
:
"3:00:00"
run
:
[
[
"mx"
,
"test"
]
[
"mx"
,
"test"
,
"--capture-output"
,
"--print-ok-installs"
]
]
}
...
...
This diff is collapsed.
Click to expand it.
com.oracle.truffle.r.test.cran/r/install.cran.packages.R
+
11
−
11
View file @
ed4378ee
...
...
@@ -73,7 +73,7 @@ usage <- function() {
cat
(
paste
(
"usage: Rscript [--contriburl url] [--cran-mirror url] [--lib] [--verbose | -v] [-V] [--dryrun]"
,
"[--no-install | -n] [--create-blacklist] [--blacklist-file file] [--ignore-blacklist]"
,
"[--initial-blacklist-file file]"
,
"[--
test
count count]"
,
"[--ok-pkg-filelist file]"
,
"[--
pkg-
count count]"
,
"[--ok-pkg-filelist file]"
,
"[--install-dependents]"
,
"[--run-mode mode]"
,
"[--pkg-filelist file]"
,
...
...
@@ -438,17 +438,17 @@ do.it <- function() {
}
}
if
(
is.na
(
test
count
))
{
if
(
is.na
(
pkg.
count
))
{
# install all non-blacklisted packages in toinstall.pkgs
test.pkgnames
<-
rownames
(
toinstall.pkgs
)
}
else
{
# install
test
count packages taken at random from toinstall.pkgs
# install
pkg.
count packages taken at random from toinstall.pkgs
matched.toinstall.pkgs
<-
apply
(
toinstall.pkgs
,
1
,
function
(
x
)
include.package
(
x
,
blacklist
))
test.avail.pkgs
<-
toinstall.pkgs
[
matched.toinstall.pkgs
,
,
drop
=
F
]
test.avail.pkgnames
<-
rownames
(
test.avail.pkgs
)
rands
<-
sample
(
1
:
length
(
test.avail.pkgnames
))
test.pkgnames
<-
character
(
test
count
)
for
(
i
in
(
1
:
test
count
))
{
test.pkgnames
<-
character
(
pkg.
count
)
for
(
i
in
(
1
:
pkg.
count
))
{
test.pkgnames
[[
i
]]
<-
test.avail.pkgnames
[[
rands
[[
i
]]]]
}
}
...
...
@@ -471,7 +471,7 @@ do.it <- function() {
test.count
=
1
test.total
=
length
(
test.pkgnames
)
for
(
pkgname
in
test.pkgnames
)
{
if
(
install
ed.ok
(
pkgname
)
)
{
if
(
install
.status
[
pkgname
]
)
{
if
(
dry.run
)
{
cat
(
"would test:"
,
pkgname
,
"\n"
)
}
else
{
...
...
@@ -607,9 +607,9 @@ parse.args <- function() {
cran.mirror
<<-
get.argvalue
()
}
else
if
(
a
==
"--lib"
)
{
lib.install
<<-
get.argvalue
()
}
else
if
(
a
==
"--
test
count"
)
{
test
count
<<-
as.integer
(
get.argvalue
())
if
(
is.na
(
test
count
))
{
}
else
if
(
a
==
"--
pkg-
count"
)
{
pkg.
count
<<-
as.integer
(
get.argvalue
())
if
(
is.na
(
pkg.
count
))
{
usage
()
}
}
else
if
(
a
==
"--run-mode"
)
{
...
...
@@ -661,7 +661,7 @@ cat.args <- function() {
cat
(
"ignore.blacklist:"
,
ignore.blacklist
,
"\n"
)
cat
(
"pkg.pattern:"
,
pkg.pattern
,
"\n"
)
cat
(
"contriburl:"
,
contriburl
,
"\n"
)
cat
(
"
test
count:"
,
test
count
,
"\n"
)
cat
(
"
pkg.
count:"
,
pkg.
count
,
"\n"
)
cat
(
"run.mode:"
,
run.mode
,
"\n"
)
cat
(
"run.tests:"
,
run.tests
,
"\n"
)
cat
(
"pkg.list.installed:"
,
pkg.list.installed
,
"\n"
)
...
...
@@ -751,7 +751,7 @@ avail.pkgs.rownames <- NULL
toinstall.pkgs
<-
NULL
create.blacklist.file
<-
F
ignore.blacklist
<-
F
test
count
<-
NA
pkg.
count
<-
NA
run.mode
<-
"system"
run.tests
<-
FALSE
gnur
<-
FALSE
...
...
This diff is collapsed.
Click to expand it.
mx.fastr/mx_fastr.py
+
50
−
23
View file @
ed4378ee
...
...
@@ -72,7 +72,7 @@ _command_class_dict = {'r': _r_command_project + ".shell.RCommand",
'
rscript
'
:
_r_command_project
+
"
.shell.RscriptCommand
"
,
'
rrepl
'
:
_repl_command
}
def
do_run_r
(
args
,
command
,
extraVmArgs
=
None
,
jdk
=
None
,
nonZeroIsFatal
=
True
):
def
do_run_r
(
args
,
command
,
extraVmArgs
=
None
,
jdk
=
None
,
nonZeroIsFatal
=
True
,
out
=
None
,
err
=
None
):
'''
This is the basic function that runs a FastR process, where args have already been parsed.
Args:
...
...
@@ -103,7 +103,7 @@ def do_run_r(args, command, extraVmArgs=None, jdk=None, nonZeroIsFatal=True):
vmArgs
=
_sanitize_vmArgs
(
jdk
,
vmArgs
)
if
command
:
vmArgs
.
append
(
_command_class_dict
[
command
.
lower
()])
return
mx
.
run_java
(
vmArgs
+
args
,
nonZeroIsFatal
=
nonZeroIsFatal
,
jdk
=
jdk
)
return
mx
.
run_java
(
vmArgs
+
args
,
nonZeroIsFatal
=
nonZeroIsFatal
,
jdk
=
jdk
,
out
=
out
,
err
=
err
)
def
_sanitize_vmArgs
(
jdk
,
vmArgs
):
'''
...
...
@@ -185,7 +185,7 @@ def get_default_jdk():
'''
return
mx_jvm
().
get_jvmci_jdk
()
def
run_r
(
args
,
command
,
parser
=
None
,
extraVmArgs
=
None
,
jdk
=
None
,
nonZeroIsFatal
=
True
):
def
run_r
(
args
,
command
,
parser
=
None
,
extraVmArgs
=
None
,
jdk
=
None
,
nonZeroIsFatal
=
True
,
out
=
None
,
err
=
None
):
'''
Common function for running either R, Rscript (or rrepl).
args are a list of strings that came after
'
command
'
on the command line
...
...
@@ -213,15 +213,15 @@ def run_r(args, command, parser=None, extraVmArgs=None, jdk=None, nonZeroIsFatal
print
'
CMD not implemented via mx, use: bin/R CMD ...
'
sys
.
exit
(
1
)
return
do_run_r
(
rargs
,
command
,
extraVmArgs
=
extraVmArgs
,
jdk
=
jdk
,
nonZeroIsFatal
=
nonZeroIsFatal
)
return
do_run_r
(
rargs
,
command
,
extraVmArgs
=
extraVmArgs
,
jdk
=
jdk
,
nonZeroIsFatal
=
nonZeroIsFatal
,
out
=
out
,
err
=
err
)
def
rshell
(
args
):
'''
run R shell
'''
return
run_r
(
args
,
'
r
'
)
def
rscript
(
args
):
def
rscript
(
args
,
parser
=
None
,
out
=
None
,
err
=
None
):
'''
run Rscript
'''
return
run_r
(
args
,
'
rscript
'
)
return
run_r
(
args
,
'
rscript
'
,
parser
=
parser
,
out
=
out
,
err
=
err
)
def
rrepl
(
args
,
nonZeroIsFatal
=
True
,
extraVmArgs
=
None
):
'''
run R repl
'''
...
...
@@ -282,7 +282,7 @@ def original_gate(args):
'''
Run the R gate (without filtering gate tasks)
'''
mx_gate
.
gate
(
args
)
def
_test_harness_body
_install_new
(
args
,
vmArgs
):
def
_test_harness_body
(
args
,
vmArgs
):
'''
the callback from mx.test
'''
libinstall
=
abspath
(
"
lib.install.cran
"
)
# make sure its empty
...
...
@@ -293,25 +293,48 @@ def _test_harness_body_install_new(args, vmArgs):
os
.
mkdir
(
install_tmp
)
os
.
environ
[
"
TMPDIR
"
]
=
install_tmp
os
.
environ
[
'
R_LIBS_USER
'
]
=
libinstall
stack_args
=
[
'
--J
'
,
'
@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces
'
]
cran_args
=
[]
local_cran
=
mx
.
get_env
(
'
MX_HG_BASE
'
)
if
local_cran
:
cran_args
=
[
'
--cran-mirror
'
,
join
(
dirname
(
local_cran
),
'
cran
'
)]
# the following is used to test the installation of packages that are not in the
# --ok-pkg-filelist file, i.e. those that have never been successfully installed
# extra_args = ['--ok-pkg-filelist', join(_cran_test_project(), 'ok.packages')]
# the following line is used to test packages that have been successfully installed
extra_args
=
[
'
--pkg-filelist
'
,
join
(
_cran_test_project
(),
'
ok.packages
'
),
'
--run-tests
'
,
'
--verbose
'
]
rc
=
installcran
(
stack_args
+
cran_args
+
[
'
--testcount
'
,
'
100
'
]
+
extra_args
)
stacktrace_args
=
[
'
--J
'
,
'
@-DR:-PrintErrorStacktracesToFile -DR:+PrintErrorStacktraces
'
]
install_args
=
[
'
--pkg-count
'
,
args
.
pkg_count
]
if
args
.
ok_only
:
# only install/test packages that have been successfully installed
install_args
+=
[
'
--pkg-filelist
'
,
join
(
_cran_test_project
(),
'
ok.packages
'
)]
if
not
args
.
install_only
:
install_args
+=
[
'
--run-tests
'
]
if
args
.
ignore_blacklist
:
install_args
+=
[
'
--ignore-blacklist
'
]
if
args
.
install_dependents
:
install_args
+=
[
'
--install-dependents
'
]
if
args
.
print_ok_installs
:
install_args
+=
[
'
--print-ok-installs
'
]
class
OutputCapture
:
def
__init__
(
self
):
self
.
data
=
""
def
__call__
(
self
,
data
):
self
.
data
+=
data
out
=
OutputCapture
()
if
args
.
capture_output
else
None
rc
=
_installpkgs
(
stacktrace_args
+
install_args
,
out
=
out
,
err
=
out
)
if
args
.
capture_output
:
print
out
.
data
shutil
.
rmtree
(
install_tmp
,
ignore_errors
=
True
)
return
rc
def
test
(
args
):
'''
used for package installation/testing
'''
parser
=
ArgumentParser
(
prog
=
'
r test
'
)
return
mx
.
test
(
args
,
harness
=
_test_harness_body_install_new
,
parser
=
parser
)
parser
.
add_argument
(
'
--ok-only
'
,
action
=
'
store_true
'
,
help
=
'
only install/test packages from the ok.packages file
'
)
parser
.
add_argument
(
'
--install-only
'
,
action
=
'
store_true
'
,
help
=
'
just install packages, do not test
'
)
parser
.
add_argument
(
'
--capture-output
'
,
action
=
'
store_true
'
,
help
=
'
capture output
'
)
# sundry options understood by installpkgs R code
parser
.
add_argument
(
'
--pkg-count
'
,
action
=
'
store
'
,
help
=
'
number of packages to install/test
'
,
default
=
100
)
parser
.
add_argument
(
'
--ignore-blacklist
'
,
action
=
'
store_true
'
,
help
=
'
pass --ignore-blacklist
'
)
parser
.
add_argument
(
'
--install-dependents
'
,
action
=
'
store_true
'
,
help
=
'
pass -install-dependents
'
)
parser
.
add_argument
(
'
--print-ok-installs
'
,
action
=
'
store_true
'
,
help
=
'
pass --print-ok-installs
'
)
return
mx
.
test
(
args
,
harness
=
_test_harness_body
,
parser
=
parser
)
def
_test_srcdir
():
tp
=
'
com.oracle.truffle.r.test
'
...
...
@@ -576,10 +599,13 @@ def rbench(args):
def
_cran_test_project
():
return
mx
.
project
(
'
com.oracle.truffle.r.test.cran
'
).
dir
def
installcran
(
args
):
def
installpkgs
(
args
):
_installpkgs
(
args
)
def
_installpkgs
(
args
,
out
=
None
,
err
=
None
):
cran_test
=
_cran_test_project
()
script
=
join
(
cran_test
,
'
r
'
,
'
install.cran.packages.R
'
)
return
rscript
([
script
]
+
args
)
return
rscript
([
script
]
+
args
,
out
=
out
,
err
=
err
)
def
load_optional_suite
(
name
,
rev
,
kind
=
'
hg
'
,
build
=
True
,
url
=
None
):
if
not
url
:
...
...
@@ -626,7 +652,8 @@ _commands = {
'
rcmplib
'
:
[
rcmplib
,
[
'
options
'
]],
'
test
'
:
[
test
,
[
'
options
'
]],
'
rrepl
'
:
[
rrepl
,
'
[options]
'
],
'
installcran
'
:
[
installcran
,
'
[options]
'
],
'
installpkgs
'
:
[
installpkgs
,
'
[options]
'
],
'
installcran
'
:
[
installpkgs
,
'
[options]
'
],
}
_commands
.
update
(
mx_fastr_pkgtest
.
_commands
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment