elbamos/largeVis

testcfunctions.cpp fails (Win)... what is it supposed to do?

Closed this issue · 19 comments

On a github clone with R-3.4.1, the tests from testcfunctions.cpp fail:

testthat results ================================================================
OK: 147 SKIPPED: 1 FAILED: 1
1. Failure: Catch unit tests pass (@test-cpp.R#6) 

and above:

testcfunctions.cpp:9
...............................................................................

testcfunctions.cpp:17: FAILED:
  CATCH_CHECK( testAlias() == 71 )
with expansion:
  83 == 71

testcfunctions.cpp:18: FAILED:
  CATCH_CHECK( testAlias() == 74 )
with expansion:
  97 == 74

testcfunctions.cpp:19: FAILED:
  CATCH_CHECK( testAlias() == 70 )
with expansion:
  68 == 70

testcfunctions.cpp:20: FAILED:
  CATCH_CHECK( testAlias() == 90 )
with expansion:
  88 == 90

etc. But I don't really get what these tests are supposed to test? Looks like you are setting up the RNG with a seed and expect a certain output?

Is this expected to fail on Windows possibly?

Seems not to be Windows related. I installed the package from CRAN on my Linux VM and get the same error.

R version 3.4.1 (2017-06-30) -- "Single Candle"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(largeVis)
Loading required package: Matrix
> library(testthat)
> expect_cpp_tests_pass("largeVis")
Error: C++ unit tests:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
alias tests | testcfunctions.cpp
  alias int succeeds
-------------------------------------------------------------------------------
testcfunctions.cpp:9
...............................................................................

testcfunctions.cpp:17: FAILED:
  CATCH_CHECK( testAlias() == 71 )
with expansion:
  83 == 71

testcfunctions.cpp:18: FAILED:
  CATCH_CHECK( testAlias() == 74 )
with expansion:
  97 == 74

testcfunctions.cpp:19: FAILED:
  CATCH_CHECK( testAlias() == 70 )
with expansion:
  68 == 70

testcfunctions.cpp:20: FAILED:
  CATC
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 17.04

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.7.0
LAPACK: /usr/lib/lapack/liblapack.so.3.7.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages:
[1] testthat_1.0.2 largeVis_0.2.1 Matrix_1.2-10

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.11     lattice_0.20-35  crayon_1.3.2     grid_3.4.1
 [5] plyr_1.8.4       R6_2.2.2         gtable_0.2.0     magrittr_1.5
 [9] scales_0.4.1     ggplot2_2.2.1    rlang_0.1.1      lazyeval_0.2.0
[13] munsell_0.4.3    compiler_3.4.1   colorspace_1.3-2 tibble_1.3.3
>

Windows, R 3.4.0, installed from CRAN binary (not compiled myself AFAIK)


R version 3.4.0 (2017-04-21) -- "You Stupid Darkness"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(testthat)
> library(largeVis)
Lade nötiges Paket: Matrix
> expect_cpp_tests_pass("largeVis")
Error: C++ unit tests:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
alias tests | testcfunctions.cpp
  alias int succeeds
-------------------------------------------------------------------------------
testcfunctions.cpp:9
...............................................................................

testcfunctions.cpp:17: FAILED:
  CATCH_CHECK( testAlias() == 71 )
with expansion:
  83 == 71

testcfunctions.cpp:18: FAILED:
  CATCH_CHECK( testAlias() == 74 )
with expansion:
  97 == 74

testcfunctions.cpp:19: FAILED:
  CATCH_CHECK( testAlias() == 70 )
with expansion:
  68 == 70

testcfunctions.cpp:20: FAILED:
  CATCH_CHECK( testAlias() == 90 )
with expansion:
  88 == 90

-------------------------------------------------------------------------------
alias tests | testcfunctions.cpp
  alias long succeeds
-------
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252    LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C                       
[5] LC_TIME=German_Switzerland.1252    

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

other attached packages:
[1] largeVis_0.2.2 Matrix_1.2-10  testthat_1.0.2

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.11     lattice_0.20-35  crayon_1.3.2     grid_3.4.0       R6_2.2.2         plyr_1.8.4       gtable_0.2.0     magrittr_1.5     scales_0.4.1    
[10] ggplot2_2.2.1    rlang_0.1.1      lazyeval_0.2.0   tools_3.4.0      munsell_0.4.3    compiler_3.4.0   colorspace_1.3-2 tibble_1.3.3 

Windows, some devel version from Feb 2016 (sic!)
largeVis from CRAN, compiled while R 3.3.3 was up-to-date
Same error

R Under development (unstable) (2016-02-08 r70124) -- "Unsuffered Consequences"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(largeVis)
Lade nötiges Paket: Matrix
Warning messages:
1: Paket ‘largeVis’ wurde unter R Version 3.3.3 erstellt 
2: Paket ‘Matrix’ wurde unter R Version 3.3.1 erstellt 
> library(testthat)
Warning message:
Paket ‘testthat’ wurde unter R Version 3.3.3 erstellt 
> expect_cpp_tests_pass("largeVis")
Error: C++ unit tests:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 is a Catch v1.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
alias tests | testcfunctions.cpp
  alias int succeeds
-------------------------------------------------------------------------------
testcfunctions.cpp:9
...............................................................................

testcfunctions.cpp:17: FAILED:
  CATCH_CHECK( testAlias() == 71 )
with expansion:
  83 == 71

testcfunctions.cpp:18: FAILED:
  CATCH_CHECK( testAlias() == 74 )
with expansion:
  97 == 74

testcfunctions.cpp:19: FAILED:
  CATCH_CHECK( testAlias() == 70 )
with expansion:
  68 == 70

testcfunctions.cpp:20: FAILED:
  CATCH_CHECK( testAlias() == 90 )
with expansion:
  88 == 90

-------------------------------------------------------------------------------
alias tests | testcfunctions.cpp
  alias long succeeds
-------
> sessionInfo()
R Under development (unstable) (2016-02-08 r70124)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=German_Switzerland.1252  LC_CTYPE=German_Switzerland.1252    LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C                       
[5] LC_TIME=German_Switzerland.1252    

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

other attached packages:
[1] testthat_1.0.2 largeVis_0.2.1 Matrix_1.2-7.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8      lattice_0.20-34  crayon_1.3.2     assertthat_0.1   grid_3.3.0       plyr_1.8.4       R6_2.1.3         gtable_0.2.0    
 [9] magrittr_1.5     scales_0.4.1     ggplot2_2.2.0    lazyeval_0.2.0   tools_3.3.0      munsell_0.4.3    colorspace_1.2-6 tibble_1.2      

I have no quick way to put R3.4.0 on Linux, but I have the error in

  • R 3.4.1 on Linux (Ubuntu 17.04 repository R with the current gcc etc)
  • R 3.4.0 on Windows with gcc 4.9.3 (current Rtools)
  • R 3.3 devel on Windows with the CRAN largeVis build from a year ago (sic! Not built by myself)

So this is absolutely vanilla setups (except for the last one) which never cause problems otherwise.

This is also on two different machines plus one VM.

I also have no idea what makes these tests fail, but I also have no understanding of why you expect the output (71, 74, 70, 90) so I cannot really help you dig deeper...

Does it matter at all that I am running the tests from R using devtools and/or directly testthat? I originally caught this when using devtools::check() on the package.

Let me know if I can help more.

context("C++")
test_that("Catch unit tests pass", {
		skip_on_cran()
		skip_on_travis()
		skip_on_appveyor()
    expect_cpp_tests_pass("largeVis")
})

I don't know how to set up R on Windows or Linux with llvm as a compiler; that would probably take me a day of work. I just tried setting up largeVis on a Windows machine with an old toolchain (R 3.2 with gcc 4.6.3) and it is incompatible (which I guess is intended):

In file included from checkfunctions.cpp:1:0:
largeVis.h:7:2: error: #error largeVis is incompatible with gcc < 4.9. Upgrade gcc or use llvm.

Again, my compilers are:
gcc 4.9.3 from Rtools on Windows (https://cran.r-project.org/bin/windows/Rtools/)
gcc 6.3.0 on Ubuntu 17.04

Hmmm.... Is it possible for you to send me the complete output of a session where you start from a new, empty R session without largeVis installed, compile the package from current Master and get this result?

Thank you for reporting, its really very odd.

On Windows or on Linux?

Hello,
I recently tried to use largeVis in my own package, but the Travis build failed at the same place. Here is a complete session of the build, hope it helps
https://travis-ci.org/AlineTalhouk/diceR/jobs/273500644

Do you have any insights on how I may solve this problem? I tried adding

before_install:
 - Rscript -e 'install.packages("largeVis")'

to no avail. Thanks!

I'll try adding

sudo apt-get -qq install g++-4.9

first.

After some tedious explorations, I've pinpointed the important parts of the .travis.yml that are needed for largeVis incorporation in another package for anyone else interested:

sudo: required
dist: trusty

before_install: |1
     mkdir ~/.R
     cat <<EOF > ~/.R/Makevars
     CC=gcc-6
     CXX=g++-6
     CXX1X=g++-6
     CXX11=g++-6

r_packages:
  - RcppArmadillo
  - RcppProgress

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - gcc-6
      - g++-6
      - gfortran-6

Thanks!