Use phrGetErrorStrings.valgrind-leak.R.in in place of phreeqc.R.in when executing

'make check' -> 'R CMD check --as-cran' which produces (cran/)phreeqc.Rcheck/phreeqc-Ex.R
and is checked in as leak-Ex.R (only includes the phrGetErrorStrings example).

run using:
R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < leak-Ex.R

and running the full set of examples:
R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < (cran/)phreeqc.Rcheck/phreeqc-Ex.R


git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8844 1feff8c3-07ed-0310-ac33-dd36852eb9cd
This commit is contained in:
Scott R Charlton 2014-07-15 03:49:34 +00:00
parent 167b08bfbb
commit 60c7fdfe68
2 changed files with 1554 additions and 0 deletions

51
R/leak-Ex.R Normal file
View File

@ -0,0 +1,51 @@
pkgname <- "phreeqc"
source(file.path(R.home("share"), "R", "examples-header.R"))
options(warn = 1)
base::assign(".ExTimings", "phreeqc-Ex.timings", pos = 'CheckExEnv')
base::cat("name\tuser\tsystem\telapsed\n", file=base::get(".ExTimings", pos = 'CheckExEnv'))
base::assign(".format_ptime",
function(x) {
if(!is.na(x[4L])) x[1L] <- x[1L] + x[4L]
if(!is.na(x[5L])) x[2L] <- x[2L] + x[5L]
options(OutDec = '.')
format(x[1L:3L], digits = 7L)
},
pos = 'CheckExEnv')
### * </HEADER>
library('phreeqc')
base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
cleanEx()
nameEx("phrGetErrorStrings")
### * phrGetErrorStrings
flush(stderr()); flush(stdout())
base::assign(".ptime", proc.time(), pos = "CheckExEnv")
### Name: phrGetErrorStrings
### Title: Retrieve error string messages.
### Aliases: phrGetErrorStrings
### ** Examples
# loaddatabase should fail
n <- try(phrLoadDatabase("missing.dat"), silent = TRUE)
# if n is non-NULL display error string
if (!is.null(n)) phrGetErrorStrings()
base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv")
base::cat("phrGetErrorStrings", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t")
### * <FOOTER>
###
options(digits = 7L)
base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
grDevices::dev.off()
###
### Local variables: ***
### mode: outline-minor ***
### outline-regexp: "\\(> \\)?### [*]+" ***
### End: ***
quit('no')

File diff suppressed because it is too large Load Diff