hypertidy/PROJ

Rscript testthat.R failed when test the r-proj@0.4.0 use spack

Closed this issue · 8 comments

Steps to reproduce the issue

[root@localhost tests]# spack load r-testthat
[root@localhost tests]# spack load r-proj@0.4.0
[root@localhost tests]# ls
spelling.R  testthat  testthat.R
[root@localhost tests]# Rscript testthat.R
══ Failed tests ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
── Error (test-no-crash.R:11:3): out of bounds works ───────────────────────────
Error: attempt to set an attribute on NULL
Backtrace:

  1. ├─testthat::expect_output(...) test-no-crash.R:11:2
  2. │ └─testthat:::quasi_capture(...)
  3. │   ├─testthat:::.capture(...)
  4. │   │ └─testthat::capture_output_lines(code, print, width = width)
  5. │   │   └─testthat:::eval_with_output(code, print = print, width = width)
  6. │   │     ├─withr::with_output_sink(temp, withVisible(code))
  7. │   │     │ └─base::force(code)
  8. │   │     └─base::withVisible(code)
  9. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 10. └─PROJ::proj_trans(x, target, source = source) test-no-crash.R:13:4
── Error (test-PROJ.R:11:3): PROJ works ────────────────────────────────────────
Error: attempt to set an attribute on NULL
Backtrace:

 1. ├─testthat::expect_silent(...) test-PROJ.R:11:2
 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
 3. │   ├─testthat:::.capture(...)
 4. │   │ ├─withr::with_output_sink(...)
 5. │   │ │ └─base::force(code)
 6. │   │ ├─base::withCallingHandlers(...)
 7. │   │ └─base::withVisible(code)
 8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 9. └─PROJ::proj_trans(...)
── Error (test-sanity-inputs.R:16:3): input checks work ───────────────────────────
Error: attempt to set an attribute on NULL
Backtrace:

 1. ├─testthat::expect_silent(...) test-sanity-inputs.R:16:2
 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
 3. │   ├─testthat:::.capture(...)
 4. │   │ ├─withr::with_output_sink(...)
 5. │   │ │ └─base::force(code)
 6. │   │ ├─base::withCallingHandlers(...)
 7. │   │ └─base::withVisible(code)
 8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 9. └─PROJ::proj_trans(data.frame(lon, lat), dst, source = llproj)

[ FAIL 3 | WARN 0 | SKIP 0 | PASS 5 ]
Error: Test failures
Execution halted
[root@localhost tests]# spack spec r-proj
Input spec
--------------------------------
r-proj

Concretized
--------------------------------
r-proj@0.4.0%gcc@8.4.1 arch=linux-centos8-aarch64
    ^r@4.0.4%gcc@8.4.1~X~external-lapack~memory_profiling~rmath arch=linux-centos8-aarch64
        ^bzip2@1.0.8%gcc@8.4.1+shared arch=linux-centos8-aarch64
            ^diffutils@3.7%gcc@8.4.1 arch=linux-centos8-aarch64
                ^libiconv@1.16%gcc@8.4.1 arch=linux-centos8-aarch64
        ^curl@7.74.0%gcc@8.4.1~darwinssl~gssapi~libssh~libssh2~nghttp2 arch=linux-centos8-aarch64
            ^libidn2@2.3.0%gcc@8.4.1 arch=linux-centos8-aarch64
                ^libunistring@0.9.10%gcc@8.4.1 arch=linux-centos8-aarch64
            ^openssl@1.1.1j%gcc@8.4.1~docs+systemcerts arch=linux-centos8-aarch64
                ^perl@5.32.1%gcc@8.4.1+cpanm+shared+threads arch=linux-centos8-aarch64
                    ^berkeley-db@18.1.40%gcc@8.4.1~docs patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=linux-centos8-aarch64
                    ^gdbm@1.18.1%gcc@8.4.1 arch=linux-centos8-aarch64
                        ^readline@8.0%gcc@8.4.1 arch=linux-centos8-aarch64
                            ^ncurses@6.2%gcc@8.4.1~symlinks+termlib arch=linux-centos8-aarch64
                                ^pkgconf@1.7.3%gcc@8.4.1 arch=linux-centos8-aarch64
                ^zlib@1.2.11%gcc@8.4.1+optimize+pic+shared arch=linux-centos8-aarch64
        ^icu4c@67.1%gcc@8.4.1 cxxstd=11 arch=linux-centos8-aarch64
            ^python@3.8.8%gcc@8.4.1+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=linux-centos8-aarch64
                ^expat@2.2.10%gcc@8.4.1+libbsd arch=linux-centos8-aarch64
                    ^libbsd@0.10.0%gcc@8.4.1 arch=linux-centos8-aarch64
                ^gettext@0.21%gcc@8.4.1+bzip2+curses+git~libunistring+libxml2+tar+xz arch=linux-centos8-aarch64
                    ^libxml2@2.9.10%gcc@8.4.1~python arch=linux-centos8-aarch64
                        ^xz@5.2.5%gcc@8.4.1~pic arch=linux-centos8-aarch64
                    ^tar@1.32%gcc@8.4.1 arch=linux-centos8-aarch64
                ^libffi@3.3%gcc@8.4.1 patches=26f26c6f29a7ce9bf370ad3ab2610f99365b4bdd7b82e7c31df41a3370d685c0 arch=linux-centos8-aarch64
                ^sqlite@3.34.0%gcc@8.4.1+column_metadata+fts~functions~rtree arch=linux-centos8-aarch64
                ^util-linux-uuid@2.36%gcc@8.4.1 arch=linux-centos8-aarch64
        ^openjdk@11.0.0-2020-01-01%gcc@8.4.1 arch=linux-centos8-aarch64
        ^pcre2@10.35%gcc@8.4.1~jit+multibyte arch=linux-centos8-aarch64

Can you tell me why this is happening: Error: attempt to set an attribute on NULL, whether this is related to the version of r

The same error occurs on centos8_aarch64 and centos8_x86_64.

The same error occurs on centos8_aarch64 and centos8_x86_64.

I don't know what spack is or how that stuff is running ...

PROJ (this package) is currently non-functional, sadly - it exists in this degenerate state to allow {reproj} to continue to work, that package just uses {proj4} - soon I will move to using {libproj}, with {proj4} as a fall-back

Can you tell me your reliance on {PROJ}, where that comes from? i.e. what code are you trying to use that needs {PROJ}?

@mdsumner I don't have a spack installation right now, I use the normal R package environment as follows:

[root@localhost 9]# wget https://cloud.r-project.org/src/contrib/PROJ_0.4.0.tar.gz
[root@localhost 9]# tar -zxvf PROJ_0.4.0.tar.gz
[root@localhost 9]# cd PROJ/tests
[root@localhost tests]# ls
spelling.R  testthat  testthat.R
[root@localhost tests]# R

R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-redhat-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.

>install.packages("PROJ")
trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/PROJ_0.4.0.tar.gz'
Content type 'application/octet-stream' length 136201 bytes (133 KB)
==================================================
downloaded 133 KB

* installing *source* package ‘PROJ’ ...
** package ‘PROJ’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/include/R" -DNDEBUG -DHAVE_PROJ6_API=0  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection  -c C_proj_crs_text.c -o C_proj_crs_text.o
gcc -I"/usr/include/R" -DNDEBUG -DHAVE_PROJ6_API=0  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection  -c C_proj_trans.c -o C_proj_trans.o
gcc -I"/usr/include/R" -DNDEBUG -DHAVE_PROJ6_API=0  -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fasynchronous-unwind-tables -fstack-clash-protection  -c init.c -o init.o
gcc -shared -L/usr/lib64/R/lib -Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o PROJ.so C_proj_crs_text.o C_proj_trans.o init.o -L/usr/lib64/R/lib -lR
installing to /usr/lib64/R/library/00LOCK-PROJ/00new/PROJ/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘PROJ’
    finding HTML links ... done
    PROJ-package                            html
    ok_proj6                                html
    proj_crs_text                           html
    proj_trans                              html
    xymap                                   html
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (PROJ)
Making 'packages.html' ... done

The downloaded source packages are in
        ‘/tmp/RtmpjyRZDW/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
>install.packages("testthat")
also installing the dependencies ‘utf8’, ‘pillar’, ‘pkgconfig’, ‘vctrs’, ‘glue’, ‘rprojroot’, ‘rstudioapi’, ‘diffobj’, ‘fansi’, ‘rematch2’, ‘tibble’, ‘brio’, ‘callr’, ‘cli’, ‘crayon’, ‘desc’, ‘digest’, ‘ellipsis’, ‘evaluate’, ‘jsonlite’, ‘lifecycle’, ‘magrittr’, ‘pkgload’, ‘praise’, ‘processx’, ‘ps’, ‘R6’, ‘rlang’, ‘waldo’, ‘withr’

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/utf8_1.2.2.tar.gz'
Content type 'application/octet-stream' length 240327 bytes (234 KB)
==================================================
downloaded 234 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/pillar_1.6.3.tar.gz'
Content type 'application/octet-stream' length 1130236 bytes (1.1 MB)
==================================================
downloaded 1.1 MB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/pkgconfig_2.0.3.tar.gz'
Content type 'application/octet-stream' length 6080 bytes
==================================================
downloaded 6080 bytes

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/vctrs_0.3.8.tar.gz'
Content type 'application/octet-stream' length 782608 bytes (764 KB)
==================================================
downloaded 764 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/glue_1.4.2.tar.gz'
Content type 'application/octet-stream' length 99049 bytes (96 KB)
==================================================
downloaded 96 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/rprojroot_2.0.2.tar.gz'
Content type 'application/octet-stream' length 59967 bytes (58 KB)
==================================================
downloaded 58 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/rstudioapi_0.13.tar.gz'
Content type 'application/octet-stream' length 110472 bytes (107 KB)
==================================================
downloaded 107 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/diffobj_0.3.5.tar.gz'
Content type 'application/octet-stream' length 479276 bytes (468 KB)
==================================================
downloaded 468 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/fansi_0.5.0.tar.gz'
Content type 'application/octet-stream' length 301724 bytes (294 KB)
==================================================
downloaded 294 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/rematch2_2.1.2.tar.gz'
Content type 'application/octet-stream' length 13366 bytes (13 KB)
==================================================
downloaded 13 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/tibble_3.1.5.tar.gz'
Content type 'application/octet-stream' length 739036 bytes (721 KB)
==================================================
downloaded 721 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/brio_1.1.2.tar.gz'
Content type 'application/octet-stream' length 12069 bytes (11 KB)
==================================================
downloaded 11 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/callr_3.7.0.tar.gz'
Content type 'application/octet-stream' length 74518 bytes (72 KB)
==================================================
downloaded 72 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/cli_3.0.1.tar.gz'
Content type 'application/octet-stream' length 225589 bytes (220 KB)
==================================================
downloaded 220 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/crayon_1.4.1.tar.gz'
Content type 'application/octet-stream' length 35769 bytes (34 KB)
==================================================
downloaded 34 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/desc_1.4.0.tar.gz'
Content type 'application/octet-stream' length 295610 bytes (288 KB)
==================================================
downloaded 288 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/digest_0.6.28.tar.gz'
Content type 'application/octet-stream' length 165073 bytes (161 KB)
==================================================
downloaded 161 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/ellipsis_0.3.2.tar.gz'
Content type 'application/octet-stream' length 8066 bytes
==================================================
downloaded 8066 bytes

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/evaluate_0.14.tar.gz'
Content type 'application/octet-stream' length 24206 bytes (23 KB)
==================================================
downloaded 23 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/jsonlite_1.7.2.tar.gz'
Content type 'application/octet-stream' length 421716 bytes (411 KB)
==================================================
downloaded 411 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/lifecycle_1.0.1.tar.gz'
Content type 'application/octet-stream' length 99716 bytes (97 KB)
==================================================
downloaded 97 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/magrittr_2.0.1.tar.gz'
Content type 'application/octet-stream' length 265580 bytes (259 KB)
==================================================
downloaded 259 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/pkgload_1.2.2.tar.gz'
Content type 'application/octet-stream' length 60570 bytes (59 KB)
==================================================
downloaded 59 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/praise_1.0.0.tar.gz'
Content type 'application/octet-stream' length 6100 bytes
==================================================
downloaded 6100 bytes

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/processx_3.5.2.tar.gz'
Content type 'application/octet-stream' length 141424 bytes (138 KB)
==================================================
downloaded 138 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/ps_1.6.0.tar.gz'
Content type 'application/octet-stream' length 119670 bytes (116 KB)
==================================================
downloaded 116 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/R6_2.5.1.tar.gz'
Content type 'application/octet-stream' length 63422 bytes (61 KB)
==================================================
downloaded 61 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/rlang_0.4.11.tar.gz'
Content type 'application/octet-stream' length 861727 bytes (841 KB)
==================================================
downloaded 841 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/waldo_0.3.1.tar.gz'
Content type 'application/octet-stream' length 33728 bytes (32 KB)
==================================================
downloaded 32 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/withr_2.4.2.tar.gz'
Content type 'application/octet-stream' length 94283 bytes (92 KB)
==================================================
downloaded 92 KB

trying URL 'https://mirrors.sustech.edu.cn/CRAN/src/contrib/testthat_3.1.0.tar.gz'
Content type 'application/octet-stream' length 695232 bytes (678 KB)
==================================================
downloaded 678 KB

* installing *source* package ‘utf8’ ...
** package ‘utf8’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
……
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (testthat)
Making 'packages.html' ... done

The downloaded source packages are in
        ‘/tmp/RtmpxAaQMy/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
[root@localhost tests]# Rscript testthat.R
══ Failed tests ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
── Error (test-no-crash.R:11:3): out of bounds works ───────────────────────────
Error in `names(out) <- c("x_", "y_")`: attempt to set an attribute on NULL
Backtrace:

  1. ├─testthat::expect_output(...) test-no-crash.R:11:2
  2. │ └─testthat:::quasi_capture(...)
  3. │   ├─testthat:::.capture(...)
  4. │   │ └─testthat::capture_output_lines(code, print, width = width)
  5. │   │   └─testthat:::eval_with_output(code, print = print, width = width)
  6. │   │     ├─withr::with_output_sink(temp, withVisible(code))
  7. │   │     │ └─base::force(code)
  8. │   │     └─base::withVisible(code)
  9. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 10. └─PROJ::proj_trans(x, target, source = source) test-no-crash.R:13:4
── Error (test-PROJ.R:11:3): PROJ works ────────────────────────────────────────
Error in `names(out) <- c("x_", "y_", "z_", "t_")`: attempt to set an attribute on NULL
Backtrace:

 1. ├─testthat::expect_silent(...) test-PROJ.R:11:2
 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
 3. │   ├─testthat:::.capture(...)
 4. │   │ ├─withr::with_output_sink(...)
 5. │   │ │ └─base::force(code)
 6. │   │ ├─base::withCallingHandlers(...)
 7. │   │ └─base::withVisible(code)
 8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 9. └─PROJ::proj_trans(...)
── Error (test-sanity-inputs.R:16:3): input checks work ───────────────────────────
Error in `names(out) <- c("x_", "y_")`: attempt to set an attribute on NULL
Backtrace:

 1. ├─testthat::expect_silent(...) test-sanity-inputs.R:16:2
 2. │ └─testthat:::quasi_capture(enquo(object), NULL, evaluate_promise)
 3. │   ├─testthat:::.capture(...)
 4. │   │ ├─withr::with_output_sink(...)
 5. │   │ │ └─base::force(code)
 6. │   │ ├─base::withCallingHandlers(...)
 7. │   │ └─base::withVisible(code)
 8. │   └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
 9. └─PROJ::proj_trans(data.frame(lon, lat), dst, source = llproj)

[ FAIL 3 | WARN 0 | SKIP 0 | PASS 5 ]
Error: Test failures
Execution halted

But the same mistakes happen.All the dependency packages I installed are installed in the R environment.

ok I'll have a look at why tests are failing but essentially you can't test it that way (via Rscript)

can you answer my q about what you want PROJ for? it's not functional ...

@mdsumner I'm trying to test proj's functionality, if I don't use Rscript to test it, is there any way to test PROJ's functionality?

I don't know why you want to, it's currently in stasis and doesn't have functionality. I'll soon move to using {libproj} but if my package PROJ is causing you problems I'm trying to understand the context of that 🐱

I know what you mean, at the moment it's currently in stasis and doesn't have functionality, so I need to use the README.md example to test its usage, which has proved to be a really effective solution, and I've been doing it. I've closed this issuse. I'm looking forward to finding out more.