0.8-3: Tests fail
nunotexbsd opened this issue · 8 comments
Tests failure on FreeBSD14/R4.3.1
Port: https://www.freshports.org/math/R-cran-units/
CRAN_DEPENDS= R-cran-Rcpp>=0.12.10:devel/R-cran-Rcpp
BUILD_DEPENDS= ${CRAN_DEPENDS}
LIB_DEPENDS= libudunits2.so:science/udunits
RUN_DEPENDS= ${CRAN_DEPENDS}
TEST_DEPENDS= R-cran-testthat>0:devel/R-cran-testthat
* using log directory '/wrkdirs/usr/ports/math/R-cran-units/work/units.Rcheck'
* using R version 4.3.1 (2023-06-16)
* using platform: amd64-portbld-freebsd14.0 (64-bit)
* R was compiled by
FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)
GNU Fortran (FreeBSD Ports Collection) 12.2.0
* running under: FreeBSD 14amd64-main 14.0-ALPHA1 FreeBSD 14.0-ALPHA1 1400094 amd64
* using session charset: ASCII
* using options '--no-manual --no-build-vignettes'
* checking for file 'units/DESCRIPTION' ... OK
* this is package 'units' version '0.8-3'
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... NOTE
Packages suggested but not available for checking:
'NISTunits', 'measurements', 'xml2', 'dplyr', 'ggplot2', 'vdiffr',
'rmarkdown'
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package 'units' can be installed ... OK
* used C++ compiler: 'FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)'
* checking installed package size ... OK
* checking package directory ... OK
* checking 'build' directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking startup messages can be suppressed ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... NOTE
Package unavailable to check Rd xrefs: 'ggplot2'
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking line endings in shell scripts ... OK
* checking line endings in C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... NOTE
Package has both 'src/Makevars.in' and 'src/Makevars'.
Installation with --no-configure' is unlikely to work. If you intended
'src/Makevars' to be used on Windows, rename it to 'src/Makevars.win'
otherwise remove it. If 'configure' created 'src/Makevars', you need a
'cleanup' script.
* checking for GNU extensions in Makefiles ... OK
* checking for portable use of $(BLAS_LIBS) and $(LAPACK_LIBS) ... OK
* checking use of PKG_*FLAGS in Makefiles ... OK
* checking compiled code ... OK
* checking installed files from 'inst/doc' ... OK
* checking files in 'vignettes' ... OK
* checking examples ... OK
* checking for unstated dependencies in 'tests' ... OK
* checking tests ... ERROR
Running 'testthat.R'
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
* plot/ggplot2-nolab.svg
* plot/ggplot2-transformed.svg
* plot/plot-boxplot.svg
* plot/plot-default.svg
* plot/plot-degree-c.svg
* plot/plot-division.svg
* plot/plot-hist.svg
* plot/plot-inverse.svg
* plot/plot-lab.svg
* plot/plot-line.svg
* plot/plot-nothing.svg
* plot/plot-npower.svg
* plot/plot-parentheses.svg
Error: Test failures
Execution halted
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in 'inst/doc' ... OK
* checking running R code from vignettes ... NONE
'measurement_units_in_R.Rmd' using 'UTF-8'... OK
'units.Rmd' using 'UTF-8'... OK
* checking re-building of vignette outputs ... SKIPPED
* DONE
Status: 1 ERROR, 3 NOTEs
Any clues?
Thanks
No clue as to what could be failing, because we are OK on CRAN.
- Was the previous version ok?
- Could you please provide the full logs from the check?
- Or is there any link to see them online?
- Or could you please provide a vagrant file to reproduce this?
- Was the previous version ok?
No - Could you please provide the full logs from the check?
yes - Or is there any link to see them online?
https://people.freebsd.org/~eduardo/logs/units.Rcheck/ - Or could you please provide a vagrant file to reproduce this?
I'm new to vagrant but FreeBSD supports it:
Hashicorp/Atlas® Vagrant™:
Instances can be deployed using the vagrant utility:
% vagrant init freebsd/FreeBSD-13.2-RELEASE
% vagrant up
From testthat.Rout.fail:
== Failed tests ================================================================
-- Failure ('test_math.R:60:3'): we can take logarithms units ------------------
units(log1p(ux)) (`actual`) not equal to units(as_units("ln(re 1 m)", force_single_symbol = TRUE)) (`expected`).
`actual$numerator`: "1 ln(re 1 m)"
`expected$numerator`: "ln(re 1 m)"
-- Failure ('test_math.R:63:3'): we can take logarithms units ------------------
units(log(ux)) (`actual`) not equal to units(as_units("ln(re 1 m)", force_single_symbol = TRUE)) (`expected`).
`actual$numerator`: "1 ln(re 1 m)"
`expected$numerator`: "ln(re 1 m)"
[ FAIL 2 | WARN 0 | SKIP 11 | PASS 439 ]
Could you please run the following and report the output?
#include <stdio.h>
#include <math.h>
#include <udunits2/udunits2.h>
int main() {
ut_set_error_message_handler((ut_error_message_handler) ut_ignore);
ut_system *sys = ut_read_xml(NULL);
ut_encoding enc = UT_UTF8;
ut_set_error_message_handler((ut_error_message_handler) vprintf);
ut_unit *meter = ut_parse(sys, "1 m", enc);
ut_unit *logmeter = ut_log(exp(1), meter);
char out[128];
ut_format(logmeter, out, sizeof(out), enc);
printf("%s\n", out);
ut_free(meter);
ut_free(logmeter);
ut_free_system(sys);
return 0;
}
Save this as test.c
and then
$ gcc test.c -l udunits2 && ./a.out
ln(re 1 m)
(...)
Forgot to add -l udunits2
Changed #include <udunits2/udunits2.h>
to #include <udunits2.h>
It compiles without any warning and ./a.out
gives result: ln(re 1 m)
It fails with clang with a core dump:
clang test.c -shared -L/usr/local/lib/R/lib -Wl,-rpath=/usr/local/lib/gcc12 -L/usr/local/lib/gcc12 -B/usr/local/bin -L/usr/local/lib -I/usr/local/include -ludunits2
./a.out: Segmentation fault (core dumped)
Maybe the problem is from clang?
I'm a little bit confused but it seems that FreeBSD ports framework uses clang + gcc fortran for compiling for what I see in package build log:
using C++ compiler: 'FreeBSD clang version 16.0.6 (https://github.com/llvm/llvm-project.git llvmorg-16.0.6-0-g7cbf1a259152)'
gmake[1]: Entering directory '/wrkdirs/usr/ports/math/R-cran-units/work/units/src'
c++ -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -DUDUNITS2_DIR=0 -DLIBICONV_PLUG -I/usr/local/include -isystem /usr/local/include -I'/usr/local/lib/R/library/Rcpp/include' -DLIBICONV_PLUG -I/usr/local/in
clude -isystem /usr/local/include -fpic -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DLIBICONV_PLUG -isystem /usr/local/include -c RcppExports.cpp -o
RcppExports.o
c++ -std=gnu++17 -I"/usr/local/lib/R/include" -DNDEBUG -DUDUNITS2_DIR=0 -DLIBICONV_PLUG -I/usr/local/include -isystem /usr/local/include -I'/usr/local/lib/R/library/Rcpp/include' -DLIBICONV_PLUG -I/usr/local/in
clude -isystem /usr/local/include -fpic -O2 -pipe -DLIBICONV_PLUG -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -DLIBICONV_PLUG -isystem /usr/local/include -c udunits.cpp -o udu
nits.o
c++ -std=gnu++17 -shared -L/usr/local/lib/R/lib -Wl,-rpath=/usr/local/lib/gcc12 -L/usr/local/lib/gcc12 -B/usr/local/bin -L/usr/local/lib -fstack-protector-strong -o units.so RcppExports.o udunits.o -lexpat -lexpa
t -ludunits2 -L/usr/local/lib/R/lib -lR
gmake[1]: Leaving directory '/wrkdirs/usr/ports/math/R-cran-units/work/units/src'
installing to /wrkdirs/usr/ports/math/R-cran-units/work/stage/usr/local/lib/R/library/00LOCK-units/00new/units/libs
We are compiling a program in my example above, not a shared library, so -shared
shouldn't be added. With clang, try
$ clang test.c -ludunits2 -lm && ./a.out
ln(re 1 m)
I spinned a FreeBSD 14 virtual machine using the official qcow2 image, and I see:
$ clang test.c -ludunits2 -lm -I/usr/local/include -L/usr/local/lib && ./a.out
1 ln(re 1 m)
So this may be an upstream bug in udunits2, because in all the other platforms (and other bases within the same platform) do not show that leading 1
. I suggest to submit this upstream, and we can close this.
units
works just fine, with or without that 1
. And as said, all checks are ok on CRAN. So meanwhile you can safely skip those two tests in FreeBSD.
In fact,
$ gcc12 test.c -ludunits2 -lm -I/usr/local/include -L/usr/local/lib && ./a.out
ln(re 1 m)
produces the correct output in FreeBSD, and clang-16 does too on Linux. So... it may be some issue with FreeBSD's clang... I don't know, but units
seems to be ok.