Skip to content

Link Rust Tests to C Dependencies in Tor (allow integration testing from Rust to C)

currently, it is not possible to call C Tor, directly or indirectly, from rust tests. one of the following must be done:

  1. provide rust stubs for all C functions that may be needed for tests (impractical)

  2. test rust functions from C (so we will have C tests calling Rust functions calling C functions)

  3. link C functions into rust doctests (preferred)

  4. never call C-using rust functions in tests (leads to poor test coverage, very bad)

my branch https://cgit.alxu.ca/tor.git/commit/?h=fix-rust-tests implements option 3 poorly. this is a bad solution firstly because it is very ugly, and secondly because it does not properly pass the system linking arguments, e.g. -L/opt/ssl. thirdly, it may hide problems in or cause to be compiled incorrectly dependency crates.

this ticket blocks a number of rust improvements, since of course we would like to actually test the improvements, and doctests are the best way to do it in rust.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information