Skip to content

add tests for isProcessForkedChild() and archSystemFile()#266

Merged
kevinushey merged 4 commits into
masterfrom
test-fork-and-arch-system-file
Jul 24, 2026
Merged

add tests for isProcessForkedChild() and archSystemFile()#266
kevinushey merged 4 commits into
masterfrom
test-fork-and-arch-system-file

Conversation

@kevinushey

Copy link
Copy Markdown
Contributor

Adds automated coverage for two additions since 5.1.11 that previously had no tests.

tests/test-fork.R

Covers isProcessForkedChild() (#243, #244):

  • returns FALSE in the parent process
  • returns TRUE inside parallel::mclapply workers (skipped on Windows, which has no fork())
  • the parent's own view is unchanged after forking

tests/test-arch-system-file.R

Covers archSystemFile() (#251, #252):

  • equivalent to system.file() when there is no arch subdirectory
  • composes the arch-specific subdirectory when .Platform$r_arch is set
  • a real shipped resource (include/RcppParallel.h) resolves to an existing path

Both follow the existing tests/test-*.R harness conventions (test_init() + assert()), so they run under R CMD check.

cover two 6.0.0 additions that previously had no automated tests:

- isProcessForkedChild(): FALSE in the parent, TRUE in parallel::mclapply
  workers (skipped on Windows, which has no fork())
- archSystemFile(): delegates to system.file() with no arch subdir, and
  composes the arch-specific subdirectory when .Platform$r_arch is set
identical() is a byte-for-byte string comparison, but two paths can denote
the same file while differing in separators, case, or symlink resolution.
normalize both sides before comparing, preserving system.file()'s ""
not-found sentinel (normalizePath("") would resolve to the working dir).
…bdir

the previous existence check used archSystemFile("include", ...), but the
arch-specific subdirectory only ever holds compiled libraries -- headers are
never installed under it. on Windows (r_arch = "x64") this looked for
'include/x64/RcppParallel.h', which does not exist; on unix (r_arch = "")
the injection was a no-op, so the mistake was invisible locally. use 'libs',
where the package's compiled code lives on every platform.
@kevinushey
kevinushey merged commit c544093 into master Jul 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant