Skip to content

Tests should not generate files in the tests directory #499

@sylvestre

Description

@sylvestre

TMPDIR is probably a better place than
/usr/share/cargo/registry/cbindgen-0.13.2/tests/expectations/typedef.compat.o (as example

Note that this is failing in Debian pacakges test CI:
https://ci.debian.net/packages/r/rust-cbindgen/

Example:

---- test_typedef stdout ----
Running: "/tmp/tmp.DS1uKzckhx/target/x86_64-unknown-linux-gnu/debug/cbindgen" "--lang" "c" "--cpp-compat" "--style" "type" "-o" "/usr/share/cargo/registry/cbindgen-0.13.2/tests/expectations/typedef.compat.c" "/usr/share/cargo/registry/cbindgen-0.13.2/tests/rust/typedef.rs"
Running: "gcc" "-D" "DEFINED" "-c" "/usr/share/cargo/registry/cbindgen-0.13.2/tests/expectations/typedef.compat.c" "-o" "/usr/share/cargo/registry/cbindgen-0.13.2/tests/expectations/typedef.compat.o" "-I" "/usr/share/cargo/registry/cbindgen-0.13.2/tests" "-Wall" "-Werror" "-Wno-attributes" "-g" "-O2" "-fdebug-prefix-map=/usr/share/cargo/registry/cbindgen-0.13.2=." "-fstack-protector-strong" "-Wformat" "-Werror=format-security" "-D" "CBINDGEN_STYLE_TYPE"
thread 'test_typedef' panicked at 'Output failed to compile: Output { status: ExitStatus(ExitStatus(256)), stdout: "", stderr: "Assembler messages:\nFatal error: can\'t create /usr/share/cargo/registry/cbindgen-0.13.2/tests/expectations/typedef.compat.o: Permission denied\n" }', tests/tests.rs:106:5
stack backtrace:
   0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
   1: core::fmt::write
   2: std::io::Write::write_fmt
   3: std::io::impls::<impl std::io::Write for alloc::boxed::Box<W>>::write_fmt
   4: std::panicking::default_hook::{{closure}}
   5: std::panicking::default_hook
   6: std::panicking::rust_panic_with_hook
   7: std::panicking::continue_panic_fmt
   8: std::panicking::begin_panic_fmt
   9: tests::compile
             at tests/tests.rs:106
  10: tests::run_compile_test
             at tests/tests.rs:150
  11: tests::test_file
             at tests/tests.rs:161
  12: tests::test_typedef
             at tests/tests.rs:185
  13: tests::test_typedef::{{closure}}
             at tests/tests.rs:184
  14: core::ops::function::FnOnce::call_once
             at /usr/src/rustc-1.40.0/src/libcore/ops/function.rs:227
  15: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
  16: __rust_maybe_catch_panic
  17: test::run_test_in_process
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions