Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two more testing improvements #317

Merged
merged 2 commits into from
Aug 20, 2024
Merged

Conversation

cgwalters
Copy link
Contributor

tests: Fix extra - in should-fail tests

I had an extra - at the end here which was being interpreted
as an xattr...It turns out that mkcomposefs is liberal here
in what it accepts (string parsing in C stinks) and interprets
a missing = to be an xattr with the provided name, and
no value.

In this specific case that's an xattr with the name -.

The Rust parser is stricter and rejects this (which I think
is a good thing), and this is preparation for doing stronger
verification on the Rust side before we start passing data
into C.

Signed-off-by: Colin Walters walters@verbum.org


rust: Also test we fail to parse the should-fail- cases

This way, callers of the Rust API get validation before
we start passing things down to the C code.
(To be clear, the C code also needs sanity tests, but
it's way more reliable to test things on the Rust side)

Signed-off-by: Colin Walters walters@verbum.org


I had an extra `-` at the end here which was being interpreted
as an xattr...It turns out that `mkcomposefs` is liberal here
in what it accepts (string parsing in C stinks) and interprets
a missing `=` to be an xattr with the provided name, and
no value.

In this *specific* case that's an xattr with the name `-`.

The Rust parser is stricter and rejects this (which I think
is a good thing), and this is preparation for doing stronger
verification on the Rust side before we start passing data
into C.

Signed-off-by: Colin Walters <walters@verbum.org>
This way, callers of the Rust API get validation before
we start passing things down to the C code.
(To be clear, the C code also needs sanity tests, but
 it's way more reliable to test things on the Rust side)

Signed-off-by: Colin Walters <walters@verbum.org>
),
(
"no ftype",
include_str!("../../../tests/assets/should-fail-no-ftype.dump"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note I didn't need to change the Rust side for this one, it was already strictly validating the mode 🏆

@cgwalters cgwalters merged commit 8e9ea44 into containers:main Aug 20, 2024
24 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.

2 participants