Skip to content

Add behavioural tests for spank_qrmi - #210

Draft
awennersteen wants to merge 1 commit into
mainfrom
aw/spank-qrmi-tests
Draft

awennersteen wants to merge 1 commit into
mainfrom
aw/spank-qrmi-tests

Conversation

@awennersteen

@awennersteen awennersteen commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description of Change

Adds a CTest suite under plugins/tests/spank_qrmi/ that runs the plugin hooks the way slurmstepd does for a batch step (slurm_spank_init -> slurm_spank_task_init -> slurm_spank_exit), without a Slurm cluster or a QPU.

  • The test #includes spank_qrmi.c and provides fake spank_*/slurm_* and qrmi_* functions against the real slurm/spank.h and qrmi.h, so it links neither libslurm nor libqrmi. Each case records calls and checks the resulting job environment.
  • Each case runs in its own process with a 5 s alarm, so a hang shows up as a failure.
  • 17 cases: no --qpu, task step skipped, missing/failing config, one or several resources, unknown resources (alone and in a list), inaccessible resource, failing acquire, --env: plugin arguments (with and without =), copying {name}_QRMI_* from the job environment (including entries without =), token export and release with the matching deallocator, a fresh token replacing one inherited from the job environment, and RUST_LOG from SRUN_DEBUG.
  • CI runs the suite after the first spank_qrmi build, which fetches qrmi.h.

One case is WILL_FAIL because it hits a bug on main; whichever of this PR and #204 merges second should drop it from the list in CMakeLists.txt:

(unknown_resource_in_list was WILL_FAIL until #209 merged.)

Testing

Prepared by Claude, not yet reviewed by @awennersteen.

Build spank_qrmi.c into a test binary with fake Slurm and QRMI functions
and run the plugin hooks the way slurmstepd does for a batch step. The
cases cover --qpu with one or several resources, unknown, inaccessible
and failing resources, --env: plugin arguments, copying {name}_QRMI_*
from the job environment, token export and release, and RUST_LOG from
SRUN_DEBUG.

One case is marked WILL_FAIL because it hits a bug on main: a token
already in the job environment wins over the one just acquired (#204).

CI runs the tests after the first spank_qrmi build, which provides
qrmi.h.
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