JelteF / derive_more

Some more derive(Trait) options
MIT License
1.74k stars 123 forks source link

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

Open dkg opened 2 weeks ago

dkg commented 2 weeks ago

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::::run 98s at /usr/share/cargo/registry/trybuild-1.0.99/src/run.rs:101:13 98s 3: ::drop 98s at /usr/share/cargo/registry/trybuild-1.0.99/src/lib.rs:319:13 98s 4: core::ptr::drop_in_place 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 commented 1 week ago

@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.