Skip to content

Commit 0e721e6

Browse files
committed
test archSystemFile() against 'libs', which actually uses the arch subdir
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.
1 parent 3a8d050 commit 0e721e6

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

tests/test-arch-system-file.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# introduced when systemFile() was renamed (see #251, #252). It injects the
33
# architecture-specific subdirectory (.Platform$r_arch) used on Windows, e.g.
44
# archSystemFile("lib") -> 'lib/x64', while behaving like system.file()
5-
# elsewhere.
5+
# elsewhere. Note that this subdirectory only ever holds compiled libraries
6+
# ('lib', 'libs'); headers and other resources are never installed under it.
67

78
RcppParallel:::test_init()
89

@@ -23,12 +24,8 @@ samePath <- function(a, b) {
2324
# should be equivalent to a plain system.file() call
2425
if (!nzchar(arch)) {
2526
assert(samePath(
26-
archSystemFile("include"),
27-
system.file("include", package = "RcppParallel")
28-
))
29-
assert(samePath(
30-
archSystemFile("include", "RcppParallel.h"),
31-
system.file("include/RcppParallel.h", package = "RcppParallel")
27+
archSystemFile("libs"),
28+
system.file("libs", package = "RcppParallel")
3229
))
3330
}
3431

@@ -42,7 +39,9 @@ expected <- function(dir, name = NULL) {
4239
assert(samePath(archSystemFile("lib"), expected("lib")))
4340
assert(samePath(archSystemFile("lib", "libtbb.so"), expected("lib", "libtbb.so")))
4441

45-
# a real, shipped resource resolves to an existing path
46-
header <- archSystemFile("include", "RcppParallel.h")
47-
assert(nzchar(header))
48-
assert(file.exists(header))
42+
# the package's own compiled code is installed under 'libs' (or 'libs/<arch>'
43+
# on Windows) -- exactly the arch-aware lookup archSystemFile() exists for --
44+
# so it must resolve to an existing directory on every platform
45+
libs <- archSystemFile("libs")
46+
assert(nzchar(libs))
47+
assert(dir.exists(libs))

0 commit comments

Comments
 (0)