Skip to content

test: parameterize bind.bats/cwd.bats by binary - #452

Merged
oxr463 merged 1 commit into
masterfrom
parameterize-tests-by-binary
Oct 2, 2026
Merged

oxr463 merged 1 commit into
masterfrom
parameterize-tests-by-binary

Conversation

@oxr463

@oxr463 oxr463 commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Implements item 4 of doc/testing-framework-proposal.rst: the same Bats file runs as a conformance check against both proot and proot-rs, with $PROOT pointing at either implementation.
  • The two CLI dialects agree on everything bind.bats/cwd.bats exercise (-b/-r/-w, a positional command) except one thing: proot-rs's clap-based parser needs a literal -- before the traced command, or it tries to parse the command's own flags (like /bin/sh's -c) as its own. This implementation's getopt-style parser rejects that separator outright rather than treating it as a no-op.
  • Rather than hand-translating each dialect inside every test body, test bodies now always write -- before the traced command (matching proot-rs's own existing convention), and the proot() helper wrapper strips it unless PROOT_IMPL=proot-rs is set.
  • auxv.bats/readlink.bats/no-new-privs.bats, which never use --, are unaffected, since the wrapper only strips the separator when present.

Test plan

  • bind.bats/cwd.bats (6 tests) pass unmodified against a native proot build (PROOT=src/proot)
  • The same 6 tests pass unmodified against a proot-rs debug build (PROOT=.../proot-rs/target/debug/proot-rs PROOT_IMPL=proot-rs) - genuine cross-implementation conformance, not just independent passes
  • Full combined suite (bind.bats cwd.bats auxv.bats readlink.bats no-new-privs.bats, 14 tests) still passes against proot with the updated helper
  • shellcheck clean on all three changed files

Implements item 4 of doc/testing-framework-proposal.rst: let the same
Bats file run as a conformance check against both proot and proot-rs,
with $PROOT pointing at either implementation.

The two CLI dialects agree on everything these tests exercise (-b/-r/-w,
a positional command) except one thing: proot-rs's clap-based parser
needs a literal "--" before the traced command, or it tries to parse
the command's own flags (like /bin/sh's -c) as its own. This
implementation's getopt-style parser rejects that separator outright.
Rather than hand-translating each dialect, test bodies now always
write "--" before the command, and the proot() wrapper strips it
unless PROOT_IMPL=proot-rs.

Verified in Docker: the same bind.bats/cwd.bats pass unmodified
against both a native proot build (PROOT=src/proot) and a proot-rs
debug build (PROOT=.../proot-rs/target/debug/proot-rs PROOT_IMPL=proot-rs),
and the existing auxv.bats/readlink.bats/no-new-privs.bats - which
never use "--" - are unaffected, since the wrapper only strips the
separator when present.

Claude-Session: https://claude.ai/code/session_016jPQ9wt6qox2XEbE71wwCW
@oxr463 oxr463 added this to the PRoot v5.5.0 milestone Oct 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 2, 2026

Copy link
Copy Markdown

@oxr463
oxr463 merged commit f078d29 into master Oct 2, 2026
11 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