Skip to content

test/ci: lock cross-platform shareData behavior and add scheduled C-safety checks #95

Open

Description

@davidbudzynski

Problem

The test suite already covers most cross-platform behavior:

  • inst/tinytest/test-share.R:22-26 checks the POSIX read-once vs Windows repeat-read difference.
  • inst/tinytest/test-nthread.R checks that nThread = 1 and nThread = 2 give identical results for the five OpenMP functions.
  • inst/tinytest/test-enc.R checks checkEnc = TRUE vs FALSE.
  • inst/tinytest/test-psort.R checks c.locale = TRUE against sort(method = "radix").

Two gaps remain:

  1. The docs will say a leading / in map_name is optional. Add a test for that on both POSIX and Windows.
  2. CI only runs normal execution. The package has manual memory management, hash tables, OpenMP, and long-vector paths. Add scheduled gctorture and valgrind jobs.

What to change

Test

Add to inst/tinytest/test-share.R:

# map_name without a leading slash must work on every platform
noslash <- paste0("kit55-noslash-", Sys.getpid())
h <- tryCatch(shareData(mtcars, noslash), error = function(err) NULL)
if (!is.null(h)) {
  expect_identical(getData(noslash), mtcars,
                   info = "share-0055.015 no leading slash")
  expect_true(clearData(h), info = "share-0055.016 no leading slash cleanup")
}

CI

Add a scheduled job (weekly or manual) that runs:

  • R CMD check --use-gct --no-manual --no-build-vignettes
  • R CMD check --use-valgrind --no-manual --no-build-vignettes

Keep these off pull requests; they are slow.

Sketch of the job
  c-safety:
    if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: r-lib/actions/setup-r@v2
      - uses: r-lib/actions/setup-r-dependencies@v2
        with:
          extra-packages: any::tinytest
      - name: gctorture
        run: R CMD check --use-gct --no-manual --no-build-vignettes .
      - name: valgrind
        run: |
          sudo apt-get update
          sudo apt-get install -y valgrind
          rm -rf kit.Rcheck
          R CMD check --use-valgrind --no-manual --no-build-vignettes .

R floor

DESCRIPTION says R (>= 3.5.0), but CI's oldest job is oldrel-4. Either:

  • add a rocker/r-ver:3.5.3 job that runs the tests, or
  • bump the floor to a version CI actually tests and remove the old-R shims in src/kit.h.

Acceptance

  • The no-slash shareData test passes on Linux, macOS, and Windows.
  • Scheduled gctorture and valgrind jobs exist and pass.
  • The declared R floor is tested, or the floor is raised.

Notes

--use-gct failed locally on macOS with cannot open file 'startup.Rs': Permission denied. That is a local sandbox issue, not a package failure. Run it on Linux CI.

Related: #63 (closed) covered earlier test gaps; #57 (closed) covered the CI matrix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions