Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two test cases in test-norm_matrix_range fail on PowerPC: identical s not TRUE #27

Closed
barracuda156 opened this issue May 12, 2023 · 9 comments

Comments

@barracuda156
Copy link


R version 4.3.0 (2023-04-21) -- "Already Tomorrow"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.8.0 (32-bit)

> library(testthat)
> library(OpenImageR)
> 
> test_check("OpenImageR")

time to complete : 0.02877498 secs 


time to complete : 0.07839799 secs 


time to complete : 0.07635784 secs 


time to complete : 0.07683992 secs 


time to complete : 0.0934062 secs 


time to complete : 0.03983188 secs 


time to complete : 0.002266169 secs 


time to complete : 0.002430916 secs 


time to complete : 0.002615929 secs 


time to complete : 0.007539034 secs 


time to complete : 0.007990122 secs 


time to complete : 0.02551007 secs 


time to complete : 0.01876593 secs 


time to complete : 0.01910877 secs 


time to complete : 0.0005300045 secs 


time to complete : 0.0005509853 secs 


time to complete : 0.0006461143 secs 


time to complete : 0.0005779266 secs 


time to complete : 0.004445076 secs 


time to complete : 0.005106926 secs 


time to complete : 0.009553909 secs 


time to complete : 0.01069307 secs 


time to complete : 0.01310706 secs 


time to complete : 0.0002708435 secs 

[ FAIL 2 | WARN 12 | SKIP 0 | PASS 366 ]

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-norm_matrix_range.R:61:3'): the 'norm_matrix_range' returns the correct output ( range = c(-1,1) ) ──
identical(res, np_res) is not TRUE

`actual`:   FALSE
`expected`: TRUE 
── Failure ('test-norm_matrix_range.R:70:3'): the 'norm_matrix_range' returns the correct output ( range = c(0,255) ) ──
identical(res, np_res_255) is not TRUE

`actual`:   FALSE
`expected`: TRUE 

[ FAIL 2 | WARN 12 | SKIP 0 | PASS 366 ]
Error: Test failures
Execution halted
@mlampros
Copy link
Owner

the current version of OpenImageR (1.2.8) passes all tests on CRAN for all three operating systems (Linux, Mac OSX, Windows). Which version of OpenImageR you use and for which operating system?

@barracuda156
Copy link
Author

the current version of OpenImageR (1.2.8) passes all tests on CRAN for all three operating systems (Linux, Mac OSX, Windows). Which version of OpenImageR you use and for which operating system?

CRAN tests are pretty useless to test anything but a few mainstream OS versions.

This is 1.2.8 on 10.6.8 Rosetta (so ppc32); R 4.3.0, gcc 12.2.0.

@mlampros
Copy link
Owner

I took a look because I'm not familiar with Power PC's (if this is meant by 'ppc32')
It seems you work on snow leopard (as the version 10.6.8 is an updated version of Mac OSx 10.6)
I use both the CRAN checks and Github actions for the tests and try to fix errors related to the Operating systems supported from cran and github actions. Currently on CRAN it seems that the following ac OSX versions are checked:

  • 11.6.7
  • 13.3
  • 11.3
  • 10.13.6 (old release)

It's not easy to check besides the various operating systems also specific versions of hardware and most of the times besides testing and checking locally I use also R-hub

@barracuda156
Copy link
Author

It may be hard to emulate 10.5 or 10.6 ppc (unless you use a VM, then Rosetta allows building and running ppc binaries, or otherwise have an 2010–2012 Mac to install 10.6.8), but Linux on ppc 32-bit should be possible via GH actions or similar setups. (Theoretically, Qemu should emulate the arch, but I have no experience here and dunno how well that works. Rosetta in VM works fine for the most development tasks, exceptions are there, but irrelevant to our case.)

But I realise this may be a pain to deal with. I can do testing on my end, if you could suggest to try something.

@mlampros
Copy link
Owner

the 2 test cases that fail seem to be related to rounding differences between the operating systems

testthat::test_that("the 'norm_matrix_range' returns the correct output ( range = c(-1,1) )", {
  
  # rounded to 8 digits as in np$interp()
  res = round(norm_matrix_range(mt, min_value = MIN, max_value = MAX), 8)

  testthat::expect_true(identical(res, np_res))
})


testthat::test_that("the 'norm_matrix_range' returns the correct output ( range = c(0,255) )", {
  
  # rounded to 8 digits as in np$interp()
  res = round(norm_matrix_range(mt, min_value = MIN_, max_value = MAX_), 8)
  
  testthat::expect_true(identical(res, np_res_255))
})

I can add an exception for these 2 test cases for your OS and arch. Can you show me what you receive when you run the following in R or Rstudio (exclude any personal info if printed in the console)?

str(.Platform)
Sys.info()[c("sysname", "release", "version", "machine")]
str(version)

Normally, these exceptions are discouraged on CRAN but I think it's acceptable for cases as yours

@barracuda156
Copy link
Author

@mlampros Here is the output on 10.6.8:

> str(.Platform)
List of 8
 $ OS.type   : chr "unix"
 $ file.sep  : chr "/"
 $ dynlib.ext: chr ".so"
 $ GUI       : chr "X11"
 $ endian    : chr "big"
 $ pkgType   : chr "source"
 $ path.sep  : chr ":"
 $ r_arch    : chr ""
> Sys.info()[c("sysname", "release", "version", "machine")]
                                                                                          sysname 
                                                                                         "Darwin" 
                                                                                          release 
                                                                                         "10.8.0" 
                                                                                          version 
"Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64" 
                                                                                          machine 
                                                                                "Power Macintosh" 
> str(version)
List of 14
 $ platform      : chr "powerpc-apple-darwin10.8.0"
 $ arch          : chr "powerpc"
 $ os            : chr "darwin10.8.0"
 $ system        : chr "powerpc, darwin10.8.0"
 $ status        : chr ""
 $ major         : chr "4"
 $ minor         : chr "3.0"
 $ year          : chr "2023"
 $ month         : chr "04"
 $ day           : chr "21"
 $ svn rev       : chr "84292"
 $ language      : chr "R"
 $ version.string: chr "R version 4.3.0 (2023-04-21)"
 $ nickname      : chr "Already Tomorrow"
 - attr(*, "class")= chr "simple.list"

There are four relevant PPC cases on macOS: 10.4.11, 10.5.8, 10.6 ppc (10A190) and 10.6.8 Rosetta.
These will be:

powerpc-apple-darwin8.11.0
powerpc-apple-darwin9.8.0
powerpc-apple-darwin10.0.0d2
powerpc-apple-darwin10.8.0

@mlampros
Copy link
Owner

I added an exception in the test-file for the case of a Mac OSx Power-pc
Can you install the updated OpenImageR version using

remotes::install_github('mlampros/OpenImageR', dependencies = TRUE)

and confirm that it works for you as well

@barracuda156
Copy link
Author

@mlampros Thank you, yes:

* building ‘OpenImageR_1.2.9.tar.gz’

--->  Building R-OpenImageR
--->  Testing R-OpenImageR
* using log directory ‘/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_R_R-OpenImageR/R-OpenImageR/work/OpenImageR-402eab6c78945ca904ab8631095988964215a2db/OpenImageR.Rcheck’
* using R version 4.3.0 (2023-04-21)
* using platform: powerpc-apple-darwin10.8.0 (32-bit)
* R was compiled by
    gcc-mp-12 (MacPorts gcc12 12.2.0_2) 12.2.0
    GNU Fortran (MacPorts gcc12 12.2.0_2) 12.2.0
* running under: OS X Snow Leopard 10.6.8
* using session charset: UTF-8
* checking for file ‘OpenImageR/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘OpenImageR’ version ‘1.2.9’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* 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 ‘OpenImageR’ can be installed ... OK
* used C compiler: ‘gcc-mp-12 (MacPorts gcc12 12.2.0_2) 12.2.0’
* used C++ compiler: ‘g++-mp-12 (MacPorts gcc12 12.2.0_2) 12.2.0’
* used SDK: ‘NA’‘NA’‘NA’‘NA’‘NA’‘NA’
* checking installed package size ... OK
* checking package 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 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 ... OK
* 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 C/C++/Fortran sources/headers ... OK
* checking line endings in Makefiles ... OK
* checking compilation flags in Makevars ... OK
* 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 files in ‘vignettes’ ... WARNING
Files in the 'vignettes' directory but no files in 'inst/doc':
  ‘Gabor_Feature_Extraction.Rmd’
  ‘Image_segmentation_superpixels_clustering.Rmd’ ‘TEST_hash/2_1.png’
  ‘TEST_hash/2_2.png’ ‘TEST_hash/2_3.png’ ‘TEST_hash/4_1.png’
  ‘TEST_hash/4_2.png’ ‘TEST_hash/4_3.png’ ‘TEST_hash/5_1.png’
  ‘TEST_hash/5_2.png’ ‘TEST_hash/5_3.png’ ‘TEST_hash/8_1.png’
  ‘TEST_hash/8_2.png’ ‘TEST_hash/8_3.png’ ‘TEST_hash/9_1.png’
  ‘TEST_hash/9_2.png’ ‘TEST_hash/9_3.png’ ‘The_OpenImageR_package.Rmd’
  ‘Warp_Affine.Rmd’ ‘vignette_1/image1.jpeg’ ‘vignette_1/image2.jpg’
  ‘vignette_1/view1.jpg’ ‘vignette_1/view2.jpg’ ‘vignette_1/view3.jpg’
  ‘vignette_2/car.png’ ‘vignette_2/gabor_car.png’
  ‘vignette_2/gabor_car_thresholding.png’
  ‘vignette_2/gabor_filter_bank.png’ ‘vignette_3/BSR_bsds500_image.jpg’
  ‘vignette_3/BSR_bsds500_segmentation.png’ ‘vignette_3/airplane.jpg’
  ‘vignette_3/im_masks.png’ ‘vignette_3/segment_AP.png’
  ‘vignette_3/segment_kmeans.png’ ‘vignette_3/segment_mbkm.png’
  ‘vignette_3/slic_vs_slico.png’
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘testthat.R’
 OK
* checking for unstated dependencies in vignettes ... OK

@mlampros
Copy link
Owner

Thank you too for making me aware of this issue. In the next days I'll submit the updated version to CRAN.
Feel free to re-open the issue if the code does not work as expected

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

No branches or pull requests

2 participants