<aside> 💡 Rust unit tests and the debugger runs very weirdly if we need to run it with Python.
Hence, when running Rust-only tests from VSCode and trying to use the VSCode debugger, there are some settings which you will need to fix.
</aside>
In order to enable logs (e.g. tracing::debug!("...")
) to appear in console when you run your tests, you can pull in an external dependency test_log
which provides an overridden #[test]
macro:
Now when you write Rust tests, you can use the new #[test]
macro and it will correctly initialize the logger to print logs to console. You can run Rust tests with a custom log level (in this case the debug
level, running on the tests module in a specific library logical_optimization::rules::split_actor_pool_projects
) like so:
RUST_LOG=debug cargo test \\
--package daft-plan \\
--lib \\
--no-default-features \\
-- \\
logical_optimization::rules::split_actor_pool_projects::tests \\
--show-output
<aside> ❗
If you are having issues make sure you are using the latest Python (Cython) uv python install 3.12.
You should get Python 3.12.6.
In @Andrew Gazelka ‘s experience it is also correctly signed (requirement for debugging). However, if it is not you might need to sign it or disable System Integrity Protection SIP (please talk to team before disabling SIP, it is not recommended)
</aside>
To debug Rust-side code on Daft, you may use LLDB. On macOS, it will be installed along with other XCode tools already, otherwise follow the instructions on the website.
To start debugging a program, run lldb [program] -- [args]
. For example, if you wanted to debug a script script.py
, you could run lldb .venv/bin/python -- script.py
.
Once you are in LLDB, you can now start debugging your program! Here are some common commands:
b src/daft-core/src/array/mod.rs:47
r
or process launch
bt
fr v
fr v foo
s
n