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

cargo test --all-features fails during test_compile_fail with PermissionDenied when crate directory is read-only #421

Open
dkg opened this issue Oct 31, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@dkg
Copy link

dkg commented Oct 31, 2024

In Debian, the continuous integration service by default tests each crate from a read-only copy of the published crate (not from git).

When testing a read-only tree of derive_more 1.0.0, it fails with a bunch of PermissionDenied errors during test_compile_fail. I think these tests are trying to write a copy of stderr to disk somewhere in tree.

There are a few other errors/warnings mixed in there, but i think the predominant issue is the read-only filesystem:

In the debian CI, the --all-features test is known as rust-derive-more:@.

output from the test logs:
 98s test tests/compile_fail/as_mut/enum.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/multiple_field_attrs.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/multiple_struct_attrs.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/renamed_generic.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/skip_and_others.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/struct_and_field.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/struct_attr_empty.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/struct_attr_multiple_fields.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/struct_attr_tuple.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/unknown_field_attr_arg.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_mut/unknown_struct_attr_arg.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/enum.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/multiple_field_attrs.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/multiple_struct_attrs.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/renamed_generic.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/skip_and_others.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/struct_and_field.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/struct_attr_empty.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/struct_attr_multiple_fields.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/struct_attr_tuple.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/unknown_field_attr_arg.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/as_ref/unknown_struct_attr_arg.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/both_fmt_and_skip_on_field.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/duplicate_fmt_on_struct.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/duplicate_fmt_on_variant.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/extra_placeholder.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/fmt_on_container_and_field_simultaneously.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/fmt_on_enum.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/legacy_bound_syntax.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/legacy_fmt_syntax.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/lifetime_no_debug.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/missing_placeholder.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/named_field_prefixed_with_dot.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/unclosed_brace.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/unknown_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/unnamed_field_prefixed_with_dot.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/wrong_formatting_argument.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/wrong_named_parameter.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/debug/wrong_unnamed_parameter.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/extra_placeholder.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/legacy_bound_syntax.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/legacy_fmt_syntax.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/missing_placeholder.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/mutlifield_enum_variant_without_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/mutlifield_struct_without_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/named_field_prefixed_with_dot.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/non_display_implicit_enum_unit_variant.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/shared_format_positional_placeholders.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/shared_format_unclosed_brace.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/shared_format_variant_spec.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/unclosed_brace.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/unknown_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/unnamed_field_prefixed_with_dot.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/wrong_formatting_argument.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/wrong_named_parameter.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/display/wrong_unnamed_parameter.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/legacy_enum_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/legacy_struct_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/multiple_enum_attributes.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/multiple_struct_attributes.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/struct_tuple_no_parens.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/struct_tuple_too_long.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/struct_tuple_too_short.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/from/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/enum.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/legacy_complex_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/legacy_types_attribute.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/mixed_field_skip_types.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/mixed_regular_and_wrapped_types.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/multiple_skip.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/tuple_no_parens.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/tuple_too_long.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/tuple_too_short.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/into/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/is_variant/must_use.rs ... error
 98s Expected test case to fail to compile, but it succeeded.
 98s 
 98s WARNINGS:
 98s ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
 98s warning: unused return value of `MustUse::is_yes` that must be used
 98s  --> /usr/share/cargo/registry/derive-more-1.0.0/tests/compile_fail/is_variant/must_use.rs:9:5
 98s   |
 98s 9 |     must_use.is_yes();
 98s   |     ^^^^^^^^^^^^^^^^^
 98s   |
 98s note: the lint level is defined here
 98s  --> /usr/share/cargo/registry/derive-more-1.0.0/tests/compile_fail/is_variant/must_use.rs:6:10
 98s   |
 98s 6 | #[forbid(unused_must_use)]
 98s   |          ^^^^^^^^^^^^^^^
 98s help: use `let _ = ...` to ignore the resulting value
 98s   |
 98s 9 |     let _ = must_use.is_yes();
 98s   |     +++++++
 98s 
 98s warning: 1 warning emitted
 98s ┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
 98s 
 98s test tests/compile_fail/try_from/invalid_repr.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/try_from/struct.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s test tests/compile_fail/try_from/union.rs ... error
 98s Permission denied (os error 13)
 98s 
 98s 
 98s 
 98s test compile_fail ... FAILED
 98s 
 98s failures:
 98s 
 98s ---- compile_fail stdout ----
 98s thread 'compile_fail' panicked at /usr/share/cargo/registry/trybuild-1.0.99/src/run.rs:101:13:
 98s 81 of 81 tests failed
 98s stack backtrace:
 98s    0: rust_begin_unwind
 98s              at /usr/src/rustc-1.81.0/library/std/src/panicking.rs:665:5
 98s    1: core::panicking::panic_fmt
 98s              at /usr/src/rustc-1.81.0/library/core/src/panicking.rs:74:14
 98s    2: trybuild::run::<impl trybuild::Runner>::run
 98s              at /usr/share/cargo/registry/trybuild-1.0.99/src/run.rs:101:13
 98s    3: <trybuild::TestCases as core::ops::drop::Drop>::drop
 98s              at /usr/share/cargo/registry/trybuild-1.0.99/src/lib.rs:319:13
 98s    4: core::ptr::drop_in_place<trybuild::TestCases>
 98s              at /usr/src/rustc-1.81.0/library/core/src/ptr/mod.rs:542:1
 98s    5: compile_fail::compile_fail
 98s              at /usr/share/cargo/registry/derive-more-1.0.0/tests/compile_fail/mod.rs:6:1
 98s    6: compile_fail::compile_fail::{{closure}}
 98s              at /usr/share/cargo/registry/derive-more-1.0.0/tests/compile_fail/mod.rs:3:18
 98s    7: core::ops::function::FnOnce::call_once
 98s              at /usr/src/rustc-1.81.0/library/core/src/ops/function.rs:250:5
 98s    8: core::ops::function::FnOnce::call_once
 98s              at /usr/src/rustc-1.81.0/library/core/src/ops/function.rs:250:5
 98s note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
 98s 
 98s 
 98s failures:
 98s     compile_fail
 98s 
 98s test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 11.86s
 98s 
 98s error: test failed, to rerun pass `--test compile_fail`
 99s autopkgtest [04:13:24]: test rust-derive-more:@: -----------------------]
@tyranron tyranron self-assigned this Nov 6, 2024
@tyranron tyranron added this to the 2.0.0 milestone Nov 6, 2024
@tyranron
Copy link
Collaborator

tyranron commented Nov 6, 2024

@dkg I think we won't be able to overcome this limitation as the whole thing is handled by the trybuild crate and there is no configuration for this behavior.

Either allow writing to temporary directories on CI, or if that is not possible, use -- --skip compile_fail in the end of your cargo test commands to omit them.

@dkg
Copy link
Author

dkg commented Dec 2, 2024

@tyranron thanks for the review. If the problem is with trybuild, have you reported any issue to that crate, that it will fail when the source tree is unwritable?

in the debian CI, there are definitely writable temporary directories available, but they are not within the source tree.

@tyranron
Copy link
Collaborator

tyranron commented Dec 2, 2024

@dkg as far as I see, trybuild operates within the target/tests/trybuild/ directory, and target/ is expected to be writable when building Rust. Do you change the CARGO_TARGET_DIR somehow in your setup?

@tyranron tyranron reopened this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants