Binary dependency in test_rule

98 views
Skip to first unread message

Nick Fischer

unread,
Oct 24, 2025, 9:31:28 AMOct 24
to bazel-discuss
Hi folks,

I'm currently working on a Bazel/rust project and I'm trying to set up integration tests for one of our apps. Without going into too much detail, the app is related to distributed messaging/communication.

For the integration test (rust_test) I would like to spawn multiple instances of the app's rust_binary with different configurations, observe the behavior and report a test result.

For now, unfortunately I've been unsuccessful in making rust_binary available inside the test sandbox. The closest thing I've come across is the rust_test's data field, but that will only include a non-executable binary in the sandbox.

What's the proper way of doing this? I would imagine this to be a common use case (e.g. spinning up a server app for client-side testing)

Thanks and best regards,
Dominik

Richard Lavoie

unread,
Oct 24, 2025, 10:52:13 AMOct 24
to Nick Fischer, bazel-discuss
This is a typical use case for https://github.com/dzbarsky/rules_itest to run integration tests.

Richard

On Oct 24, 2025, at 9:31 AM, Nick Fischer <hey.domin...@gmail.com> wrote:

Hi folks,
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/bazel-discuss/21102c7e-142f-4e21-b3a7-b40b3934bbe5n%40googlegroups.com.

Nick Fischer

unread,
Oct 28, 2025, 11:57:52 AMOct 28
to bazel-discuss
Thanks, I will give this a shot!

rel...@gmail.com

unread,
Nov 3, 2025, 8:21:51 AMNov 3
to bazel-discuss
In general, I believe that taking a data dependency on the rust_binary target and invoking it from the rust_test target would be expected to work.


What do you mean when you say it includes the non-executable binary in the sandbox?

-- Aaron

Nick Fischer

unread,
Nov 5, 2025, 9:25:54 AMNov 5
to bazel-discuss

Hi,

I thought I tried your approach before, and that the binary was accessible inside the runfiles but that it was not executable.
I just tried again, and it is indeed working. Maybe I messed something up with the paths. 
Thanks for the help!

best regards,
Nick
Reply all
Reply to author
Forward
0 new messages