Skip to content

1.16.0 testunit fails #6559

Closed
Closed

Description

@nunotexbsd

testunit from previous version 1.15.4 is OK.

> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: amd64-portbld-freebsd15.0
Running under: FreeBSD 15amd64-main 15.0-CURRENT FreeBSD 15.0-CURRENT 1500023 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.1
<snip>
* checking examples ... OK
* checking for unstated dependencies in 'tests' ... OK
* checking tests ...
  Running 'S4.R'
  Running 'autoprint.R'
  Comparing 'autoprint.Rout' to 'autoprint.Rout.save' ... OK
  Running 'froll.R'
  Running 'knitr.R'
  Comparing 'knitr.Rout' to 'knitr.Rout.save' ... OK
  Running 'main.R'
 ERROR
Running the tests in 'tests/main.R' failed.
Last 13 lines of output:
     0.000s ( 24%) Rereading 1 columns due to out-of-sample type exceptions
     0.000s        Total
  Column 1 <<A>> bumped from 'int32' to 'int64' due to <<123456789123456>> on row 114
            A           B
  "integer64"   "integer"
  Test 2266 produced 1 errors but expected 0
  Expected:
  Observed: no documentation of type 'a' and topic 'o' (or error in processing help)
  Error in eval(exprs[i], envir) : object 'tmp2' not found

  Mon Oct  7 12:28:45 2024  endian==little, sizeof(long double)==16, longdouble.digits==64, sizeof(pointer)==8, TZ==unset, Sys.timezone()=='Europe/Lisbon', Sys.getlocale()=='C', l10n_info()=='MBCS=FALSE; UTF-8=FALSE; Latin-1=FALSE; codeset=US-ASCII', getDTthreads()=='This installation of data.table has not been compiled with OpenMP support.; omp_get_num_procs()==1; R_DATATABLE_NUM_PROCS_PERCENT==unset (default 50); R_DATATABLE_NUM_THREADS==unset; R_DATATABLE_THROTTLE==unset (default 1024); omp_get_thread_limit()==1; omp_get_max_threads()==1; OMP_THREAD_LIMIT==unset; OMP_NUM_THREADS==unset; RestoreAfterFork==true; data.table is using 1 threads with throttle==1024. See ?setDTthreads.', .libPaths()=='/wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck','/usr/local/lib/R/library', zlibVersion()==1.3.1 ZLIB_VERSION==1.3.1
  Error in test.data.table() :
    Failed in 20.2s elapsed (19.4s cpu) after test 2273.3 before the next test() call in /wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck/data.table/tests/tests.Rraw.bz2
  Calls: test.data.table -> stopf -> raise_condition -> signal
  Execution halted
* checking package vignettes ... NOTE
Package has 'vignettes' subdirectory but apparently no vignettes.
Perhaps the 'VignetteBuilder' information is missing from the
DESCRIPTION file?
* DONE

Status: 1 ERROR, 1 WARNING, 3 NOTEs
See
  '/wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck/00check.log'
for details.

*** Error code 1

Any clues?
Thanks

Activity

  1. ben-schwen commented on Oct 7, 2024

    @ben-schwen
    Member

    Thanks for the report. Could you check whether the error still exists with the dev version? Updating to dev can be done with data.table::update_dev_pkg()

    And could you also post the output of

    native_ano = iconv("a\U00F1o", "UTF-8", "")
    str(native_ano)
    .Internal(inspect(native_ano))
  2. MichaelChirico commented on Oct 7, 2024

    @MichaelChirico
    Member

    Based on this:

    Failed in 20.2s elapsed (19.4s cpu) after test 2273.3 before the next test() call in /wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck/data.table/tests/tests.Rraw.bz2

    I guess it's b73d4e9 (i.e., fixed in dev)

    You might be able to fix it without updating to dev {data.table} by installing {R.utils} and re-trying.

  3. nunotexbsd commented on Oct 7, 2024

    @nunotexbsd
    Author

    @ben-schwen

    > native_ano = iconv("a\U00F1o", "UTF-8", "")
    str(native_ano)
    .Internal(inspect(native_ano))
     chr "año"
    @2160dad18d58 16 STRSXP g0c1 [REF(1)] (len=1, tl=0)
      @2160d9cc5270 09 CHARSXP g0c1 [REF(3),gp=0x28] [UTF8] [cached] "año"
    
  4. nunotexbsd commented on Oct 7, 2024

    @nunotexbsd
    Author

    @MichaelChirico

    I have added R.utils to test depends but error is same.
    I will try devel and put results here.

    BTW, I'm maintaining FreeBSD port: https://www.freshports.org/devel/R-cran-data.table/

  5. nunotexbsd commented on Oct 8, 2024

    @nunotexbsd
    Author

    Ok, I think I found the problem. OpenMP detection not working as in macports:
    https://github.com/macports/macports-ports/blob/99af437d1f41eb15874f926020fdcf39356a7ab2/R/R-data.table/Portfile#L23

    And only now I did found it on my build logs:

    <...>
    ===>   Generating temporary packing list
    * installing *source* package 'data.table' ...
    ** package 'data.table' successfully unpacked and MD5 sums checked
    ** using staged installation
    zlib 1.3.1 is available ok
    ***
    *** OpenMP not supported! data.table uses OpenMP to automatically
    ***   parallelize operations like sorting, grouping, file reading, etc.
    *** For details on how to install the necessary toolchains on your OS see:
    ***   https://github.com/Rdatatable/data.table/wiki/Installation
    *** Continuing installation without OpenMP support...
    ***
    ** libs
    <...>
    

    and included in above unittest log:
    getDTthreads()=='This installation of data.table has not been compiled with OpenMP support.

    I will try to enable OpenMP and check tests.

  6. nunotexbsd commented on Oct 8, 2024

    @nunotexbsd
    Author

    I will close this PR as problem is deeper that I thought. I will take care of OpenMP support first and the check further tests.

    A quick patch shows that I can build package with OpenMP:

    --- configure.orig      2024-10-08 08:42:43 UTC
    +++ configure
    @@ -144,7 +144,17 @@ detect_openmp () {
    
       fi # uname=Darwin
    
    -  # No support for OpenMP available
    +
    +  if [ "$(uname)" = "FreeBSD" ]; then
    +
    +    export PKG_CFLAGS="${PKG_CFLAGS}"
    +    export PKG_LIBS="${PKG_LIBS}"
    +    export R_OPENMP_ENABLED=1
    +    return
    +
    +  fi # uname=FreeBSD
    +
    + # No support for OpenMP available
       export R_OPENMP_ENABLED=0
     }

    But it needs better testing.

    Thanks all for help.

  7. aitap commented on Oct 8, 2024

    @aitap
    Member
    locale:
    [1] C.UTF-8/C.UTF-8/C.UTF-8/C/C.UTF-8/C.UTF-8
    
    Test 2266 produced 1 errors but expected 0
      Expected:
      Observed: no documentation of type 'a' and topic 'o' (or error in processing help)
    

    Is there a chance that your unit test environment is running with LC_ALL=C instead of LC_ALL=C.UTF-8? It looks like on FreeBSD with LC_ALL=C in action, iconv("a\U00F1o", "UTF-8", "") returns "a?o" (which gets parsed as a help request) instead of NA. iconv() just silently succeeds and returns 1 ("one character converted in a nonreversible way").

    For a quick workaround, skip the test if identical(native_ano, 'a?o'). Not sure if R could handle this quirk of FreeBSD's iconv() implementation, but they perform incredible gymnastics to accomodate macOS iconv().

    Edit: looks like one of the macOS problems is the same (cf. R_MACOS_LIBICONV_UNDO_TRANSLITERATION). May be worth raising on R-devel to make sure this will be enabled on FreeBSD.

  8. nunotexbsd commented on Oct 9, 2024

    @nunotexbsd
    Author

    Re-opening since there is nor relation with OpenMP support.

  9. nunotexbsd commented on Oct 11, 2024

    @nunotexbsd
    Author

    I've managed to get 1.16.2 configure to properly detect openmp:

    --- configure.orig      2024-10-11 07:37:20 UTC
    +++ configure
    @@ -84,7 +84,7 @@ detect_openmp () {
    
     detect_openmp () {
    
    -  if [ "$(uname)" = "Linux" ]; then
    +  if [ "$(uname)" = "Linux" ] || [ "$(uname)" = "FreeBSD" ]; then
    
         printf "%s" "* checking if R installation supports OpenMP without any extra hints... "
         if "${R_HOME}/bin/R" CMD SHLIB test-omp.c >> config.log 2>&1; then
    

    testunit gives similar results:

    <snip>
    * checking tests ...
      Running 'S4.R'
      Running 'autoprint.R'
      Comparing 'autoprint.Rout' to 'autoprint.Rout.save' ... OK
      Running 'froll.R'
      Running 'knitr.R'
      Comparing 'knitr.Rout' to 'knitr.Rout.save' ... OK
      Running 'main.R'
     ERROR
    Running the tests in 'tests/main.R' failed.
    Last 13 lines of output:
        omp_get_max_threads()          12
        OMP_THREAD_LIMIT               unset
        OMP_NUM_THREADS                unset
        RestoreAfterFork               true
        data.table is using 6 threads with throttle==1024. See ?setDTthreads.
      test.data.table() running: /wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck/data.table/tests/tests.Rraw.bz2
      Test 2266 produced 1 errors but expected 0
      Expected:
      Observed: no documentation of type 'a' and topic 'o' (or error in processing help)
    
      Fri Oct 11 16:16:39 2024  endian==little, sizeof(long double)==16, longdouble.digits==64, sizeof(pointer)==8, TZ==unset, Sys.timezone()=='Europe/Lisbon', Sys.getlocale()=='C', l10n_info()=='MBCS=FALSE; UTF-8=FALSE; Latin-1=FALSE; codeset=US-ASCII', getDTthreads()=='OpenMP version (_OPENMP)==202011; omp_get_num_procs()==12; R_DATATABLE_NUM_PROCS_PERCENT==unset (default 50); R_DATATABLE_NUM_THREADS==unset; R_DATATABLE_THROTTLE==unset (default 1024); omp_get_thread_limit()==2147483647; omp_get_max_threads()==12; OMP_THREAD_LIMIT==unset; OMP_NUM_THREADS==unset; RestoreAfterFork==true; data.table is using 6 threads with throttle==1024. See ?setDTthreads.', .libPaths()=='/wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck','/usr/local/lib/R/library', zlibVersion()==1.3.1 ZLIB_VERSION==1.3.1
      Error in test.data.table() :
        1 error(s) out of 11382. Search tests/tests.Rraw.bz2 for test number(s) 2266. Duration: 29.0s elapsed (00:01:19 cpu).
      Calls: test.data.table -> stopf -> raise_condition -> signal
      Execution halted
    * checking package vignettes ... NOTE
    Package has 'vignettes' subdirectory but apparently no vignettes.
    Perhaps the 'VignetteBuilder' information is missing from the
    DESCRIPTION file?
    * DONE
    
    Status: 1 ERROR, 1 WARNING, 4 NOTEs
    See
      '/wrkdirs/usr/ports/devel/R-cran-data.table/work/data.table.Rcheck/00check.log'
    for details.
    
    *** Error code 1
    

    Can't find a way to skip this test.
    Any hints?

    For a quick workaround, skip the test if identical(native_ano, 'a?o'). Not sure if R could handle this quirk of
    FreeBSD's iconv() implementation, but they perform incredible gymnastics to accomodate macOS iconv().

    Thanks

  10. aitap commented on Oct 11, 2024

    @aitap
    Member

    Can't find a way to skip this test.
    Any hints?

    This is a bug, should be fixed by #6567. Does it help if you apply it locally?

  11. nunotexbsd commented on Oct 11, 2024

    @nunotexbsd
    Author

    Can't find a way to skip this test.
    Any hints?

    This is a bug, should be fixed by #6567. Does it help if you apply it locally?

    I can confirm that it fixes test.
    Thanks

  12. tdhock commented on Oct 17, 2024

    @tdhock
    Member

    hi @nunotexbsd thanks for your detailed analysis.
    if I understand correctly, there were two issues on freebsd.

    the original was about iconv, which was fixed by #6567 so I wonder if this issue can be closed now?

    the other was about openmp, for which you proposed a fix #6559 (comment) if that is right then can you please submit a PR?

  13. tdhock commented on Oct 17, 2024

    @tdhock
    Member

    related to other openmp pr #6497

  14. nunotexbsd commented on Oct 17, 2024

    @nunotexbsd
    Author

    Hello @tdhock

    You can close #6567 as it fixes problem.

    Related to #6559 (comment), I will use a local patch for the time being to be sure that it is the better solution for configure phase and then I will open a PR with a patch.

    Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions