build-cran-binaries/local/tests/test-r-minor-helpers.R
pat-s cdfdcd035d
perf: seed pure-R binaries into a new slot, interleave shards, and stop builds before the timeout
- Add local/seed-pure-r.R, opt-in via SEED_FROM on install-deps: copy pure-R
  binaries server-side from a slot of the same OS family and arch, after
  verifying each is a binary, has no compiled code, was built by the primary
  R minor, and passes bincraft's cross-minor ABI check; write the
  single_builds and abi_flat_safety rows an upload would.
- Interleave build-all shards with shard_slice() instead of contiguous
  alphabetical blocks, which ranged from 0.1h to 28h per shard.
- Share one BUILD_DEADLINE (BUILD_BUDGET_HOURS, default 44h) across every
  build pass of a build-all-versions step so long runs stop cleanly and
  still archive and index what they built.
- Derive the single_builds platform with codename_platform() instead of a
  hard-coded list.
2026-10-24 01:58:25 +00:00

45 lines
1.6 KiB
R

source(file.path("..", "r-minor-helpers.R"))
test_that("pure-r (NeedsCompilation != yes) is not sensitive", {
expect_identical(classify_from_metadata("no", NA, c("Rcpp")), "not-sensitive")
expect_identical(
classify_from_metadata("", "Rcpp", c("Rcpp")),
"not-sensitive"
)
})
test_that("LinkingTo a risky dep is sensitive (version constraints stripped)", {
expect_identical(
classify_from_metadata("yes", "Rcpp (>= 1.0)", c("Rcpp")),
"sensitive"
)
expect_identical(
classify_from_metadata("yes", "R6,\n cpp11", c("Rcpp", "cpp11")),
"sensitive"
)
})
test_that("compiled but no risky LinkingTo is ambiguous (needs source)", {
expect_identical(
classify_from_metadata("yes", "R6", c("Rcpp", "cpp11")),
"ambiguous"
)
expect_identical(classify_from_metadata("yes", NA, c("Rcpp")), "ambiguous")
})
test_that("codename_platform names the single_builds platform", {
expect_identical(codename_platform("alpine325"), "alpine-325")
expect_identical(codename_platform("rhel9"), "redhat-9")
expect_identical(codename_platform("noble"), "ubuntu-2404")
expect_identical(codename_platform("resolute"), "ubuntu-2604")
expect_identical(codename_platform("bogus"), NA_character_)
})
test_that("build_deadline reads BUILD_DEADLINE and defaults to none", {
expect_identical(build_deadline(""), Inf)
expect_identical(build_deadline("not a number"), Inf)
expect_identical(build_deadline("1700000000"), 1700000000)
expect_false(deadline_reached(Inf))
expect_true(deadline_reached(100, now = 100))
expect_false(deadline_reached(100, now = 99))
})