cpp11 icon indicating copy to clipboard operation
cpp11 copied to clipboard

tests fail

Open nunotexbsd opened this issue 11 months ago • 11 comments
trafficstars

Trying to find if a missing dependency is causing testunit to fail. Tested on 0.5.0 and 0.5.1.

Any clues?

Thanks

> sessionInfo()
R version 4.4.2 (2024-10-31)
Platform: amd64-portbld-freebsd15.0
Running under: FreeBSD 15amd64-main 15.0-CURRENT FreeBSD 15.0-CURRENT 1500028 amd64

Matrix products: default
LAPACK: /usr/local/lib/R/lib/libRlapack.so;  LAPACK version 3.12.0

locale:
[1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8

time zone: Europe/Lisbon
tzcode source: system (FreeBSD)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_4.4.2
<snip>
* checking examples ... OK
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ...
  'FAQ.Rmd' using 'UTF-8'... failed
  'converting.Rmd' using 'UTF-8'... OK
  'cpp11.Rmd' using 'UTF-8'... failed
  'internals.Rmd' using 'UTF-8'... OK
  'motivations.Rmd' using 'UTF-8'... failed
 ERROR
Errors in running code in vignettes:
when running code in 'FAQ.Rmd'
  ...

> add_some <- function(x, amount = 1) {
+     add_some_(x, amount)
+ }

> add_some(1)

  When sourcing 'FAQ.R':
Error: could not find function "add_some_"
Execution halted
when running code in 'cpp11.Rmd'
  ...
> 600/(0.005 - 0.002)
[1] 2e+05

> mod <- lm(mpg ~ wt, data = mtcars)

> mpe(mod)

  When sourcing 'cpp11.R':
Error: could not find function "mpe"
Execution halted
when running code in 'motivations.Rmd'
  ...
[1] 2 4 6

> x
[1] 1 2 3

> z <- times_two_rcpp(x)

  When sourcing 'motivations.R':
Error: could not find function "times_two_rcpp"
Execution halted

* checking re-building of vignette outputs ... SKIPPED
* DONE
Status: 1 ERROR, 1 NOTE
*** Error code 1

Full log: 00check.log

nunotexbsd avatar Dec 06 '24 09:12 nunotexbsd

@nunotexbsd the full log says Rcpp is missing, and hence the times_two_rcpp cannot be compiled

you need to install these mentioned in the log

Packages suggested but not available for checking:
  'covr', 'ggplot2', 'lobstr', 'rmarkdown', 'scales', 'Rcpp'

pachadotdev avatar Dec 17 '24 07:12 pachadotdev

@pachadotdev Hello,

I think I have all dependencies covered in port. Do you mind take a look?

Thanks!

TEST_DEPENDS=   R-cran-covr>0:devel/R-cran-covr \
                R-cran-decor>0:devel/R-cran-decor \
                R-cran-ggplot2>0:graphics/R-cran-ggplot2 \
                R-cran-knitr>0:print/R-cran-knitr \
                R-cran-mockery>0:devel/R-cran-mockery \
                R-cran-progress>0:devel/R-cran-progress \
                R-cran-Rcpp>0:devel/R-cran-Rcpp \
                R-cran-rmarkdown>0:textproc/R-cran-rmarkdown \
                R-cran-scales>0:graphics/R-cran-scales \
                R-cran-testthat>0:devel/R-cran-testthat
pre-test:
# R-cran-bench package does not exist yet
        @${LOCALBASE}/bin/Rscript -e 'install.packages("bench", \
                repos = "https://cloud.r-project.org")'
# R-cran-lobstr package does not exist yet
        @${LOCALBASE}/bin/Rscript -e 'install.packages("lobstr", \
                repos = "https://cloud.r-project.org")'

Short error log:

<snip>
* checking for unstated dependencies in 'tests' ... OK
* checking tests ... OK
  Running 'testthat.R'
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking running R code from vignettes ... ERROR
Errors in running code in vignettes:
when running code in 'FAQ.Rmd'
  ...

> add_some <- function(x, amount = 1) {
+     add_some_(x, amount)
+ }

> add_some(1)

  When sourcing 'FAQ.R':
Error: could not find function "add_some_"
Execution halted
when running code in 'cpp11.Rmd'
  ...
> 600/(0.005 - 0.002)
[1] 2e+05

> mod <- lm(mpg ~ wt, data = mtcars)

> mpe(mod)

  When sourcing 'cpp11.R':
Error: could not find function "mpe"
Execution halted
when running code in 'motivations.Rmd'
  ...
[1] 2 4 6

> x
[1] 1 2 3

> z <- times_two_rcpp(x)

  When sourcing 'motivations.R':
Error: could not find function "times_two_rcpp"
Execution halted

  'FAQ.Rmd' using 'UTF-8'... failed
  'converting.Rmd' using 'UTF-8'... OK
  'cpp11.Rmd' using 'UTF-8'... failed
  'internals.Rmd' using 'UTF-8'... OK
  'motivations.Rmd' using 'UTF-8'... failed
* checking re-building of vignette outputs ... SKIPPED
* DONE
Status: 1 ERROR

Full log: 00check.log

nunotexbsd avatar Dec 17 '24 11:12 nunotexbsd

@nunotexbsd I was finally able to replicate the error you have!

I added that in an unrelated PR but now I will add that tiny change by separate https://github.com/r-lib/cpp11/pull/427/files#diff-a66dc48b52fad8fe92354878da72e04c4b0bfb9d4fea933afcfa3020ac61b0ebR15

pachadotdev avatar Jan 03 '25 08:01 pachadotdev

@pachadotdev That's good news!

Didn't found a way to apply the shorter patch: https://github.com/r-lib/cpp11/pull/427/files#diff-a66dc48b52fad8fe92354878da72e04c4b0bfb9d4fea933afcfa3020ac61b0ebR15 on 0.5.1 tarball from R-cran.

But I will stay tuned and wait for merge so I can test it.

Thanks

nunotexbsd avatar Jan 03 '25 11:01 nunotexbsd

@nunotexbsd as I commented in the PR, can you install the github version from main?

pachadotdev avatar Jan 03 '25 12:01 pachadotdev

In order to use FreeBSD ports framework cran helpers, I did download cpp11-main.zip, uncompress and apply https://github.com/r-lib/cpp11/pull/439/commits/9ebcf417d5ff771f50a9131c5382b757c0cbeb04 to it, create a new tarball and use it in ports.

Build is ok, but when running test:

* using log directory '/wrkdirs/usr/ports/devel/R-cran-cpp11/work/cpp11.Rcheck'
* using R version 4.4.2 (2024-10-31)
* using platform: amd64-portbld-freebsd15.0
* R was compiled by
    FreeBSD clang version 19.1.5 (https://github.com/llvm/llvm-project.git llvmorg-19.1.5-0-gab4b5a2db582)
    GNU Fortran (FreeBSD Ports Collection) 13.3.0
* running under: FreeBSD 15amd64-main 15.0-CURRENT FreeBSD 15.0-CURRENT 1500029 amd64
* using session charset: ASCII
* using options '--no-manual --no-build-vignettes'
* checking for file 'cpp11/DESCRIPTION' ... ERROR
Required fields missing or empty:
  'Author' 'Maintainer'
* DONE
Status: 1 ERROR

Maybe I missed something here.

nunotexbsd avatar Jan 03 '25 18:01 nunotexbsd

In order to use FreeBSD ports framework cran helpers, I did download cpp11-main.zip, uncompress and apply 9ebcf41 to it, create a new tarball and use it in ports.

Build is ok, but when running test:

* using log directory '/wrkdirs/usr/ports/devel/R-cran-cpp11/work/cpp11.Rcheck'
* using R version 4.4.2 (2024-10-31)
* using platform: amd64-portbld-freebsd15.0
* R was compiled by
    FreeBSD clang version 19.1.5 (https://github.com/llvm/llvm-project.git llvmorg-19.1.5-0-gab4b5a2db582)
    GNU Fortran (FreeBSD Ports Collection) 13.3.0
* running under: FreeBSD 15amd64-main 15.0-CURRENT FreeBSD 15.0-CURRENT 1500029 amd64
* using session charset: ASCII
* using options '--no-manual --no-build-vignettes'
* checking for file 'cpp11/DESCRIPTION' ... ERROR
Required fields missing or empty:
  'Author' 'Maintainer'
* DONE
Status: 1 ERROR

Maybe I missed something here.

how about

R
remotes::install_github("r-lib/cpp11")

or

git clone https://github.com/r-lib/cpp11.git
cd cpp11
R
devtools::install()

pachadotdev avatar Jan 04 '25 03:01 pachadotdev

OK, I'm building required depends so I can do both methods outside poudriere.

git clone https://github.com/r-lib/cpp11.git
cd cpp11
R
devtools::install()

# R CMD check cpp11test

* using log directory ‘/home/nunotex/Work/cpp11/cpp11test.Rcheck’
* using R version 4.4.2 (2024-10-31)
* using platform: amd64-portbld-freebsd15.0
* R was compiled by
    FreeBSD clang version 19.1.5 (https://github.com/llvm/llvm-project.git llvmorg-19.1.5-0-gab4b5a2db582)
    GNU Fortran (FreeBSD Ports Collection) 13.3.0
* running under: FreeBSD leg.home 15.0-CURRENT FreeBSD 15.0-CURRENT #21 main-n274426-98e34e8e2557: Mon Dec 23 23:52:26 WET 2024     [email protected]:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64
* using session charset: UTF-8
* checking for file ‘cpp11test/DESCRIPTION’ ... ERROR
Required fields missing or empty:
  ‘Author’ ‘Maintainer’
* DONE

Status: 1 ERROR
See
  ‘/home/nunotex/Work/cpp11/cpp11test.Rcheck/00check.log’
for details.

nunotexbsd avatar Jan 04 '25 12:01 nunotexbsd

@nunotexbsd sorry, for a github repo the command is devtools::check(), unless you 1st build the tar file and then check the tar

pachadotdev avatar Jan 05 '25 09:01 pachadotdev

@pachadotdev after installing missing deps with > install.packages("PkgName"):

> devtools::check()

<snip>
✔  checking Rd \usage sections ...
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking line endings in C/C++/Fortran sources/headers ...
✔  checking pragmas in C/C++ headers and code ...
    WARNING
   ‘qpdf’ is needed for checks on size reduction of PDFs
✔  checking installed files from ‘inst/doc’ ...
✔  checking files in ‘vignettes’ ...
✔  checking examples (2.1s)
✔  checking for unstated dependencies in ‘tests’ ...
─  checking tests ...
    [13s/13s] OKthat.R’
   * checking for unstated dependencies in vignettes ... OK
   * checking package vignettes ... OK
   * checking re-building of vignette outputs ... [35s/35s] OK
   * checking for non-standard things in the check directory ... OK
   * checking for detritus in the temp directory ... OK
   * DONE

   Status: 1 WARNING
   See
     ‘/tmp/RtmpU7vTmY/file1232845813d99/cpp11.Rcheck/00check.log’
   for details.

── R CMD check results ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── cpp11 0.5.1.9000 ────
Duration: 59.7s

❯ checking pragmas in C/C++ headers and code ... OK
   WARNING
  ‘qpdf’ is needed for checks on size reduction of PDFs

0 errors ✔ | 1 warning ✖ | 0 notes ✔

nunotexbsd avatar Jan 05 '25 12:01 nunotexbsd

@pachadotdev after installing missing deps with > install.packages("PkgName"):

> devtools::check()

<snip>
✔  checking Rd \usage sections ...
✔  checking Rd contents ...
✔  checking for unstated dependencies in examples ...
✔  checking line endings in C/C++/Fortran sources/headers ...
✔  checking pragmas in C/C++ headers and code ...
    WARNING
   ‘qpdf’ is needed for checks on size reduction of PDFs
✔  checking installed files from ‘inst/doc’ ...
✔  checking files in ‘vignettes’ ...
✔  checking examples (2.1s)
✔  checking for unstated dependencies in ‘tests’ ...
─  checking tests ...
    [13s/13s] OKthat.R’
   * checking for unstated dependencies in vignettes ... OK
   * checking package vignettes ... OK
   * checking re-building of vignette outputs ... [35s/35s] OK
   * checking for non-standard things in the check directory ... OK
   * checking for detritus in the temp directory ... OK
   * DONE

   Status: 1 WARNING
   See
     ‘/tmp/RtmpU7vTmY/file1232845813d99/cpp11.Rcheck/00check.log’
   for details.

── R CMD check results ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── cpp11 0.5.1.9000 ────
Duration: 59.7s

❯ checking pragmas in C/C++ headers and code ... OK
   WARNING
  ‘qpdf’ is needed for checks on size reduction of PDFs

0 errors ✔ | 1 warning ✖ | 0 notes ✔

@nunotexbsd you are all set! the warning is something about the manual, which you can fix with a command equivalent to apt install qpdf and it only reduces the size of the pdf documentation

pachadotdev avatar Jan 06 '25 06:01 pachadotdev