r-lib / ps

R package to query, list, manipulate system processes
https://ps.r-lib.org/
Other
72 stars 18 forks source link

Test errors on macOS 10.6.8 #137

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago
* checking tests ...
  Running ‘testthat.R’
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
         at test-cleanup-reporter.R:211:2
   12. testthat::test_that(...)
         at test-cleanup-reporter.R:216:8
   13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
   14. reporter$start_test(context = reporter$.context, test = test)
   15. ps::ps_open_files(ps_handle())
   16. ps:::not_null(.Call(psll_open_files, p))
    ... and 41 more

  Maximum number of 10 failures reached, some test results may be missing.

  ══ DONE ════════════════════════════════════════════════════════════════════════
  Error: Test failures
  Execution halted
* checking PDF version of manual ... OK
* DONE

Status: 1 ERROR, 1 NOTE

System info: 10.6.8 Rosetta, gcc 12.2.0, R 4.2.2 +builtin_lapack+cairo+gcc12+openmp+recommended+tcltk+x11

P. S. How do I get a detailed output for debugging?

gaborcsardi commented 1 year ago

10.6.8 of what?

barracuda156 commented 1 year ago

10.6.8 of what?

Sorry, thought it to be obvious, macOS 10.6.8.

svacchanda$ sw_vers
ProductName:    Mac OS X Server
ProductVersion: 10.6.8
BuildVersion:   10K549
gaborcsardi commented 1 year ago

macOS 10.6.8 is more than ten years old, and it is just not something that we have the capacity to support. If you have patches to fix things without breaking anything, we can consider them, but otherwise I am sorry to say that you are on your own. :(

barracuda156 commented 1 year ago

macOS 10.6.8 is more than ten years old, and it is just not something that we have the capacity to support. If you have patches to fix things without breaking anything, we can consider them, but otherwise I am sorry to say that you are on your own. :(

@gaborcsardi Could you advise me how to get a proper detailed log with per-case errors? Default log does not offer any useful info on what exactly fails.

P. S. Yes, I can try working on it, I just need to know what fails in particular. In most cases we can fix errors or at least disable functions conditionally, if those are unsupported in SDK and problematic to implement.

gaborcsardi commented 1 year ago

What do you mean by the default log? Did you look at test output in testthat.Rout.fail?

barracuda156 commented 1 year ago

What do you mean by the default log? Did you look at test output in testthat.Rout.fail?

I meant the log produced by R CMD check:

See
  ‘/opt/local/var/macports/build/_opt_PPCRosettaPorts_R_R-ps/R-ps/work/ps-1.7.2/ps.Rcheck/00check.log’
for details.

That one is useless, there is no verbose output in it, just a summary.

I will check for testthat.Rout.fail.

barracuda156 commented 1 year ago

@gaborcsardi Thank you, awesome, I found that one:


R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.8.0 (32-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)
R(19138,0xa0dfb620) malloc: *** error for object 0xa0d51754: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0xa0d517c4: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e52c0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e4928: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e4890: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e48dc: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e47c8: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e46a0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e45c0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e4630: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e44f8: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e5200: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e5380: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e538c: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
R(19138,0xa0dfb620) malloc: *** error for object 0x34e53a8: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
> library(ps)
> 
> if (ps::ps_is_supported() && Sys.getenv("R_COVR", "") != "true" &&
+     Sys.getenv("NOT_CRAN") != "" ) {
+   reporter <- ps::CleanupReporter(testthat::SummaryReporter)$new()
+ } else {
+   reporter <- "summary"
+ }
> 
> if (ps_is_supported()) test_check("ps", reporter = reporter)
cleanup-reporter: 123456789abcdefgh
common: ............................i.....j......k.............SSSSS
connections: lmSnSSSSSSS
finished: S
kill-tree: ....SSSSSSS
linux: 
macos: .....SS
pid-reuse: .....................................................o.pq.rs.tu.vw.xy.zA.B
posix-zombie: .................................C.DE.FG.HI.JK.LM.NO.P.........
posix: ...S......
ps: .
system: ..................
utils: ................
windows: 
winver: ......

══ Skipped ═════════════════════════════════════════════════════════════════════
1. children ('test-common.R:236') - Reason: On CRAN

2. num_fds ('test-common.R:265') - Reason: On CRAN

3. open_files ('test-common.R:281') - Reason: On CRAN

4. interrupt ('test-common.R:298') - Reason: On CRAN

5. cpu affinity ('test-common.R:315') - Reason: On CRAN

6. UNIX sockets with path ('test-connections.R:43') - Reason: socat is not available

7. TCP on loopback ('test-connections.R:81') - Reason: socat is not available

8. UDP ('test-connections.R:115') - Reason: socat is not available

9. UDP on loopback ('test-connections.R:139') - Reason: socat is not available

10. TCP6 ('test-connections.R:172') - Reason: socat is not available

11. TCP6 on loopback ('test-connections.R:193') - Reason: socat is not available

12. UDP6 ('test-connections.R:232') - Reason: Needs working IPv6 connection

13. UDP6 on loopback ('test-connections.R:257') - Reason: socat is not available

14. process already finished ('test-finished.R:3') - Reason: On CRAN

15. kill_tree ('test-kill-tree.R:12') - Reason: On CRAN

16. kill_tree, grandchild ('test-kill-tree.R:59') - Reason: On CRAN

17. kill_tree, orphaned grandchild ('test-kill-tree.R:127') - Reason: On CRAN

18. with_process_cleanup ('test-kill-tree.R:155') - Reason: On CRAN

19. find_tree ('test-kill-tree.R:182') - Reason: On CRAN

20. find_tree, grandchild ('test-kill-tree.R:207') - Reason: On CRAN

21. find_tree, orphaned grandchild ('test-kill-tree.R:255') - Reason: On CRAN

22. cpu_times ('test-macos.R:22') - Reason: On CRAN

23. memory_info ('test-macos.R:42') - Reason: On CRAN

24. username, uids, gids ('test-posix.R:26') - Reason: ps does not work properly

══ Failed ══════════════════════════════════════════════════════════════════════
── 1. Error ('test-cleanup-reporter.R:6'): unit: test, mode: cleanup-fail ──────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:6:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:9:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 2. Error ('test-cleanup-reporter.R:30'): unit: test, multiple processes ─────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:30:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:33:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 3. Error ('test-cleanup-reporter.R:52'): on.exit() works ────────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_success(...)
       at test-cleanup-reporter.R:52:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:55:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 4. Error ('test-cleanup-reporter.R:72'): only report ────────────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:72:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:76:10
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 5. Error ('test-cleanup-reporter.R:93'): only kill ──────────────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::with_reporter(...)
       at test-cleanup-reporter.R:93:2
  6. testthat::test_that(...)
       at test-cleanup-reporter.R:97:8
  7. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
  8. reporter$start_test(context = reporter$.context, test = test)
  9. ps::ps_open_files(ps_handle())
 10. ps:::not_null(.Call(psll_open_files, p))

── 6. Error ('test-cleanup-reporter.R:118'): unit: testsuite ───────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:118:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:123:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 7. Error ('test-cleanup-reporter.R:148'): R connection cleanup, test, close, 
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:148:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:151:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 8. Error ('test-cleanup-reporter.R:169'): R connection cleanup, test, do not 
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:169:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:173:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 9. Error ('test-cleanup-reporter.R:192'): R connection cleanup, test, close, 
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::with_reporter(...)
       at test-cleanup-reporter.R:192:2
  6. testthat::test_that(...)
       at test-cleanup-reporter.R:195:8
  7. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
  8. reporter$start_test(context = reporter$.context, test = test)
  9. ps::ps_open_files(ps_handle())
 10. ps:::not_null(.Call(psll_open_files, p))

── 10. Error ('test-cleanup-reporter.R:211'): R connections, unit: testsuite ───
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:211:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:216:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))
  ... and 41 more

Maximum number of 10 failures reached, some test results may be missing.

══ DONE ════════════════════════════════════════════════════════════════════════
Error: Test failures
Execution halted
gaborcsardi commented 1 year ago

I am afraid that I'll have to close this, we practically can't support 10.6.8.

barracuda156 commented 1 year ago

I am afraid that I'll have to close this, we practically can't support 10.6.8.

@gaborcsardi I apologize, this went forgotten. I have fixed malloc errors since then, will try running tests tonight and update here if the issue got fixed.

barracuda156 commented 1 year ago

@gaborcsardi Okay, malloc errors are not there anymore, but test-cleanup-reporter.R still fails with Error: Operation not supported:

R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: powerpc-apple-darwin10.8.0 (32-bit)

> library(testthat)
> library(ps)
> 
> if (ps::ps_is_supported() && Sys.getenv("R_COVR", "") != "true" &&
+     Sys.getenv("NOT_CRAN") != "" ) {
+   reporter <- ps::CleanupReporter(testthat::SummaryReporter)$new()
+ } else {
+   reporter <- "summary"
+ }
> 
> if (ps_is_supported()) test_check("ps", reporter = reporter)
cleanup-reporter: 123456789abcdef
common: ............................g.....h......i.............SSSSS
connections: jkSlSSSSSSS
finished: S
kill-tree: ....SSSSSSS
linux: 
macos: .....SS
pid-reuse: .....................................................m.no.pq.rs.tu.vw.xy.z
posix-zombie: .................................A.BC.DE.FG.HI.JK.LM.N.........
posix: ...S......
ps: .
system: ..................
utils: ................
windows: 
winver: ......

══ Skipped ═════════════════════════════════════════════════════════════════════
1. children ('test-common.R:236:3') - Reason: On CRAN

2. num_fds ('test-common.R:265:3') - Reason: On CRAN

3. open_files ('test-common.R:281:3') - Reason: On CRAN

4. interrupt ('test-common.R:298:3') - Reason: On CRAN

5. cpu affinity ('test-common.R:315:3') - Reason: On CRAN

6. UNIX sockets with path ('test-connections.R:43:3') - Reason: socat is not available

7. TCP on loopback ('test-connections.R:81:3') - Reason: socat is not available

8. UDP ('test-connections.R:115:3') - Reason: socat is not available

9. UDP on loopback ('test-connections.R:139:3') - Reason: socat is not available

10. TCP6 ('test-connections.R:172:3') - Reason: socat is not available

11. TCP6 on loopback ('test-connections.R:193:3') - Reason: socat is not available

12. UDP6 ('test-connections.R:232:3') - Reason: Needs working IPv6 connection

13. UDP6 on loopback ('test-connections.R:257:3') - Reason: socat is not available

14. process already finished ('test-finished.R:3:3') - Reason: On CRAN

15. kill_tree ('test-kill-tree.R:12:3') - Reason: On CRAN

16. kill_tree, grandchild ('test-kill-tree.R:59:3') - Reason: On CRAN

17. kill_tree, orphaned grandchild ('test-kill-tree.R:127:3') - Reason: On CRAN

18. with_process_cleanup ('test-kill-tree.R:155:3') - Reason: On CRAN

19. find_tree ('test-kill-tree.R:182:3') - Reason: On CRAN

20. find_tree, grandchild ('test-kill-tree.R:207:3') - Reason: On CRAN

21. find_tree, orphaned grandchild ('test-kill-tree.R:255:3') - Reason: On CRAN

22. cpu_times ('test-macos.R:22:3') - Reason: On CRAN

23. memory_info ('test-macos.R:42:3') - Reason: On CRAN

24. username, uids, gids ('test-posix.R:26:3') - Reason: ps does not work properly

══ Failed ══════════════════════════════════════════════════════════════════════
── 1. Error ('test-cleanup-reporter.R:6:3'): unit: test, mode: cleanup-fail ────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:6:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:9:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 2. Error ('test-cleanup-reporter.R:30:3'): unit: test, multiple processes ───
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:30:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:33:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 3. Error ('test-cleanup-reporter.R:52:3'): on.exit() works ──────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_success(...)
       at test-cleanup-reporter.R:52:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:55:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 4. Error ('test-cleanup-reporter.R:72:3'): only report ──────────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:72:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:76:10
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 5. Error ('test-cleanup-reporter.R:93:3'): only kill ────────────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::with_reporter(...)
       at test-cleanup-reporter.R:93:2
  6. testthat::test_that(...)
       at test-cleanup-reporter.R:97:8
  7. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
  8. reporter$start_test(context = reporter$.context, test = test)
  9. ps::ps_open_files(ps_handle())
 10. ps:::not_null(.Call(psll_open_files, p))

── 6. Error ('test-cleanup-reporter.R:118:3'): unit: testsuite ─────────────────
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:118:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:123:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 7. Error ('test-cleanup-reporter.R:148:3'): R connection cleanup, test, close
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:148:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:151:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 8. Error ('test-cleanup-reporter.R:169:3'): R connection cleanup, test, do no
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:169:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:173:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))

── 9. Error ('test-cleanup-reporter.R:192:3'): R connection cleanup, test, close
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::with_reporter(...)
       at test-cleanup-reporter.R:192:2
  6. testthat::test_that(...)
       at test-cleanup-reporter.R:195:8
  7. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
  8. reporter$start_test(context = reporter$.context, test = test)
  9. ps::ps_open_files(ps_handle())
 10. ps:::not_null(.Call(psll_open_files, p))

── 10. Error ('test-cleanup-reporter.R:211:3'): R connections, unit: testsuite ─
<os_error/ps_error/error/condition>
Error: Operation not supported
Backtrace:
  1. testthat::expect_failure(...)
       at test-cleanup-reporter.R:211:2
 12. testthat::test_that(...)
       at test-cleanup-reporter.R:216:8
 13. testthat:::test_code(desc, code, env = parent.frame(), reporter = reporter)
 14. reporter$start_test(context = reporter$.context, test = test)
 15. ps::ps_open_files(ps_handle())
 16. ps:::not_null(.Call(psll_open_files, p))
  ... and 39 more

Maximum number of 10 failures reached, some test results may be missing.

══ DONE ════════════════════════════════════════════════════════════════════════
Error: Test failures
Execution halted

I do not ask anyone to fix this for older macOS, of course, but if you have ideas what may be going wrong, I can try fixing it on my end.

gaborcsardi commented 1 year ago

I don't think you can fix this, ps probably just does not work on this OS correctly. We could probably modify ps to return FALSE from ps::ps_is_supported().

barracuda156 commented 1 year ago

I don't think you can fix this, ps probably just does not work on this OS correctly. We could probably modify ps to return FALSE from ps::ps_is_supported().

@gaborcsardi Thank you. If it heavily relies on SDK features unavailable in <10.7, it may not work indeed, but many important features are in fact backported via LegacySupport in Macports, so chances could be there. I will look into the code a bit. One thing noticed: I guess, PPC arch is to be added here: https://github.com/r-lib/ps/blob/be0b29849d77baa26ad660014d11d5e4b16b72ab/src/api-macos.c#L829-L844 (and may be elsewhere).

barracuda156 commented 1 year ago

Code quoted above should be:

static bool ps_in_shared_region(mach_vm_address_t addr, cpu_type_t type) {
  mach_vm_address_t base;
  mach_vm_address_t size;

  switch (type) {
  case CPU_TYPE_ARM:
    base = SHARED_REGION_BASE_ARM;
    size = SHARED_REGION_SIZE_ARM;
    break;
  case CPU_TYPE_I386:
    base = SHARED_REGION_BASE_I386;
    size = SHARED_REGION_SIZE_I386;
    break;
  case CPU_TYPE_X86_64:
    base = SHARED_REGION_BASE_X86_64;
    size = SHARED_REGION_SIZE_X86_64;
    break;
  case CPU_TYPE_POWERPC:
    base = SHARED_REGION_BASE_PPC;
    size = SHARED_REGION_SIZE_PPC;
    break;
  case CPU_TYPE_POWERPC64:
    base = SHARED_REGION_BASE_PPC64;
    size = SHARED_REGION_SIZE_PPC64;
    break;
  default:
    return false;
  }

  return base <= addr && addr < (base + size);
}

(POWERPC vs PPC is intended and correct.)

barracuda156 commented 1 year ago

@gaborcsardi Tests on the same OS (10.6.8), but x86_64 arch:


R version 4.2.3 (2023-03-15) -- "Shortstop Beagle"
Copyright (C) 2023 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (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(ps)
> 
> if (ps::ps_is_supported() && Sys.getenv("R_COVR", "") != "true" &&
+     Sys.getenv("NOT_CRAN") != "" ) {
+   reporter <- ps::CleanupReporter(testthat::SummaryReporter)$new()
+ } else {
+   reporter <- "summary"
+ }
> 
> if (ps_is_supported()) test_check("ps", reporter = reporter)
cleanup-reporter: ..................................................................
common: .......................................................SSSSS
connections: ...............S......SSSSSSS
finished: S
kill-tree: ....SSSSSSS
linux: 
macos: .....SS
pid-reuse: ..........................................................................
posix-zombie: ...............................................................
posix: ...S......
ps: .
system: ..................
utils: ................
windows: 
winver: ......

══ Skipped ═════════════════════════════════════════════════════════════════════
1. children ('test-common.R:236:3') - Reason: On CRAN

2. num_fds ('test-common.R:265:3') - Reason: On CRAN

3. open_files ('test-common.R:281:3') - Reason: On CRAN

4. interrupt ('test-common.R:298:3') - Reason: On CRAN

5. cpu affinity ('test-common.R:315:3') - Reason: On CRAN

6. UNIX sockets with path ('test-connections.R:43:3') - Reason: socat is not available

7. TCP on loopback ('test-connections.R:81:3') - Reason: socat is not available

8. UDP ('test-connections.R:115:3') - Reason: socat is not available

9. UDP on loopback ('test-connections.R:139:3') - Reason: socat is not available

10. TCP6 ('test-connections.R:172:3') - Reason: socat is not available

11. TCP6 on loopback ('test-connections.R:193:3') - Reason: socat is not available

12. UDP6 ('test-connections.R:232:3') - Reason: Needs working IPv6 connection

13. UDP6 on loopback ('test-connections.R:257:3') - Reason: socat is not available

14. process already finished ('test-finished.R:3:3') - Reason: On CRAN

15. kill_tree ('test-kill-tree.R:12:3') - Reason: On CRAN

16. kill_tree, grandchild ('test-kill-tree.R:59:3') - Reason: On CRAN

17. kill_tree, orphaned grandchild ('test-kill-tree.R:127:3') - Reason: On CRAN

18. with_process_cleanup ('test-kill-tree.R:155:3') - Reason: On CRAN

19. find_tree ('test-kill-tree.R:182:3') - Reason: On CRAN

20. find_tree, grandchild ('test-kill-tree.R:207:3') - Reason: On CRAN

21. find_tree, orphaned grandchild ('test-kill-tree.R:255:3') - Reason: On CRAN

22. cpu_times ('test-macos.R:22:3') - Reason: On CRAN

23. memory_info ('test-macos.R:42:3') - Reason: On CRAN

24. username, uids, gids ('test-posix.R:26:3') - Reason: ps does not work properly

══ DONE ════════════════════════════════════════════════════════════════════════
> 
> proc.time()
   user  system elapsed 
  9.037   3.103  21.961 

For some reason we do not get a list of all those failures here, despite skipped tests still there.

gaborcsardi commented 1 year ago

Well, nothing fails here....

barracuda156 commented 1 year ago

Well, nothing fails here....

@gaborcsardi Then perhaps errors on 10.6.8 ppc should be fixable? SDK is pretty much identical (i.e. SDK itself is the same, but archs may have minor differences, like with regard to GCD), we can be sure, that any errors are not caused by macOS being too old.

gaborcsardi commented 1 year ago

Right, that makes sense. If you have patches, I'll be happy to fix them.

barracuda156 commented 1 year ago

Right, that makes sense. If you have patches, I'll be happy to fix them.

Ok, I will see if I can do something about this. (If you happen to recall instances where endianness is implied, if any, please let me know.)