buck2 icon indicating copy to clipboard operation
buck2 copied to clipboard

commands::build::out::tests::unix::test_copy_file fails on macOS

Open lf- opened this issue 7 months ago • 2 comments

I don't know why this is misbehaving on my machine.

---- commands::build::out::tests::unix::test_copy_file stdout ----

thread 'commands::build::out::tests::unix::test_copy_file' panicked at app/buck2_client/src/commands/build/out.rs:556:13:
assertion failed: `Ok(Some(ExitStatus(unix_wait_status(9))))` does not match `Ok(None)`
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/panicking.rs:75:14
   2: buck2_client::commands::build::out::tests::unix::test_copy_file::{{closure}}
             at ./src/commands/build/out.rs:556:13
   3: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-0.1.41/src/instrument.rs:321:9
   4: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:733:54
   5: tokio::task::coop::with_budget
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/task/coop/mod.rs:167:5
   6: tokio::task::coop::budget
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/task/coop/mod.rs:133:5
   7: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:733:25
   8: tokio::runtime::scheduler::current_thread::Context::enter
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:432:19
   9: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:732:36
  10: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:820:68
  11: tokio::runtime::context::scoped::Scoped<T>::set
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context/scoped.rs:40:9
  12: tokio::runtime::context::set_scheduler::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context.rs:180:26
  13: std::thread::local::LocalKey<T>::try_with
             at /Users/jade/.rustup/toolchains/nightly-2025-02-16-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:310:12
  14: std::thread::local::LocalKey<T>::with
             at /Users/jade/.rustup/toolchains/nightly-2025-02-16-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:274:15
  15: tokio::runtime::context::set_scheduler
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context.rs:180:9
  16: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:820:27
  17: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:720:19
  18: tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:200:28
  19: tokio::runtime::context::runtime::enter_runtime
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context/runtime.rs:65:16
  20: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:188:9
  21: tokio::runtime::runtime::Runtime::block_on_inner
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/runtime.rs:368:47
  22: tokio::runtime::runtime::Runtime::block_on
             at /Users/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/runtime.rs:342:13
  23: buck2_client::commands::build::out::tests::unix::test_copy_file
             at ./src/commands/build/out.rs:558:13
  24: buck2_client::commands::build::out::tests::unix::test_copy_file::{{closure}}
             at ./src/commands/build/out.rs:533:38
  25: core::ops::function::FnOnce::call_once
             at /Users/jade/.rustup/toolchains/nightly-2025-02-16-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  26: core::ops::function::FnOnce::call_once
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.


failures:
    commands::build::out::tests::unix::test_copy_file

test result: FAILED. 20 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

Version: 68384d4890301420751de5b9d2a00cd7e37925fb

Environment:

  • macOS 15.4.1
  • rustup 1.27.1 from nixpkgs
  • not using the nix shell in buck2, just running cargo test directly in the root of the repo.

lf- avatar May 05 '25 23:05 lf-

Intriguing, I also have a failure of this on my x86_64-linux NixOS machine:

thread 'commands::build::out::tests::unix::test_copy_file' panicked at app/buck2_client/src/commands/build/out.rs:544:13:
assertion failed: res.success()
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:695:5
   1: core::panicking::panic_fmt
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/panicking.rs:145:5
   3: buck2_client::commands::build::out::tests::unix::test_copy_file::{{closure}}
             at ./src/commands/build/out.rs:544:13
   4: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tracing-0.1.41/src/instrument.rs:321:9
   5: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:733:54
   6: tokio::task::coop::with_budget
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/task/coop/mod.rs:167:5
   7: tokio::task::coop::budget
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/task/coop/mod.rs:133:5
   8: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:733:25
   9: tokio::runtime::scheduler::current_thread::Context::enter
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:432:19
  10: tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:732:36
  11: tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:820:68
  12: tokio::runtime::context::scoped::Scoped<T>::set
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context/scoped.rs:40:9
  13: tokio::runtime::context::set_scheduler::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context.rs:180:26
  14: std::thread::local::LocalKey<T>::try_with
             at /nix/store/7kmidw3ln4y95baxb6v8gx3wq3lqryi6-rust-default-1.86.0-nightly-2025-02-16/lib/rustlib/src/rust/library/std/src/thread/local.rs:310:12
  15: std::thread::local::LocalKey<T>::with
             at /nix/store/7kmidw3ln4y95baxb6v8gx3wq3lqryi6-rust-default-1.86.0-nightly-2025-02-16/lib/rustlib/src/rust/library/std/src/thread/local.rs:274:15
  16: tokio::runtime::context::set_scheduler
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context.rs:180:9
  17: tokio::runtime::scheduler::current_thread::CoreGuard::enter
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:820:27
  18: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:720:19
  19: tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:200:28
  20: tokio::runtime::context::runtime::enter_runtime
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/context/runtime.rs:65:16
  21: tokio::runtime::scheduler::current_thread::CurrentThread::block_on
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/scheduler/current_thread/mod.rs:188:9
  22: tokio::runtime::runtime::Runtime::block_on_inner
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/runtime.rs:368:47
  23: tokio::runtime::runtime::Runtime::block_on
             at /home/jade/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.44.2/src/runtime/runtime.rs:342:13
  24: buck2_client::commands::build::out::tests::unix::test_copy_file
             at ./src/commands/build/out.rs:558:13
  25: buck2_client::commands::build::out::tests::unix::test_copy_file::{{closure}}
             at ./src/commands/build/out.rs:533:38
  26: core::ops::function::FnOnce::call_once
             at /nix/store/7kmidw3ln4y95baxb6v8gx3wq3lqryi6-rust-default-1.86.0-nightly-2025-02-16/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  27: core::ops::function::FnOnce::call_once
             at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

lf- avatar May 05 '25 23:05 lf-

On NixOS, this fails since the test tries to copy /bin/sleep which doesn't exist.

https://github.com/facebook/buck2/blob/72df3e3ffd92449c7fe57b4066d17f41e2ffb11b/app/buck2_client/src/commands/build/out.rs#L543

sid-code avatar Sep 13 '25 03:09 sid-code